* pread.c: Include stdio.h.
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2
3 * pread.c: Include stdio.h.
4
5 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6
7 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8 defined.
9
10 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11
12 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13 Change read_shndx type to unsigned int.
14 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
15 int.
16 (Sized_dwarf_line_info::read_line_mappings): Likewise.
17 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
18 Change read_shndx type to unsigned int.
19 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
20 int.
21 (Sized_dwarf_line_info::read_line_mappings): Likewise.
22 * layout.cc (Layout::create_symtab_sections): Cast the result of
23 local_symcount * symsize to off_t in the gold_assert.
24
25 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
26
27 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
28 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
29 R_ARM_BASE_ABS.
30 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
31 (Arm_relocate_functions::thm_abs5): New function.
32 (Arm_relocate_functions::abs12): New function.
33 (Arm_relocate_functions::abs16): New function.
34 (Arm_relocate_functions::base_abs): New function.
35 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
36 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
37 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
38 R_ARM_BASE_ABS.
39 (Scan::global): Likewise.
40 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
41 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
42 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
43 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
44 R_ARM_BASE_ABS.
45
46 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
47
48 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
49 (Arm_relocate_functions::movt_prel): New function.
50 (Arm_relocate_functions::thm_movw_prel_nc): New function.
51 (Arm_relocate_functions::thm_movt_prel): New function.
52 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
53 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
54 (Scan::global, Relocate::relocate): Likewise.
55 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
56
57 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
58
59 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
60 Incremental_checker.
61 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
62 unsigned int.
63 (class Incremental_inputs_header): New class.
64 (Incremental_inputs_header_writer): Edit comment.
65 (Incremental_inputs_entry): New class.
66 (Incremental_inputs_entry_writer): Edit comment.
67 (Sized_incremental_binary::do_find_incremental_inputs_section):
68 Add *strtab_shndx parameter, fill it.
69 (Sized_incremental_binary::do_check_inputs): New method.
70 (Incremental_checker::can_incrementally_link_output_file): Use
71 Sized_incremental_binary::check_inputs.
72 (Incremental_inputs::report_command_line): Save command line in
73 command_line_.
74 * incremental.h:
75 (Incremental_binary::find_incremental_inputs_section): New
76 method.
77 (Incremental_binary::do_find_incremental_inputs_section): Add
78 strtab_shndx parameter.
79 (Incremental_binary::do_check_inputs): New pure virtual method.
80 (Sized_incremental_binary::do_check_inputs): Declare.
81 (Incremental_checker::Incremental_checker): Add incremental_inputs
82 parameter, use it to initialize incremental_inputs_.
83 (Incremental_checker::incremental_inputs_): New field.
84 (Incremental_checker::command_line): New method.
85 (Incremental_checker::inputs): New method.
86 (Incremental_checker::command_line_): New field.
87
88 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
89
90 * incremental.cc: Include <cstdarg> and "target-select.h".
91 (vexplain_no_incremental): New function.
92 (explain_no_incremental): New function.
93 (Incremental_binary::error): New method.
94 (Sized_incremental_binary::do_find_incremental_inputs_section): New
95 method.
96 (make_sized_incremental_binary): New function.
97 (open_incremental_binary): New function.
98 (can_incrementally_link_file): Add checks if output is ELF and has
99 inputs section.
100 * incremental.h: Include "elfcpp_file.h" and "output.h".
101 (Incremental_binary): New class.
102 (Sized_incremental_binary): New class.
103 (open_incremental_binary): Declare.
104 * object.cc (is_elf_object): Use
105 elfcpp::Elf_recognizer::is_elf_file.
106 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
107 * output.h (Output_file::filesize): New method.
108
109 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
110
111 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
112 New function.
113 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
114 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
115 function.
116 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
117 function.
118 (Arm_relocate_functions::movw_abs_nc): New function.
119 (Arm_relocate_functions::movt_abs): New function.
120 (Arm_relocate_functions::thm_movw_abs_nc): New function.
121 (Arm_relocate_functions::thm_movt_abs): New function.
122 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
123 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
124 (Scan::global): Likewise.
125 (Relocate::relocate): Likewise.
126 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
127
128 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
129
130 * arm.cc (Arm_relocate_functions::got_prel) New function.
131 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
132 (Relocate::relocate): Likewise.
133 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
134
135 2009-10-06 Ian Lance Taylor <iant@google.com>
136
137 * options.h (class General_options): Define
138 split_stack_adjust_size parameter.
139 * object.h (class Object): Add uses_split_stack_ and
140 has_no_split_stack_ fields. Add uses_split_stack and
141 has_no_split_stack accessor functions. Declare
142 handle_split_stack_section.
143 (class Reloc_symbol_changes): Define.
144 (class Sized_relobj): Define Function_offsets. Declare
145 split_stack_adjust, split_stack_adjust_reltype, and
146 find_functions.
147 * object.cc (Object::handle_split_stack_section): New function.
148 (Sized_relobj::do_layout): Call handle_split_stack_section.
149 * dynobj.cc (Sized_dynobj::do_layout): Call
150 handle_split_stack_section.
151 * reloc.cc (Sized_relobj::relocate_sections): Call
152 split_stack_adjust for executable sections in split_stack
153 objects. Pass reloc_map to relocate_section.
154 (Sized_relobj::split_stack_adjust): New function.
155 (Sized_relobj::split_stack_adjust_reltype): New function.
156 (Sized_relobj::find_functions): New function.
157 * target-reloc.h: Include "object.h".
158 (relocate_section): Add reloc_symbol_changes parameter. Change
159 all callers.
160 * target.h (class Target): Add calls_non_split method. Declare
161 do_calls_non_split virtual method. Declare match_view and
162 set_view_to_nop.
163 * target.cc: Include "elfcpp.h".
164 (Target::do_calls_non_split): New function.
165 (Target::match_view): New function.
166 (Target::set_view_to_nop): New function.
167 * gold.cc (queue_middle_tasks): Give an error if mixing
168 split-stack and non-split-stack objects with -r.
169 * i386.cc (Target_i386::relocate_section): Add
170 reloc_symbol_changes parameter.
171 (Target_i386::do_calls_non_split): New function.
172 * x86_64.cc (Target_x86_64::relocate_section): Add
173 reloc_symbol_changes parameter.
174 (Target_x86_64::do_calls_non_split): New function.
175 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
176 parameter.
177 * powerpc.cc (Target_powerpc::relocate_section): Add
178 reloc_symbol_changes parameter.
179 * sparc.cc (Target_sparc::relocate_section): Add
180 reloc_symbol_changes parameter.
181 * configure.ac: Call AM_CONDITIONAL for the default target.
182 * configure: Rebuild.
183 * testsuite/Makefile.am (TEST_AS): New variable.
184 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
185 (check_DATA): Add split_i386 and split_x86_64 files.
186 (SPLIT_DEFSYMS): Define.
187 (split_i386_[1234n].o): New targets.
188 (split_i386_[124]): New targets.
189 (split_i386_[1234r].stdout): New targets.
190 (split_x86_64_[1234n].o): New targets.
191 (split_x86_64_[124]): New targets.
192 (split_x86_64_[1234r].stdout): New targets.
193 (MOSTLYCLEANFILES): Add new executables.
194 * testsuite/split_i386.sh: New file.
195 * testsuite/split_x86_64.sh: New file.
196 * testsuite/split_i386_1.s: New file.
197 * testsuite/split_i386_2.s: New file.
198 * testsuite/split_i386_3.s: New file.
199 * testsuite/split_i386_4.s: New file.
200 * testsuite/split_i386_n.s: New file.
201 * testsuite/split_x86_64_1.s: New file.
202 * testsuite/split_x86_64_2.s: New file.
203 * testsuite/split_x86_64_3.s: New file.
204 * testsuite/split_x86_64_4.s: New file.
205 * testsuite/split_x86_64_n.s: New file.
206 * testsuite/testfile.cc (Target_test): Update relocation_section
207 function.
208 * testsuite/Makefile.in: Rebuild.
209
210 2009-10-06 Ian Lance Taylor <iant@google.com>
211
212 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
213 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
214 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
215 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
216 the address on ldo_addrs_.
217 (Target_i386::Relocate::fix_up_ldo): New function.
218
219 2009-10-06 Rafael Espindola <espindola@google.com>
220
221 * plugin.cc (add_input_library): New.
222 (Plugin::load): Add add_input_library to tv.
223 (Plugin_manager::add_input_file): Add the is_lib argument.
224 (add_input_file): Update call to Plugin_manager::add_input_file.
225 (add_input_library): New.
226 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
227
228 2009-09-30 Doug Kwan <dougkwan@google.com>
229
230 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
231 symbol and call Symbol::may_need_copy_reloc to determine if
232 a copy reloc is needed.
233 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
234 nocopyreloc is given in command line.
235 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
236 given in command line.
237 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
238 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
239 of the removed Target_i386::may_need_copy_reloc.
240 * options.h (copyreloc): New option with default value false.
241 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
242 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
243 instead of the removed Target_powerpc::may_need_copy_reloc.
244 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
245 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
246 instead of the removed Target_sparc::may_need_copy_reloc.
247 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
248 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
249 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
250 instead of the removed Target_x86_64::may_need_copy_reloc.
251
252 2009-09-30 Ian Lance Taylor <iant@google.com>
253
254 * object.h (class Object): Remove target_ field, and target,
255 sized_target, and set_target methods.
256 (Object::sized_target): Remove.
257 (class Sized_relobj): Update declarations. Remove sized_target.
258 * object.cc (Sized_relobj::setup): Remove target parameter.
259 Change all callers.
260 (Input_objects::add_object): Don't do anything with the target.
261 (make_elf_sized_object): Add punconfigured parameter. Change all
262 callers. Set or test parameter target.
263 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
264 Change all callers.
265 * parameters.cc (Parameters::set_target): Change parameter type to
266 be non-const.
267 (Parameters::default_target): Remove.
268 (set_parameters_target): Change parameter type to be non-const.
269 (parameters_force_valid_target): New function.
270 (parameters_clear_target): New function.
271 * parameters.h (class Parameters): Update declarations. Remove
272 default_target method. Add sized_target and clear_target
273 methods. Change target_ to be non-const.
274 (set_parameters_target): Update declaration.
275 (parameters_force_valid_target): Declare.
276 (parameters_clear_target): Declare.
277 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
278 as NULL if we aren't searching.
279 (Add_symbols::run): Don't check for compatible target.
280 * fileread.cc (Input_file::open_binary): Call
281 parameters_force_valid_target.
282 * gold.cc (queue_middle_tasks): Likewise.
283 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
284 set_target on object.
285 * dynobj.h (class Sized_dynobj): Update declarations.
286 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
287 make_elf_object returns NULL.
288 (Archive::include_member): Don't check whether object target is
289 compatible.
290 * output.cc (Output_section::add_input_section): Get target from
291 parameters.
292 (Output_section::relax_input_section): Likewise.
293 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
294 parameters.
295 (Sized_relobj::do_scan_relocs): Likewise.
296 (Sized_relobj::relocate_sections): Likewise.
297 * resolve.cc (Symbol_table::resolve): Likewise.
298 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
299 parameter. Change all callers.
300 (Symbol_table::add_from_object): Get target from parameters.
301 (Symbol_table::add_from_relobj): Don't check object target.
302 (Symbol_table::add_from_dynobj): Likewise.
303 (Symbol_table::define_special_symbol): Get target from
304 parameters.
305 * symtab.h (class Symbol_table): Update declaration.
306 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
307 parameter. Change all callers. Clear parameter target.
308 (Binary_test): Test target here.
309 * testsuite/object_unittest.cc (gold_testsuite): Remove
310 target_test_pointer parameter. Change all callers.
311 (Object_test): Test target here.
312
313 2009-09-26 Ian Lance Taylor <iant@google.com>
314
315 * testsuite/initpri1.c: Don't try to use constructor priorities if
316 compiling with gcc before 4.3.
317
318 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
319
320 * testsuite/retain_symbols_file_test.sh (check_present): Change
321 output file name to retain_symbols_file_test.stdout.
322 (check_absent): Likewise.
323
324 2009-09-18 Craig Silverstein <csilvers@google.com>
325
326 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
327 * options.cc: Include <cerrno> and <fstream>.
328 (General_options::finalize): Parse -retain-symbols-file tag.
329 * options.h: New flag.
330 (General_options): New method should_retain_symbol, new
331 variable symbols_to_retain.
332 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
333 should_retain_symbol map.
334 * testsuite/Makefile.am (retain_symbols_file_test): New test.
335 * testsuite/Makefile.in: Regenerate.
336 * testsuite/retain_symbols_file_test.sh: New file.
337
338 2009-09-18 Nick Clifton <nickc@redhat.com>
339
340 * po/es.po: Updated Spanish translation.
341
342 2009-09-17 Doug Kwan <dougkwan@google.com>
343
344 * debug.h (DEBUG_RELAXATION): New constant.
345 (DEBUG_ALL): Add DEBUG_RELAXATION.
346 (debug_string_to_enum): Add relaxation debug option.
347 * layout.cc
348 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
349 Layout::Relaxation_debug_check::read_sections,
350 Layout::Relaxation_debug_check::read_sections): New method definitions.
351 (Layout::Layout): Initialize data members
352 record_output_section_data_from_scrips_,
353 script_output_section_data_list_ and relaxation_debug_check_.
354 (Layout::save_segments, Layout::restore_segments,
355 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
356 Layout::relaxation_loop_body): New method definitions.
357 (Layout::finalize): Support relaxation. Move section layout code to
358 Layout::relaxation_loop_body.
359 (Layout::set_asection_address_from_script): Move code for orphan
360 section placement out.
361 (Layout::place_orphan_sections_in_script): New method definition.
362 * layout.h (Output_segment_headers, Output_file_header):
363 New forward class declarations.
364 (Layout::~Layout): Define.
365 (Layout::new_output_section_data_from_script): New method definition.
366 (Layout::place_orphan_sections_in_script): New method declaration.
367 (Layout::Segment_states): New type declaration.
368 (Layout::save_segments, Layout::restore_segments,
369 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
370 Layout::relaxation_loop_body): New method declarations.
371 (Layout::Output_section_data_list): New type declaration.
372 (Layout::Relaxation_debug_check): New class definition.
373 (Layout::record_output_section_data_from_script_,
374 Layout::script_output_section_data_list_, Layout::segment_states_,
375 Layout::relaxation_debug_check_): New data members.
376 * output.cc: (Output_section_headers::do_size): New method definition.
377 (Output_section_headers::Output_section_headers): Move size
378 computation to Output_section_headers::do_size.
379 (Output_segment_headers::do_size): New method definition.
380 (Output_file_header::Output_file_header): Move size computation to
381 Output_file_header::do_size and call it.
382 (Output_file_header::do_size): New method definition.
383 (Output_data_group::Output_data_group): Adjust call to
384 Output_section_data.
385 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
386 (Output_symtab_xindex::do_write): Add array bound check.
387 (Output_section::Input_section::print_to_mapfile): Handle
388 RELAXED_INPUT_SECTION_CODE.
389 (Output_section::Output_section): Initialize data member checkpoint_.
390 (Output_section::~Output_section): Delete checkpoint object pointed
391 by checkpoint_.
392 (Output_section::add_input_section): Always add an Input_section if
393 relaxing.
394 (Output_section::add_merge_input_section): Add assert.
395 (Output_section::relax_input_section): New method definition.
396 (Output_section::set_final_data_size): Set load address to zero for
397 an unallocated section.
398 (Output_section::do_address_and_file_offset_have_reset_values):
399 New method definition.
400 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
401 Handle relaxed input section.
402 (Output_section::sort_attached_input_sections): Checkpoint input
403 section list lazily.
404 (Output_section::get_input_sections): Change type of input_sections to
405 list of Simple_input_section pointers. Checkpoint input section list
406 lazily. Also handle relaxed input sections.
407 (Output_section::add_input_section_for_script): Take a reference to
408 a Simple_input_section object instead of Relobj pointer and section
409 index as parameter. Handle relaxed input sections.
410 (Output_section::save_states, Output_section::restore_states): New
411 method definitions.
412 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
413 (Output_data::is_data_size_fixed): New method definition.
414 (Output_data::reset_addresss_and_file_offset): Do not reset data size
415 if it is fixed.
416 (Output_data::address_and_file_offset_have_reset_values): New method
417 definition.
418 (Output_data::do_address_and_file_offset_have_reset_values): New method
419 definition.
420 (Output_data::set_data_size): Check that data size is not fixed.
421 (Output_data::fix_data_size): New method definition.
422 (Output_data::is_data_size_fixed_): New data member.
423 (Output_section_headers::set_final_data_size): New method definition.
424 (Output_section_headers::do_size): New method declaration.
425 (Output_segment_headers::set_final_data_size): New method definition.
426 (Output_segment_headers::do_size): New method declaration.
427 (Output_file_header::set_final_data_size)::New method definition.
428 (Output_file_header::do_size)::New method declaration.
429 (Output_section_data::Output_section_data): Add new parameter
430 is_data_size_fixed and use it to fix data size.
431 (Output_data_const::Output_data_const): Adjust call to base class
432 constructor and fix data size.
433 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
434 base class constructor and fix data size.
435 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
436 base class constructor and fix data size.
437 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
438 class constructor and fix data size.
439 (Output_data_group::set_final_data_size): New method definition.
440 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
441 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
442 class constructor and fix data size.
443 (Output_relaxed_input_section): New class definition.
444 (Output_section::Simple_input_section): New class definition.
445 (Output_section::get_input_sections): Adjust parameter list.
446 (Output_section::add_input_section_for_script): Same.
447 (Output_section::save_states, Output_section::restore_states,
448 Output_section::do_address_and_file_offset_have_reset_values,
449 (Output_section::Input_section::Input_section): Handle
450 RELAXED_INPUT_SECTION_CODE. Add new overload for
451 Output_relaxed_input_section.
452 (Output_section::Input_section::is_input_section,
453 Output_section::Input_section::set_output_section): Handle relaxed
454 input section.
455 (Output_section::Input_section::is_relaxed_input_section,
456 Output_section::Input_section::output_section_data,
457 Output_section::Input_section::relaxed_input_section): New method
458 definitions.
459 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
460 value.
461 (Output_section::Input_section::u1_): Update comments.
462 (Output_section::Input_section::u2_): Add new union member poris.
463 (Output_section::Checkpoint_output_section): New classs definition.
464 (Output_section::relax_input_section): New method declaration.
465 (Output_section::checkpoint_): New data member.
466 (Output_segment): Update comments.
467 (Output_segment::Output_segment): Un-privatize copy constructor.
468 (Output_segment::operator=): Un-privatize.
469 * script-sections.cc (Output_section_element::Input_section_list):
470 Change element type to Output_section::Simple_input_section.
471 (Output_section_element_dot_assignment::set_section_addresses):
472 Register output section data for relaxation clean up.
473 (Output_data_exression::Output_data_expression): Adjust call to base
474 constructor to fix data size.
475 (Output_section_element_data::set_section_addresses): Register
476 Output_data_expression object for relaxation clean up.
477 (struct Input_section_info): Replace Relobj pointer and section index
478 pair with Output_section::Simple_input_section and Convert struct to a
479 class.
480 (Input_section_sorter::operator()): Adjust access to
481 Input_section_info data member to use accessors.
482 (Output_section_element_input::set_section_addresses): Use layout
483 parameter. Adjust code to use Output_section::Simple_input_section
484 and Input_secction_info classes. Register filler for relaxation
485 clean up.
486 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
487 and section index pair with Output_section::Simple_input_section
488 class. Adjust code accordingly.
489 (Phdrs_element::release_segment): New method definition.
490 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
491 segment list.
492 (Script_sections::release_segments): New method definition.
493 * gold/script-sections.h (Script_sections::release_segments): New
494 method declaration.
495 * gold/target.h (Target::may_relax, Target::relax,
496 Target::do_may_relax, Target::do_relax): New method definitions.
497
498 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
499
500 * arm.cc (has_signed_unsigned_overflow): New function.
501 (Arm_relocate_functions::abs8): New function.
502 (Target_arm::Scan::local): Handle R_ARM_ABS8.
503 (Target_arm::Scan::global): Likewise.
504 (Target_arm::relocate::relocate): Likewise.
505 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
506 Likewise.
507
508 2009-09-16 Cary Coutant <ccoutant@google.com>
509
510 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
511 * testsuite/Makefile.in: Regenerate.
512
513 2009-09-11 Nick Clifton <nickc@redhat.com>
514
515 * po/gold.pot: Updated by the Translation project.
516
517 2009-09-08 Cary Coutant <ccoutant@google.com>
518
519 * output.cc (Output_file::open): Add execute permission to empty file.
520 * testsuite/Makefile.am (permission_test): New test.
521 * testsuite/Makefile.in: Regenerate.
522
523 2009-09-02 Ian Lance Taylor <iant@google.com>
524
525 * output.cc (Output_file::resize): Call map_no_anonymous rather
526 than map.
527
528 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
529
530 * gold.cc: Include "incremental.h".
531 (queue_initial_tasks): Call Incremental_checker methods.
532 * incremental.cc: Include "output.h".
533 (Incremental_checker::can_incrementally_link_output_file): New
534 method.
535 * incremental.h (Incremental_checker): New class.
536
537 * output.cc (Output_file::open_for_modification): New method.
538 (Output_file::map_anonymous): Changed return type to bool. Record
539 map in base_ field.
540 (Output_file::map_no_anonymous): New method, broken out of map.
541 (Output_file::map): Use map_no_anonymous and map_anonymous.
542 * output.h (class Output_file): Update declarations.
543
544 2009-08-24 Cary Coutant <ccoutant@google.com>
545
546 * options.h (Command_line::Pre_options): New class.
547 (Command_line::pre_options): New member.
548 * options.cc (gold::options::ready_to_register): New variable.
549 (One_option::register_option): Do nothing if not registering options.
550 Assert if same short option registered twice.
551 (General_options::General_options): Turn off option registration when
552 done constructing.
553 (Command_line::Pre_options::Pre_options): New constructor.
554
555 2009-08-24 Cary Coutant <ccoutant@google.com>
556
557 * options.h (General_options::no_keep_memory): Remove incorrect
558 short option.
559
560 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
561
562 * Makefile.am (am__skiplex, am__skipyacc): New.
563 * Makefile.in: Regenerate.
564
565 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
566
567 * Makefile.am (AM_CPPFLAGS): Renamed from ...
568 (INCLUDES): ... this.
569 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
570 (AM_CPPFLAGS): Renamed from ...
571 (INCLUDE): ... this.
572 * Makefile.in, testsuite/Makefile.in: Regenerate.
573
574 * Makefile.in: Regenerate.
575 * aclocal.m4: Likewise.
576 * config.in: Likewise.
577 * configure: Likewise.
578 * testsuite/Makefile.in: Likewise.
579
580 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
581 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
582 * Makefile.in: Regenerate.
583 * testsuite/Makefile.in: Regenerate.
584
585 2009-08-19 Cary Coutant <ccoutant@google.com>
586
587 * resolve.cc (Symbol_table::resolve): Don't complain about defined
588 symbols in shared libraries overridden by hidden or internal symbols
589 in the main program.
590
591 2009-08-19 Chris Demetriou <cgd@google.com>
592
593 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
594 checking source file names in error messages.
595
596 2009-08-18 Doug Kwan <dougkwan@google.com>
597
598 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
599 an elcpp::Ehdr as parameter. Adjust call to set_target.
600 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
601 an elfcpp::Ehdr as parameter.
602 * object.cc (Object::set_target): Remove the version that looks up
603 a target and sets it.
604 (Sized_relobj::setup): Take a Target object instead of
605 an elfcpp::Ehdr as parameter. Adjust call to set_target.
606 (make_elf_sized_object): Find target and ask target to
607 make an ELF object.
608 * object.h: (Object::set_target): Remove the version that looks up
609 a target and sets it.
610 (Sized_relobj::setup): Take a Target object instead of
611 an elfcpp:Ehdr as parameter.
612 * target.cc: Include dynobj.h.
613 (Target::do_make_elf_object_implementation): New.
614 (Target::do_make_elf_object): New.
615 * target.h (Target::make_elf_object): New template declaration.
616 (Target::do_make_elf_object): New method declarations.
617 (Target::do_make_elf_object_implementation): New template declaration.
618
619 2009-08-14 Ian Lance Taylor <iant@google.com>
620
621 * gold.h (FUNCTION_NAME): Define.
622 (gold_unreachable): Use FUNCTION_NAME.
623
624 2009-08-12 Sriraman Tallam <tmsriram@google.com>
625
626 * icf.cc (Icf::find_identical_sections): Issue a warning when a
627 symbol in the --keep-unique list is not found.
628
629 2009-08-12 Sriraman Tallam <tmsriram@google.com>
630
631 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
632 been maked as --keep-unique.
633 (Icf::unfold_section): New function.
634 * icf.h (Icf::unfold_section): New function.
635 * options.h (General_options::keep_unique): New option.
636 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
637 * testsuite/Makefile.in: Regenerate.
638 * testsuite/icf_keep_unique_test.sh: New file.
639 * testsuite/icf_keep_unique_test.cc: New file.
640
641 2009-08-12 Cary Coutant <ccoutant@google.com>
642
643 PR 10471
644 * resolve.cc (Symbol_table::resolve): Check for references from
645 dynamic objects to hidden and internal symbols.
646 * testsuite/Makefile.am (hidden_test.sh): New test.
647 * testsuite/Makefile.in: Regenerate.
648 * testsuite/hidden_test.sh: New script.
649 * testsuite/hidden_test_1.c: New test source.
650 * testsuite/hidden_test_main.c: New test source.
651
652 2009-08-11 Doug Kwan <dougkwan@google.com>
653
654 * arm.cc: Update comments.
655 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
656 segment to locate the .ARM.exidx section if present.
657
658 2009-08-09 Doug Kwan <dougkwan@google.com>
659
660 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
661 patch.
662
663 2009-08-07 Sriraman Tallam <tmsriram@google.com>
664 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
665 compiler warnings.
666
667 2009-08-06 Sriraman Tallam <tmsriram@google.com>
668
669 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
670 valid tls_segment only for non-debug-section relocations.
671 * testsuite/Makefile.am: Add gc_tls_test.
672 * testsuite/Makefile.in: Regenerate.
673 * testsuite/gc_tls_test.cc: New file.
674 * testsuite/gc_tls_test.sh: New file.
675
676 2009-08-05 Sriraman Tallam <tmsriram@google.com>
677
678 * icf.cc: New file.
679 * icf.h: New file.
680 * Makefile.am (CCFILES): Add icf.cc.
681 (HFILES): Add icf.h
682 * Makefile.in: Regenerate.
683 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
684 * gc.h (gc_process_relocs): Populate lists used by icf to contain
685 section, symbol and addend information for the relocs.
686 * gold.cc (queue_middle_tasks): Call identical code folding.
687 * gold.h: Add defines for multimap.
688 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
689 to the call of finalize_local_symbols.
690 * main.cc (main): Create object of class Icf.
691 * object.cc (Sized_relobj::do_layout): Allow this function to be
692 called twice during icf.
693 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
694 to sections marked as identical by icf.
695 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
696 when available.
697 (Sized_relobj::do_section_entsize): New function.
698 * object.h (Object::section_entsize): New function.
699 (Object::do_section_entsize): New pure virtual function.
700 (Relobj::finalize_local_symbols): Add new parameter.
701 (Relobj::do_section_entsize): New function.
702 * options.h (General_options::icf): New option.
703 (General_options::icf_iterations): New option.
704 (General_options::print_icf_sections): New option.
705 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
706 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
707 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
708 icf.
709 * symtab.cc (Symbol_table::is_section_folded): New function.
710 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
711 to sections marked as identical by icf.
712 * symtab.h (Symbol_table::set_icf): New function.
713 (Symbol_table::icf): New function.
714 (Symbol_table::is_section_folded): New function.
715 (Symbol_table::icf_): New data member.
716 * target-reloc.h (relocate_section): Ignore sections folded by icf.
717 * testsuite/Makefile.am: Add commands to build icf_test.
718 * testsuite/Makefile.in: Regenerate.
719 * testsuite/icf_test.sh: New file.
720 * testsuite/icf_test.cc: New file.
721
722 2009-07-24 Chris Demetriou <cgd@google.com>
723
724 * layout.cc (is_compressible_debug_section): Fix incorrect
725 comment about compressed section names.
726
727 2009-07-20 Ian Lance Taylor <ian@airs.com>
728
729 PR 10419
730 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
731
732 2009-07-16 Ian Lance Taylor <iant@google.com>
733
734 PR 10400
735 * layout.h: #include <map>.
736 (class Kept_section): Change from struct to class. Add accessors
737 and setters. Add section size to Comdat_group mapping. Change
738 Comdat_group to std::map. Add is_comdat_ field. Add
739 linkonce_size field in union.
740 (class Layout): Update declaration of find_or_add_kept_section.
741 Don't declare find_kept_object.
742 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
743 parameter. Add object, shndx, is_comdat, and is_group_name
744 parameters. Change all callers. Adjust for new Kept_section.
745 (Layout::find_kept_object): Remove.
746 * object.cc (Sized_relobj::include_section_group): Update use of
747 Kept_section. Rename secnum to shndx. Only record
748 Kept_comdat_section if sections are the same size.
749 (Sized_relobj::include_linkonce_section): Update use of
750 Kept_section. Only record Kept_comdat_section if sections are the
751 same size. Set size of linkonce section.
752 (Sized_relobj::map_to_kept_section): Update call to
753 get_kept_comdat_section.
754 * object.h (class Sized_relobj): Rename fields in
755 Kept_comdat_section to drop trailing underscores; change object
756 field to Relobj*. Change Kept_comdat_section_table to store
757 struct rather than pointer.
758 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
759 Add kept_object and kept_shndx parameters. Change all callers.
760 (Sized_relobj::get_kept_comdat_section): Change return type to
761 bool. Add kept_object and kept_shndx parameters. Change all
762 callers.
763 * plugin.cc (Pluginobj::include_comdat_group): Update call to
764 Layout::find_or_add_kept_section.
765
766 2009-07-09 Ian Lance Taylor <iant@google.com>
767
768 * merge.cc (Object_merge_map::initialize_input_to_output_map):
769 Reserve space in the hash table.
770
771 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
772
773 * fileread.cc (File_read::get_mtime): New method.
774 * fileread.h (Timespec): New structure.
775 (File_read::get_mtime): New method.
776 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
777 Renamed from timestamp_nsec.
778 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
779 Elf_Xword.
780 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
781 timestamp_nsec.
782 (Incremental_inputs::report_archive): Save mtime; style fix.
783 (Incremental_inputs::report_obejct): Save mtime; style fix.
784 (Incremental_inputs::report_script): Save mtime; style fix.
785 (Incremental_inputs::finalize_inputs): Style fix.
786 (Incremental_inputs::finalize): Style fix.
787 (Incremental_inputs::create_input_section_data): Store inputs
788 mtime.
789 * incremental.h (Incremental_inputs::report_script): Add mtime
790 argument.
791 (Incremental_inputs::Input_info::Input_info): Intialize only one
792 union member.
793 (Incremental_inputs::Input_info::archive): Move to nameless
794 union.
795 (Incremental_inputs::Input_info::obejct): Move to nameless union.
796 (Incremental_inputs::Input_info::script): Move to nameless union.
797 (Incremental_inputs::mtime): New field.
798 * script.cc (read_input_script): Pass file mtime to
799 Incremental_input.
800 * script.h (Script_info::inputs): Style fix.
801
802 2009-07-01 Ian Lance Taylor <ian@airs.com>
803
804 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
805 instead of 32.
806
807 2009-06-24 Ian Lance Taylor <iant@google.com>
808
809 PR 10156
810 * layout.cc (Layout::choose_output_section): If we find an
811 existing section, update the flags.
812 (Layout::create_notes): New function, broken out of
813 Layout::finalize.
814 (Layout::finalize): Don't create note sections.
815 (Layout::create_note): Don't crash if linker script discards
816 section.
817 (Layout::create_gold_note): Likewise.
818 (Layout::create_build_id): Likewise. Don't set
819 after_input_sections on the section.
820 (Layout::create_executable_stack_info): Remove target parameter.
821 Change caller.
822 * layout.h (class Layout): Declare create_notes. Update
823 declaration of create_executable_stack_info.
824 * gold.cc (queue_middle_tasks): Call create_notes.
825 * output.cc (Output_section::update_flags_for_input_section): Move
826 here from output.h. If SHF_ALLOC flag is newly set, mark address
827 invalid.
828 * output.h (Output_data::mark_address_invalid): New function.
829 (class Output_section): Only declare, not define,
830 update_flags_for_input_section. Remove set_flags.
831
832 2009-06-24 Ian Lance Taylor <iant@google.com>
833
834 * script-sections.cc (Output_section_definition::
835 set_section_addresses): Rename shadowing local load_address to
836 laddr.
837
838 2009-06-24 Ian Lance Taylor <iant@google.com>
839
840 PR 10244
841 * reloc.cc (relocate_sections): Skip empty relocation sections.
842
843 2009-06-23 Ian Lance Taylor <iant@google.com>
844
845 PR 10156
846 * layout.cc (Layout::create_note): Use choose_output_section
847 rather than make_output_section.
848
849 2009-06-23 Ian Lance Taylor <iant@google.com>
850
851 PR 10237
852 * options.cc (General_options::parse_V): Set printed_version_.
853 (General_options::General_options): Initialize printed_version_.
854 * options.h (class General_options): Add printed_version_ field.
855 * gold.cc (queue_initial_tasks): If there are no input files,
856 don't give a fatal error if we printed the version information.
857 (queue_middle_tasks): If using -r with a shared object, give a
858 fatal error rather than an ordinary error.
859
860 2009-06-23 Ian Lance Taylor <iant@google.com>
861
862 PR 10219
863 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
864 (Layout::make_output_section): Set have_stabstr_section_ if we see
865 a .stab*str section.
866 (Layout::finalize): Call link_stabs_sections.
867 (Layout::link_stabs_sections): New file.
868 * layout.h (class Layout): Add have_stabstr_section_ field.
869 Declare link_stabs_sections.
870
871 2009-06-23 Doug Kwan <dougkwan@google.com>
872
873 * Makefile.am (libgold_a_LIBADD): New.
874 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
875 * Makefile.in: Regenerate.
876 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
877 * configure: Regenerate.
878 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
879 * fileread.cc: Include sys/state.h
880 * gold.h: Declare memmem and strndup if found missing.
881 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
882
883 2009-06-23 Ian Lance Taylor <iant@google.com>
884
885 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
886 * configure: Rebuild.
887
888 2009-06-23 Ian Lance Taylor <iant@google.com>
889
890 PR 10147
891 * object.cc (Object::section_contents): Don't try to get a view if
892 the section has length zero.
893 (Object::handle_gnu_warning_section): If the section is empty, use
894 the name of the section as the warning.
895
896 2009-06-23 Ian Lance Taylor <iant@google.com>
897
898 PR 10133
899 * stringpool.h (class Stringpool_template): Add optimize_ field.
900 (Stringpool_template::set_optimize): New function.
901 * stringpool.cc (Stringpool_template::Stringpool_template):
902 Initialize optimize_ field.
903 (Stringpool_template::set_string_offsets): Test local optimize
904 fild rather than parameter.
905 * layout.cc (Layout::Layout): Call set_optimize on the section
906 name stringpool.
907
908 2009-06-22 Ian Lance Taylor <iant@google.com>
909
910 PR 10030
911 * yyscript.y: Parse TARGET.
912 * script.cc (script_set_target): New function.
913 * script-c.h (script_set_target): Declare.
914 * options.cc (General_options::string_to_object_format): Rename
915 from string_to_object_format in anonymous namespace. Change
916 callers.
917 * options.h (class General_options): Declare
918 string_to_object_format.
919
920 2009-06-22 Ian Lance Taylor <iant@google.com>
921
922 * script-sections.cc (Script_sections::create_segments): Don't put
923 program headers in a PT_LOAD segment if -n or -N.
924
925 2009-06-22 Ian Lance Taylor <iant@google.com>
926
927 PR 10141
928 * options.h (class General_options): Add -z lazy and -z now. Sort
929 -z options into alphabetical order.
930 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
931
932 2009-06-21 Ian Lance Taylor <iant@google.com>
933
934 * layout.cc (Layout::make_output_section): Call
935 Target::new_output_section.
936 (Layout::attach_allocated_section_to_segment): Put large section
937 sections in a separate load segment with the large segment flag
938 set.
939 (Layout::segment_precedes): Sort large data segments after other
940 load segments.
941 (align_file_offset): New static function.
942 (Layout::set_segment_offsets): Use align_file_offset.
943 * output.h (class Output_section): Add is_small_section_ and
944 is_large_section_ fields.
945 (Output_section::is_small_section): New function.
946 (Output_section::set_is_small_section): New function.
947 (Output_section::is_large_section): New function.
948 (Output_section::set_is_large_section): New function.
949 (Output_section::is_large_data_section): New function.
950 (class Output_segment): Add is_large_data_segment_ field.
951 (Output_segment::is_large_data_segment): New function.
952 (Output_segment::set_is_large_data_segment): New function.
953 * output.cc (Output_section::Output_section): Initialize new
954 fields.
955 (Output_segment::Output_segment): Likewise.
956 (Output_segment::add_output_section): Add assertion that large
957 data sections always go in large data segments. Force small data
958 sections to the end of the list of data sections. Force small BSS
959 sections to the start of the list of BSS sections. For large BSS
960 sections to the end of the list of BSS sections.
961 * symtab.h (class Symbol): Declare is_common_shndx.
962 (Symbol::is_defined): Check Symbol::is_common_shndx.
963 (Symbol::is_common): Likewise.
964 (class Symbol_table): Define enum Commons_section_type. Update
965 declarations. Add small_commons_ and large_commons_ fields.
966 * symtab.cc (Symbol::is_common_shndx): New function.
967 (Symbol_table::Symbol_table): Initialize new fields.
968 (Symbol_table::add_from_object): Put small and large common
969 symbols in the right list.
970 (Symbol_table::sized_finalized_symbol): Check
971 Symbol::is_common_shndx.
972 (Symbol_table::sized_write_globals): Likewise.
973 * common.cc (Symbol_table::do_allocate_commons): Allocate new
974 common symbol lists. Don't call do_allocate_commons_list if the
975 list is empty.
976 (Symbol_table::do_allocate_commons_list): Remove is_tls
977 parameter. Add comons_section_type parameter. Change all
978 callers. Handle small and large common symbols.
979 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
980 Symbol::is_common_shndx.
981 * resolve.cc (symbol_to_bits): Likewise.
982 * target.h (Target::small_common_shndx): New function.
983 (Target::small_common_section_flags): New function.
984 (Target::large_common_shndx): New function.
985 (Target::large_common_section_flags): New function.
986 (Target::new_output_section): New function.
987 (Target::Target_info): Add small_common_shndx, large_common_shndx,
988 small_common_section_flags, and large_common_section_flags
989 fields.
990 (Target::do_new_output_section): New virtual function.
991 * arm.cc (Target_arm::arm_info): Initialize new fields.
992 * i386.cc (Target_i386::i386_info): Likewise.
993 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
994 Likewise.
995 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
996 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
997 (Target_x86_64::do_new_output_section): New function.
998 * configure.ac: Define conditional MCMODEL_MEDIUM.
999 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1000 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1001 (large_LDFLAGS): Define.
1002 * testsuite/large.c: New file.
1003 * testsuite/testfile.cc (Target_test::test_target_info):
1004 Initialize new fields.
1005 * configure, testsuite/Makefile.in: Rebuild.
1006
1007 2009-06-05 Doug Kwan <dougkwan@google.com>
1008
1009 * Makefile.am (CCFILES): Add target.cc.
1010 * Makefile.in: Regenerate.
1011 * i386.cc (class Target_i386): Define new virtual method to
1012 override do_is_local_label_name in parent.
1013 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1014 local symbols if --discard-locals or -X is given.
1015 * options.h (class General_options): Declare new options
1016 '--discard-locals' and '-X' for discarding locals.
1017 * target.h (class Target): Define new methods is_local_label_name.
1018 Declare new virtual method do_is_local_label_name.
1019 * target.cc: New file.
1020 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1021 (check_SCRIPTS): Add discard_locals_test.sh.
1022 (check_DATA): Add discard_local_tests.syms.
1023 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1024 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1025 * testsuite/Makefile.in: Regenerate.
1026 * testsuite/discard_locals_test.c: New file.
1027 * testsuite/discard_locals_test.sh: Same.
1028
1029 2009-06-05 Doug Kwan <dougkwan@google.com>
1030
1031 * object.cc (Sized_relobj::Sized_relobj): Initialize
1032 discarded_eh_frame_shndx_ to -1U.
1033 (Sized_relobj::do_layout): Record index of a discard .eh_frame
1034 section.
1035 (Sized_relobj::do_count_local_symbols): Skip local symbols in
1036 a discarded .eh_frame section.
1037 (Sized_relobj::do_finalize_local_symbols): Ditto.
1038 * object.h (class Sized_relobj): Declare new member
1039 discarded_eh_frame_shndx_.
1040 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
1041 (local_labels_test.o, local_labels_test): New rules.
1042 * testsuite/Makefile.in: Regenerate.
1043
1044 2009-06-04 Doug Kwan <dougkwan@google.com>
1045
1046 * layout.cc (Layout::section_name_mapping): Add mapping for
1047 special ARM sections.
1048
1049 2009-06-03 Doug Kwan <dougkwan@google.com>
1050
1051 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
1052 (utils::has_overflow): Same.
1053
1054 2009-06-03 Ian Lance Taylor <iant@google.com>
1055
1056 * layout.cc (Layout::section_name_mapping): New array, replacing
1057 Layout::linkonce_mapping.
1058 (Layout::section_name_mapping_count): New variable, replacing
1059 Layout::linkonce_mapping_count.
1060 (Layout::linkonce_output_name): Remove.
1061 (Layout::output_section_name): Rewrite.
1062 * layout.h (class Layout): Rename Linkonce_mapping to
1063 Section_name_mapping, linkonce_mapping to section_name_mapping,
1064 linkonce_mapping_count to section_name_mapping_count. Don't
1065 declare linkonce_output_name.
1066
1067 2009-06-03 Doug Kwan <dougkwan@google.com>
1068
1069 * gold/arm.cc (namespace utils): New.
1070 (Target_arm::reloc_is_non_pic): Define new method.
1071 (class Arm_relocate_functions): New.
1072 (Target_arm::Relocate::relocate): Handle relocation types used by
1073 Android.
1074
1075 2009-06-03 Ian Lance Taylor <iant@google.com>
1076
1077 * arm.cc (Target_arm::scan::global): Use || instead of |.
1078
1079 2009-06-02 Doug Kwan <dougkwan@google.com>
1080
1081 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
1082 issued_non_pic_error_.
1083 (class Target_arm::Scan): Declare new method check_non_pic.
1084 Define new method symbol_needs_plt_entry.
1085 Declare new data member issued_non_pic_error_.
1086 (class Target_arm::Relocate): Declare new method
1087 should_apply_static_reloc.
1088 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
1089 (Target_arm::Scan::check_non_pic): Define new method.
1090 (Target_arm::Scan::local): Handle a small subset of reloc types used
1091 by Android.
1092 (Target_arm::Scan::local): Same.
1093 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
1094
1095 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
1096
1097 * incremental.cc (Incremental_inputs::report_command_line): Filter
1098 out --incremental-* options.
1099
1100 2009-05-29 Doug Kwan <dougkwan@google.com>
1101
1102 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
1103 template class.
1104 (class Target_arm): Update comment.
1105 (Target_arm::Target_arm): Initialize new data members GOT_,
1106 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
1107 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
1108 and Target_arm::rel_dyn_section.
1109 Declare new_enum Target_arm::Got_type.
1110 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
1111 and DYNBSS_.
1112 Update commments for member do_dynsym_value.
1113 (Target_arm::got_size, Target_arm::plt_section,
1114 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
1115 new methods inside class defintion.
1116 (Target_arm::got_section): Define new method.
1117 (Target_arm::rel_dyn_section): Same.
1118 (Output_data_plt_arm): New template class.
1119 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
1120 (Output_data_plt_arm:do_adjust_output_section): Define new method.
1121 (Output_data_plt_arm::add_entry): Same.
1122 (Output_data_plt_arm::first_plt_entry): Define new
1123 static data member for PLT instruction template.
1124 (Output_data_plt_arm::plt_entry): Same.
1125 (Output_data_plt_arm::do_write): Define new method.
1126 (Target_arm::make_plt_entry): Same.
1127 (Target_arm::do_finalize_sections): Same.
1128 (Target_arm::do_dynsym_value): Same.
1129
1130 2009-05-28 Doug Kwan <dougkwan@google.com>
1131
1132 * Makefile.am (TARGETSOURCES): Add arm.cc.
1133 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
1134 * Makefile.in: Regenerate.
1135 * arm.cc: New file.
1136 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
1137
1138 2009-05-26 Doug Kwan <dougkwan@google.com>
1139
1140 * options.cc (General_options::parse_exclude_libs). Fix a comment.
1141 (General_options::check_excluded_libs): Strip off directories in
1142 archive name before matching like GNU ld does.
1143 * testsuite/Makefile.am (MOSTLYCLEANFILES,
1144 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
1145 (exclude_libs_test_LDFLAGS): Add linker option
1146 -Wl,--exclude-libs,libexclude_libs_test_3
1147 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
1148 an explicit archive without using -l.
1149 (alt/libexclude_libs_test_3.a): New make rule.
1150 * testsuite/Makefile.in: Regenerate.
1151 * testsuite/exclude_libs_test.c : Declare lib3_default().
1152 (main): Call it.
1153 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
1154 * exclude_libs_test_3.c: New file.
1155
1156 2009-05-26 Nick Clifton <nickc@redhat.com>
1157
1158 * po/id.po: New Indonesian translation.
1159 * po/gold.pot: Updated template file.
1160
1161 2009-05-22 Sriraman Tallam <tmsriram@google.com>
1162
1163 * testsuite/Makefile.am: Add -ffunction-sections to compile
1164 gc_comdat_test files. Add -Wl,--gc-sections to build
1165 gc_comdat_test.
1166 * testsuite/Makefile.in: Regenerate.
1167 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
1168
1169 2009-05-21 Sriraman Tallam <tmsriram@google.com>
1170
1171 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
1172 kept comdat section was garbage collected.
1173 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
1174 * testsuite/Makefile.in: Regenerate.
1175 * testsuite/gc_comdat_test.sh: New file.
1176 * testsuite/gc_comdat_test_1.cc: New file.
1177 * testsuite/gc_comdat_test_2.cc: New file.
1178
1179 2009-05-19 Doug Kwan <dougkwan@google.com>
1180
1181 * archive.cc (Archive::Archive): Move constructor from archive.h
1182 to here. Initialize no_export_.
1183 (Archive::get_elf_object_for_member): Set no_export flag of object.
1184 * archive.h (Archive::Archive): Move constructor body to
1185 archive.cc.
1186 (Archive::no_export): New method.
1187 (Archive::no_export_): New field.
1188 * object.h (Object::Object): Initialize no_export_ to false.
1189 (Object::no_export, Object::set_no_export): New methods.
1190 (Object::no_export_): New field.
1191 * options.cc (General_options::parse_exclude_libs): New method.
1192 (General_options::check_excluded_libs) Same.
1193 * options.h (exclude_libs): New option.
1194 (General_options::check_excluded_libs): New method declaration.
1195 (General_options::excluded_libs_): New field.
1196 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
1197 default or protected visibility if an object has no-export flag set.
1198 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
1199 (check_SCRIPTS): Add exclude_libs_test.sh.
1200 (check_DATA): Add exclude_libs_test.syms.
1201 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
1202 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
1203 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
1204 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
1205 (exclude_libs_test.syms, libexclude_libs_test_1.a,
1206 libexclude_libs_test_2.a): New rules.
1207 * testsuite/Makefile.in: Regenerate.
1208 * testsuite/exclude_libs_test.c: New file.
1209 * testsuite/exclude_libs_test.sh: Ditto.
1210 * testsuite/exclude_libs_test_1.c: Ditto.
1211 * testsuite/exclude_libs_test_2.c: Ditto.
1212
1213 2009-05-15 Ian Lance Taylor <iant@google.com>
1214
1215 * configure.ac: Check for declarations for cases where libiberty.h
1216 checks HAVE_DECL_xxx.
1217 * configure, config.in: Rebuild.
1218
1219 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
1220
1221 * gold.h (Incremental_argument_list): Remove (invalid) forward
1222 declaration.
1223 * incremental.cc (Incremental_inputs::report_achive): New method.
1224 (Incremental_inputs::report_object): New method.
1225 (Incremental_inputs::report_script): New method.
1226 (Incremental_inputs::finalize_inputs): New method.
1227 (Incremental_inputs::finalize): Call finalize_inputs().
1228 (Incremental_inputs::sized_create_incremental_inputs_section_data):
1229 Create inputs entries.
1230 * incremental.h (Incremental_input_type): New enum.
1231 (Incremental_inputs::Incremental_input): Initialize new fields.
1232 (Incremental_inputs::report_inputs): New method.
1233 (Incremental_inputs::report_achive): New method.
1234 (Incremental_inputs::report_object): New method.
1235 (Incremental_inputs::report_script): New method.
1236 (Incremental_inputs::finalize_inputs): New method.
1237 (Incremental_inputs::Input_info): New struct.
1238 (Incremental_inputs::Input_info_map): New typedef.
1239 (Incremental_inputs::lock_): New field.
1240 (Incremental_inputs::Inputs_): New field.
1241 (Incremental_inputs::Inputs_map): New field.
1242 * main.cc (main): Call Incremental_input::report_inputs.
1243 * options.h (Input_argument_list): Typedef moved from
1244 Input_arguments.
1245 (Input_file_group::Files): Remove, use ::Input_argument_list.
1246 (Input_file_group::Input_argument_list): Remove, use
1247 ::Input_argument_list.
1248 * plugin.cc (Plugin_manager::add_input_file): Add error in
1249 incremental build.
1250 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
1251 functions.
1252 * script.cc (read_input_script): Call
1253 Incremental_input::report_script.
1254 * script.h (Script_info): New class.
1255
1256 2009-04-27 Ian Lance Taylor <iant@google.com>
1257
1258 * x86_64.cc (do_adjust_output_section): Set entsize to
1259 plt_entry_size.
1260
1261 2009-04-23 Elliott Hughes <enh@google.com>
1262
1263 * output.cc (Output_file::close): After short writes, continue
1264 writing from the correct offset in the buffer being written.
1265
1266 2009-04-23 Chris Demetriou <cgd@google.com>
1267
1268 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
1269 * configure: Regenerate.
1270 * config.in: Regenerate.
1271 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
1272 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
1273
1274 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
1275
1276 * incremental.cc (Incremental_inputs_header_data): Renamed from
1277 Incremental_input_header_data.
1278 (Incremental_inputs_header_data::data_size): New field.
1279 (Incremental_inputs_header_data::put_input_file_count): Renamed
1280 from input_file_count.
1281 (Incremental_inputs_header_data::put_command_line_offset): Renamed
1282 from command_line_offset.
1283 (Incremental_inputs_header_data::put_reserved): Renamed from
1284 put_reserved.
1285 (Incremental_inputs_entry_data): Renamed from
1286 Incremental_input_entry_data.
1287 (Incremental_inputs_entry_data::data_size): New field.
1288 (Incremental_inputs::report_command_line): New method.
1289 (Incremental_inputs::finalize): New method.
1290 (Incremental_inputs::create_incremental_inputs_data): New method.
1291 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
1292 * incremental.h: New file.
1293 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
1294 (Layout::finalize): Create incremental inputs section in
1295 incremental builds.
1296 (Layout::create_incremental_info_sections): New method.
1297 * layout.h (Layout::incremental_inputs): New method.
1298 (Layout::create_incremental_info_sections): New method.
1299 (Layout::incremental_inputs_): New field.
1300 * main.cc (main): Notify Incremental_input of the command line.
1301
1302 2009-04-01 Ian Lance Taylor <iant@google.com>
1303 Mikolaj Zalewski <mikolajz@google.com>
1304
1305 * gold.h (reserve_unordered_map): Define, three versions, one for
1306 each version of Unordered_map.
1307 * layout.cc (Layout::Layout): Remove options parameter. Add
1308 number_of_input_files parameter. Don't initialize options_.
1309 Initialize number_of_input_files_ and resized_signatures_. Move
1310 sections_are_attached_.
1311 (Layout::layout_group): Reserve space for group_signatures_.
1312 (Layout::find_or_add_kept_section): Change name parameter to be a
1313 reference. Resize signatures_ map when it gets large enough.
1314 (Layout::layout_eh_frame): Use parameters->options() instead of
1315 this->options_.
1316 (Layout::make_output_section): Likewise.
1317 (Layout::attach_allocated_section_to_segment): Likewise.
1318 (Layout::finalize, Layout::create_executable_stack): Likewise.
1319 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
1320 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
1321 * layout.h (class Layout): Update declarations. Remove options_
1322 field. Add number_of_input_files_ and resized_signatures_
1323 fields. Move sections_are_attached_ field.
1324 * main.cc (main): Pass number of input files to Layout
1325 constructor. Don't pass options.
1326
1327 2009-03-30 Ian Lance Taylor <iant@google.com>
1328
1329 * ffsll.c (ffsll): Correct implementation.
1330
1331 2009-03-27 Ian Lance Taylor <iant@google.com>
1332
1333 * ffsll.c: New file.
1334 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
1335 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
1336 * ftruncate.c (ftruncate): Declare before definition.
1337 * mremap.c (mremap): Likewise.
1338 * pread.c (pread): Likewise.
1339 * configure, Makefile.in, config.in: Rebuild.
1340
1341 * mremap.c: New file.
1342 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
1343 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
1344 (mremap): Declare if HAVE_MREMAP is not defined.
1345 * configure, Makefile.in, config.in: Rebuild.
1346
1347 2009-03-27 Cary Coutant <ccoutant@google.com>
1348
1349 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
1350 position independent.
1351 * sparc.cc (Target_sparc::check_non_pic): Likewise.
1352 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
1353
1354 2009-03-24 Cary Coutant <ccoutant@google.com>
1355
1356 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
1357 an executable.
1358 (needs_dynamic_reloc): Likewise.
1359
1360 2009-03-24 Ian Lance Taylor <iant@google.com>
1361
1362 * yyscript.y (file_cmd): Recognize EXTERN.
1363 (extern_name_list, extern_name_list_body): New nonterminals.
1364 * script.cc (script_add_extern): Define.
1365 * script-c.h (script_add_extern): Declare.
1366
1367 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
1368
1369 * object.cc (is_elf_object): Define.
1370 * object.h (is_elf_object): Declare.
1371 * archive.cc (Archive::get_elf_object_for_member): Call
1372 is_elf_object.
1373 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
1374
1375 2009-03-24 Elliott Hughes <enh@google.com>
1376
1377 * output.cc (Output_file::map_anonymous): Define.
1378 (Output_file::map): Use map_anonymous. If the regular mmap fails,
1379 try an anonymous one. Report the size if the mmap fails.
1380 * output.h (class Output_file): Declare map_anonymous.
1381
1382 2009-03-24 Ian Lance Taylor <iant@google.com>
1383
1384 * target-select.cc (instantiate_target): Don't acquire the lock if
1385 the instantiated_target_ field has already been set.
1386
1387 2009-03-23 Ian Lance Taylor <iant@google.com>
1388
1389 * gold-threads.h (class Initialize_lock): Define.
1390 * gold-threads.cc (class Initialize_lock_once): Define.
1391 (initialize_lock_control): New static variable.
1392 (initialize_lock_pointer): New static variable.
1393 (initialize_lock_once): New static function.
1394 (Initialize_lock::Initialize_lock): Define.
1395 (Initialize_lock::initialize): Define.
1396 * target-select.h: Include "gold-threads.h".
1397 (class Target_selector): Add lock_ and initialize_lock_ fields.
1398 Don't define instantiate_target, just declare it.
1399 * target-select.cc (Target_selector::Target_selector): Initialize
1400 new fields.
1401 (Target_selector::instantiate_target): Define.
1402 * descriptors.h: Include "gold-threads.h".
1403 (class Descriptors): Add initialize_lock_ field.
1404 * descriptors.cc (Descriptors::Descriptors): Initialize new
1405 field.
1406 (Descriptors::open): Use initialize_lock_ field
1407 * errors.h (class Errors): Add initialize_lock_ field.
1408 * errors.cc (Errors::Errors): Initialize new field.
1409 (Errors::initialize_lock): Use initialize_lock_ field.
1410 * powerpc.cc (class Target_selector_powerpc): Remove
1411 instantiated_target_ field. In do_recognize call
1412 instantiate_target rather than do_instantiate_target. In
1413 do_instantiate_target just allocate a new target.
1414 * sparc.cc (class Target_selector_sparc): Likewise.
1415
1416 * freebsd.h: New file.
1417 * i386.cc: Include "freebsd.h".
1418 (Target_i386): Derive from Target_freebsd rather than
1419 Sized_target.
1420 (Target_selector_i386): Derive from Target_selector_freebsd rather
1421 than Target_selector.
1422 * x86_64.cc: Include "freebsd.h".
1423 (Target_x86_64): Derive from Target_freebsd rather than
1424 Sized_target.
1425 (Target_selector_x86_64): Derive from Target_selector_freebsd
1426 rather than Target_selector.
1427 * target.h (class Target): Add adjust_elf_header and
1428 do_adjust_elf_header.
1429 * output.cc (Output_file_header:: do_sized_write): Call target
1430 adjust_elf_header routine.
1431 * configure.tgt: Set targ_osabi.
1432 * configure.ac: Define GOLD_DEFAULT_OSABI.
1433 * parameters.cc (Parameters::default_target): Pass
1434 GOLD_DEFAULT_OSABI to select_target.
1435 * target-select.h (class Target_selector): Make instantiate_target
1436 protected rather than private.
1437 * Makefile.am (HFILES): Add freebsd.h.
1438 * configure, Makefile.in, config.in: Rebuild.
1439
1440 * merge.cc (do_add_input_section): Correct pend value. Change
1441 message about last entry not being null terminated from error to
1442 warning.
1443
1444 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
1445
1446 * incremental.cc: New file.
1447 * Makefile.am (CCFILES): Add incremental.cc.
1448 * Makefile.in: Rebuild.
1449
1450 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
1451
1452 * layout.cc (Layout::output_section_name): Preserve names
1453 of '.note.' sections.
1454
1455 2009-03-19 Ian Lance Taylor <iant@google.com>
1456
1457 * descriptors.cc (Descriptors::open): Check that the options are
1458 valid before using them.
1459
1460 2009-03-18 Ian Lance Taylor <iant@google.com>
1461
1462 * script-sections.h: Include <list>.
1463 (class Script_sections): Change Sections_elements from std::vector
1464 to std::list. Typedef public Elements_iterator. Add
1465 orphan_section_placement_, data_segment_align_start_, and
1466 saw_data_segment_align_ fields. Remove data_segment_align_index_
1467 field.
1468 * script-sections.cc (class Orphan_section_placement): New class.
1469 (class Sections_element): Add virtual functions is_relro and
1470 orphan_section_init. Remove virtual function place_orphan_here.
1471 (class Output_section_definition): Add is_relro and
1472 orphan_section_init. Remove place_orphan_here.
1473 (class Orphan_output_section): Likewise.
1474 (Script_sections::Script_sections): Update for field changes.
1475 (Script_sections::data_segment_align): Set saw_data_segment_align_
1476 and data_segment_align_start_, not data_segment_align_index.
1477 (Script_sections::data_segment_relro_end): Check
1478 saw_data_segment_align_. Use data_segment_align_start_ rather
1479 than data_segment_align_index_.
1480 (Script_sections::place_orphan): Rewrite to use
1481 Orphan_section_placement.
1482
1483 2009-03-17 Ian Lance Taylor <iant@google.com>
1484
1485 * archive.cc (Archive::add_symbols): Check for a version attached
1486 to the symbol name in the archive map.
1487 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
1488 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
1489 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
1490 (ver_test_11.a): New target.
1491 * testsuite/Makefile.in: Rebuild.
1492
1493 * configure.ac: Check for chsize and posix_fallocate. Replace
1494 ftruncate.
1495 * ftruncate.c: New file, from gnulib.
1496 * output.cc (posix_fallocate): Define dummy version if not
1497 HAVE_POSIX_FALLOCATE.
1498 (Output_file::map): Call posix_fallocate rather than lseek and
1499 write.
1500 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
1501 * configure, Makefile.in, config.in: Rebuild.
1502
1503 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
1504
1505 * layout.h (Layout::create_note): Add section_name parameter.
1506 * layout.cc (Layout::create_note): Likewise.
1507 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
1508
1509 2009-03-17 Ian Lance Taylor <iant@google.com>
1510
1511 * descriptors.cc: Include "options.h".
1512 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
1513 (Descriptors::open): Always use O_CLOEXEC when opening a new
1514 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
1515 then set FD_CLOEXEC.
1516
1517 * sparc.cc (class Target_sparc): Add has_got_section.
1518 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
1519 make sure we have a GOT section.
1520
1521 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
1522 (Target_sparc::Scan::local): Likewise.
1523 (Target_sparc::Scan::global): Likewise.
1524 (Target_sparc::Relocate::relocate): Likewise.
1525 (Target_sparc::Relocate::relocate_tls): Likewise.
1526
1527 * symtab.cc (Symbol_table::define_default_version): New function,
1528 broken out of add_from_object.
1529 (Symbol_table::add_from_object): Call define_default_version.
1530 (Symbol_table::define_special_symbol): Add resolve_oldsym
1531 parameter. Change all callers. If the version for a symbol comes
1532 from a version script, resolve it with the symbol with the same
1533 name with no version. Also add the symbol without a version if
1534 appropriate.
1535 (do_define_in_output_data): If resolving with oldsym, don't delete
1536 sym.
1537 (do_define_in_output_segment): Likewise.
1538 (do_define_as_constant): Likewise.
1539 * symtab.h (class Symbol_table): Update declarations.
1540
1541 2009-03-13 Ian Lance Taylor <iant@google.com>
1542
1543 * readsyms.cc (Read_symbols::incompatible_warning): New function.
1544 (Read_symbols::requeue): New function.
1545 (Read_symbols::do_read_symbols): If make_elf_object fails because
1546 the target type is not configured, and the file was searched for,
1547 issue a warning and retry with the next directory.
1548 (Add_symbols::run): If the file has an incompatible format, and
1549 it was searched for, requeue the Read_symbols task. On error,
1550 release the object.
1551 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
1552 dirindex parameter to constructor. Change all callers. Declare
1553 incompatible_warning and requeue.
1554 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
1555 input_argument_ and input_group_ fields. Add them to
1556 constructor. Change all callers.
1557 (class Read_script): Add dirindex_ field. Add it to constructor.
1558 Change all callers.
1559 * archive.cc (Archive::setup): Remove input_objects parameter.
1560 Change all callers.
1561 (Archive::get_file_and_offset): Likewise.
1562 (Archive::read_all_symbols): Likewise.
1563 (Archive::read_symbols): Likewise.
1564 (Archive::get_elf_object_for_member): Remove input_objects
1565 parameter. Add punconfigured parameter. Change all callers.
1566 (Archive::add_symbols): Change return type to bool. Check return
1567 value of include_member.
1568 (Archive::include_all_members): Likewise.
1569 (Archive::include_member): Change return type to bool. Return
1570 false if first included object has incompatible target. Set
1571 included_member_ field.
1572 (Add_archive_symbols::run): If add_symbols returns false, requeue
1573 Read_symbols task.
1574 * archive.h (class Archive): Add included_member_ field.
1575 Initialize it in constructor. Add input_file and searched_for
1576 methods. Update declarations.
1577 (class Add_archive_symbols): Add dirpath_, dirindex_, and
1578 input_argument_ fields. Add them to constructor. Change all
1579 callers.
1580 * script.cc: Include "target-select.h".
1581 (class Parser_closure): Add skip_on_incompatible_target_ and
1582 found_incompatible_target_ fields. Add
1583 skip_on_incompatible_target parameter to constructor. Change all
1584 callers. Add methods skip_on_incompatible_target,
1585 clear_skip_on_incompatible_target, found_incompatible_target, and
1586 set_found_incompatible_target.
1587 (read_input_script): Add dirindex parameter. Change all callers.
1588 If parser finds an incompatible target, requeue Read_symbols
1589 task.
1590 (script_set_symbol): Clear skip_on_incompatible_target in
1591 closure.
1592 (script_add_assertion, script_parse_option): Likewise.
1593 (script_start_sections, script_add_phdr): Likewise.
1594 (script_check_output_format): New function.
1595 * script.h (read_input_script): Update declaration.
1596 * script-c.h (script_check_output_format): Declare.
1597 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
1598 (ignore_cmd): Remove OUTPUT_FORMAT.
1599 * fileread.cc (Input_file::Input_file): Add explicit this.
1600 (Input_file::will_search_for): New function.
1601 (Input_file::open): Add pindex parameter. Change all callers.
1602 * fileread.h (class Input_file): Add input_file_argument method.
1603 Declare will_search_for. Update declarations.
1604 * object.cc (make_elf_object): Add punconfigured parameter.
1605 Change all callers.
1606 * object.h (class Object): Make input_file public. Add
1607 searched_for method.
1608 (make_elf_object): Update declaration.
1609 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
1610 restart search.
1611 * dirsearch.h (class Dirsearch): Update declaration.
1612 * options.h (class General_options): Add --warn-search-mismatch.
1613 * parameters.cc (Parameters::is_compatible_target): New function.
1614 * parameters.h (class Parameters): Declare is_compatible_target.
1615 * workqueue.cc (Workqueue::add_blocker): New function.
1616 * workqueue.h (class Workqueue): Declare add_blocker.
1617
1618 * fileread.cc (Input_file::open): Remove options parameter.
1619 Change all callers.
1620 (Input_file::open_binary): Likewise.
1621 * script.cc (read_input_script): Likewise.
1622 * readsyms.h (class Read_symbols): Remove options_ field. Remove
1623 options parameter from constructor. Change all callers.
1624 (class Read_script): Likewise.
1625 * fileread.h (class Input_file): Update declarations.
1626 * script.h (read_input_script): Update declaration.
1627
1628 2009-03-10 Nick Clifton <nickc@redhat.com>
1629
1630 * po/es.po: New Spanish translation.
1631
1632 2009-03-06 Cary Coutant <ccoutant@google.com>
1633
1634 * options.cc (parse_short_option): Keep dash_z from registering itself.
1635
1636 2009-03-03 Ian Lance Taylor <iant@google.com>
1637
1638 PR 9918
1639 * target-reloc.h (relocate_section): Pass output_section to
1640 relocate.
1641 * i386.cc (Target_i386::should_apply_static_reloc): Add
1642 output_section parameter. Change all callers.
1643 (Target_i386::Relocate::relocate): Add output_section parameter.
1644 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1645 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1646 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1647 * testsuite/two_file_shared.sh: New script.
1648 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
1649 (check_DATA): Add two_file_shared.dbg.
1650 (two_file_shared.dbg): New target.
1651 * testsuite/Makefile.in: Rebuild.
1652
1653 2009-03-01 Ian Lance Taylor <iant@google.com>
1654
1655 * configure.ac: Check for byteswap.h.
1656 * configure: Rebuild.
1657 * config.in: Rebuild.
1658
1659 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
1660
1661 * layout.cc (Layout::find_or_add_kept_section): New function.
1662 (Layout::add_comdat): Removed.
1663 * layout.h (struct Kept_section): Move out of class Layout.
1664 Remove trailing underscores from field names. Add group_sections
1665 field. Rename group_ field to is_group. Change all uses.
1666 (class Layout): Declare find_or_add_kept_section, not add_comdat.
1667 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
1668 comdat_groups_ field.
1669 (Sized_relobj::include_section_group): Use
1670 find_or_add_kept_section and Kept_section::group_sections.
1671 (Sized_relobj::include_linkonce_section): Likewise.
1672 * object.cc (class Sized_relobj): Don't define Comdat_group or
1673 Comdat_group_table. Remove find_comdat_group and
1674 add_comdat_group. Remove comdat_groups_ field.
1675 * plugin.cc (include_comdat_group): Use
1676 Layout::find_or_add_kept_section.
1677
1678 2009-02-28 Ian Lance Taylor <iant@google.com>
1679
1680 * README: --gc-sections and map files are now supported. Document
1681 some build requirements.
1682
1683 PR 6992
1684 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
1685 relocatable link set the value of the section symbol to zero.
1686 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
1687 relocatable link don't include the section address in the local
1688 symbol value.
1689
1690 2009-02-27 Ian Lance Taylor <iant@google.com>
1691
1692 PR 6811
1693 * options.h (class Search_directory): Add is_system_directory.
1694 (class General_options): Declare is_in_system_directory.
1695 * options.cc (get_relative_sysroot): Make static.
1696 (get_default_sysroot): Make static.
1697 (General_optoins::is_in_system_directory): New function.
1698 * fileread.cc (Input_file::is_in_system_directory): New function.
1699 * fileread.h (class Input_file): Declare is_in_system_directory.
1700 * object.h (class Object): Add is_in_system_directory.
1701 (class Input_objects): Remove system_library_directory_ field.
1702 * object.cc (Input_objects::add_object): Don't set
1703 system_library_directory_.
1704 (input_objects::found_in_system_library_directory): Remove.
1705 * symtab.cc (Symbol_table::write_globals): Remove input_objects
1706 parameter. Change all callers.
1707 (Symbol_table::sized_write_globals): Likewise.
1708 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
1709 Call Object::is_in_system_directory.
1710 * symtab.h (class Symbol_table): Update declarations.
1711
1712 PR 5990
1713 * descriptors.h (Open_descriptor): Add is_on_stack field.
1714 * descriptors.cc (Descriptors::open): If the descriptor is on the
1715 top of the stack, remove it. Initialize is_on_stack field.
1716 (Descriptors::release): Only add pod to stack if it is not on the
1717 stack already.
1718 (Descriptors::close_some_descriptor): Clear stack_next and
1719 is_on_stack fields.
1720
1721 PR 7091
1722 * output.cc (Output_section::find_starting_output_address): Rename
1723 from starting_output_address; add PADDR parameter; change return
1724 type.
1725 * output.h (class Output_section): Declare
1726 find_starting_output_address instead of starting_output_address.
1727 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
1728 section symbol for which we can't find a merge section.
1729
1730 PR 9836
1731 * symtab.cc (Symbol_table::add_from_object): If the visibility is
1732 hidden or internal, force the symbol to be local.
1733 * resolve.cc (Symbol::override_visibility): Define.
1734 (Symbol::override_base): Use override_visibility.
1735 (Symbol_table::resolve): Likewise.
1736 (Symbol::override_base_with_special): Likewise.
1737 (Symbol_table::override_with_special): If the visibility is hidden
1738 or internal, force the symbol to be local.
1739 * symtab.h (class Symbol): Add set_visibility and
1740 override_visibility.
1741 * testsuite/ver_test_1.sh: New file.
1742 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
1743 (check_DATA): Add ver_test_1.syms.
1744 (ver_test_1.syms): New target.
1745 * testsuite/Makefile.in: Rebuild.
1746
1747 2009-02-25 Cary Coutant <ccoutant@google.com>
1748
1749 * layout.cc (Layout::choose_output_section): Don't rename sections
1750 when using a linker script that has a SECTIONS clause.
1751 * Makefile.in: Regenerate.
1752
1753 * testsuite/Makefile.am (script_test_5.sh): New test case.
1754 * testsuite/Makefile.in: Regenerate.
1755 * testsuite/script_test_5.cc: New file.
1756 * testsuite/script_test_5.sh: New file.
1757 * testsuite/script_test_5.t: New file.
1758
1759 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
1760
1761 * archive.cc (Archive::include_member): Update calls to add_symbols.
1762 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
1763 the Layout argument.
1764 * dynobj.h (do_add_symbols): Add the Layout argument.
1765 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
1766 Layout argument.
1767 * object.h (Object::add_symbols): Add the Layout argument.
1768 (Object::do_add_symbols): Add the Layout argument.
1769 (Sized_relobj::do_add_symbols): Add the Layout argument.
1770 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
1771 Unify the two versions.
1772 (Add_plugin_symbols): Remove.
1773 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
1774 (Sized_pluginobj::do_add_symbols): Unify the two versions.
1775 (Add_plugin_symbols): Remove.
1776 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
1777 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
1778 (Add_symbols::run): Make it work with Pulginobj.
1779
1780 2009-02-06 Ian Lance Taylor <iant@google.com>
1781
1782 * object.cc (Sized_relobj::do_layout): Make info message start
1783 with lower case letter.
1784
1785 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
1786
1787 * binary.cc: Fix file comment.
1788
1789 * options.h (enum Incremental_disposition): Define.
1790 (class General_options): Add new options: --incremental,
1791 --incremental_changed, --incremental_unchanged,
1792 --incremental_unknown. Add incremental_disposition_ and
1793 implicit_incremental_ fields.
1794 (General_options::incremental_disposition): New function.
1795 (class Position_dependent_options): Add incremental_disposition
1796 option.
1797 (Position_dependent_options::copy_from_options): Set incremental
1798 dispositions.
1799 * options.cc (General_options::parse_incremental_changed): New
1800 function.
1801 (General_options::parse_incremental_unchanged): New function.
1802 (General_options::parse_incremental_unknown): New function.
1803 (General_options::General_options): Initialize new fields
1804 incremental_disposition_ and implicit_incremental_.
1805 (General_options::finalize): Check for uasge of --incremental-*
1806 without --incremental.
1807
1808 2009-02-06 Chris Demetriou <cgd@google.com>
1809
1810 * gold.h (gold_undefined_symbol): Change to take only a Symbol
1811 pointer and to report location as the file name associated with
1812 the symbol.
1813 (gold_undefined_symbol_at_location): New function to replace the
1814 old gold_undefined_symbol functionality.
1815 * target-reloc.h (relocate_section): Update to use
1816 gold_undefined_symbol_at_location.
1817 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1818 Call gold_undefined_symbol function rather than gold_error.
1819 * errors.h (Errors::undefined_symbol): Take location as a
1820 string, rather than calculating it from a relocation.
1821 * errors.cc (Errors::fatal): Print "fatal error:" before the
1822 formatted message.
1823 (Errors::error, Errors::error_at_location): Print "error: "
1824 before the formatted message.
1825 (Errors::undefined_symbol): Take location as a string, rather
1826 than calculating it from a relocation.
1827 (gold_undefined_symbol_at_location): New function akin to
1828 old gold_undefined_symbol, calculates location from relocation.
1829 (gold_undefined_symbol): Change to take only a Symbol pointer
1830 and to report location as the file name associated with the symbol.
1831 * testsuite/debug_msg.sh: Update for changed error messages.
1832 * testsuite/undef_symbol.sh: Likewise.
1833
1834 2009-02-04 Duncan Sands <baldrick@free.fr>
1835
1836 PR 9812
1837 * reduced_debug_output.h
1838 (Output_reduced_debug_abbrev_section::failed): Use format for
1839 gold_warning.
1840 (Output_reduced_debug_info_section::faild): Likewise.
1841
1842 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
1843
1844 * script.cc (Lazy_demangler): New class.
1845 (Version_script_info::get_symbol_version_helper): Demangle a
1846 symbol only once.
1847
1848 2009-01-29 Cary Coutant <ccoutant@google.com>
1849
1850 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
1851 to __tls_get_addr.
1852 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1853
1854 2009-01-28 Ian Lance Taylor <iant@google.com>
1855
1856 * version.cc (version_string): Bump to 1.9.
1857
1858 * gold.h: Include <cstring> and <stdint.h>.
1859 * version.cc: Include <cstdio>.
1860 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
1861 warning.
1862 * reduced_debug_output.cc (insert_into_vector): Rename from
1863 Insert_into_vector; change all callers. Use Swap_unaligned to
1864 avoid aliasing issue; remove union since it is unnecessary.
1865
1866 2009-01-27 Sriraman Tallam <tmsriram@google.com>
1867
1868 * Makefile.am (CCFILES): Add gc.cc.
1869 (HFILES): Add gc.h.
1870 * Makefile.in: Regenerate.
1871 * gold.cc (Gc_runner): New class.
1872 (queue_initial_tasks): Call garbage collection related tasks
1873 when corresponding options are invoked.
1874 (queue_middle_gc_tasks): New function.
1875 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
1876 processed early before laying out sections during garbage collection.
1877 * gold.h (queue_middle_gc_tasks): New function.
1878 (is_prefix_of): Move from "layout.cc".
1879 * i386.cc (Target_i386::gc_process_relocs): New function.
1880 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
1881 * main.cc (main): Create object of class "Garbage_collection".
1882 * object.cc (Relobj::copy_symbols_data): New function.
1883 (Relobj::is_section_name_included): New function.
1884 (Sized_relobj::do_layout): Allow this function to be called twice
1885 during garbage collection and defer layout of section during the
1886 first call.
1887 * object.h (Relobj::get_symbols_data): New function.
1888 (Relobj::is_section_name_included): New function.
1889 (Relobj::copy_symbols_data): New function.
1890 (Relobj::set_symbols_data): New function.
1891 (Relobj::get_relocs_data): New function.
1892 (Relobj::set_relocs_data): New function.
1893 (Relobj::is_output_section_offset_invalid): New pure virtual function.
1894 (Relobj::gc_process_relocs): New function.
1895 (Relobj::do_gc_process_relocs): New pure virtual function.
1896 (Relobj::sd_): New data member.
1897 (Sized_relobj::is_output_section_offset_invalid): New function.
1898 (Sized_relobj::do_gc_process_relocs): New function.
1899 * options.h (General_options::gc_sections): Modify to not be a no-op.
1900 (General_options::print_gc_sections): New option.
1901 * plugin.cc (Plugin_finish::run): Remove function call to
1902 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
1903 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
1904 * reloc.cc (Read_relocs::run): Add task to process relocs and
1905 determine unreferenced sections when doing garbage collection.
1906 (Gc_process_relocs): New class.
1907 (Sized_relobj::do_gc_process_relocs): New function.
1908 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
1909 sections that are garbage collected.
1910 * reloc.h (Gc_process_relocs): New class.
1911 * sparc.cc (Target_sparc::gc_process_relocs): New function.
1912 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
1913 symbols whose corresponding sections are garbage collected.
1914 (Symbol_table::Symbol_table): Add new parameter for the garbage
1915 collection object.
1916 (Symbol_table::gc_mark_undef_symbols): New function.
1917 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1918 (Symbol_table::gc_mark_dyn_syms): New function.
1919 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
1920 as garbage.
1921 (Symbol_table::add_from_object): Likewise.
1922 (Symbol_table::add_from_relobj): When building shared objects, do not
1923 treat externally visible symbols as garbage.
1924 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
1925 table information for static and relocatable links.
1926 * symtab.h (Symbol_table::set_gc): New function.
1927 (Symbol_table::gc): New function.
1928 (Symbol_table::gc_mark_undef_symbols): New function.
1929 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1930 (Symbol_table::gc_mark_dyn_syms): New function.
1931 (Symbol_table::gc_): New data member.
1932 * target.h (Sized_target::gc_process_relocs): New pure virtual
1933 function.
1934 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
1935 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
1936
1937 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
1938
1939 * options.h (General_options::gc_sections): Define as a no-op for now.
1940 (General_options::no_keep_memory): Ditto.
1941 (General_options::Bshareable): Define.
1942 * options.cc (General_options::finalize): Honor -Bshareable.
1943
1944 2009-01-20 Andreas Schwab <schwab@suse.de>
1945
1946 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
1947 read the value in the contents, since we don't use it. Use the
1948 template endianness when writing.
1949 (Relocate::relocate): Use it for R_PPC_REL16_HA.
1950
1951 2009-01-19 Andreas Schwab <schwab@suse.de>
1952
1953 * configure.tgt (powerpc64-*): Fix targ_obj.
1954
1955 2009-01-15 Ian Lance Taylor <iant@google.com>
1956
1957 * object.cc (Sized_relobj::write_local_symbols): Don't write out
1958 local symbols when stripping all symbols.
1959
1960 2009-01-14 Cary Coutant <ccoutant@google.com>
1961
1962 * output.cc (Output_reloc): Add explicit instantiations.
1963
1964 2009-01-14 Cary Coutant <ccoutant@google.com>
1965
1966 * archive.cc (Archive::get_elf_object_for_member): Remove call
1967 to File_read::claim_for_plugin.
1968 * descriptors.cc (Descriptors::open): Remove reference to
1969 is_claimed.
1970 (Descriptors::claim_for_plugin): Remove.
1971 * descriptors.h (Descriptors::claim_for_plugin): Remove.
1972 (Descriptors::is_claimed): Remove.
1973 (claim_descriptor_for_plugin): Remove.
1974 * fileread.cc (File_read::claim_for_plugin): Remove.
1975 * fileread.h (File_read::claim_for_plugin): Remove.
1976 (File_read::descriptor): Reopen descriptor if necessary.
1977 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
1978 (Plugin_manager::all_symbols_read): Add task parameter. Change
1979 all callers.
1980 (Plugin_manager::get_input_file): New function.
1981 (Plugin_manager::release_input_file): New function.
1982 (Pluginobj::Pluginobj): Add filesize parameter and initialize
1983 corresponding data member.
1984 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
1985 and pass to base constructor. Change all callers.
1986 (get_input_file, release_input_file): New functions.
1987 (make_sized_plugin_object): Add filesize parameter. Change all callers.
1988 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
1989 (Plugin_manager::all_symbols_read): Add task parameter.
1990 (Plugin_manager::get_input_file): New function.
1991 (Plugin_manager::release_input_file): New function.
1992 (Plugin_manager::task_): New data member.
1993 (Pluginobj::Pluginobj): Add filesize parameter.
1994 (Pluginobj::filename): New function.
1995 (Pluginobj::descriptor): New function.
1996 (Pluginobj::filesize): New function.
1997 (Pluginobj::filesize_): New data member.
1998 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
1999 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2000 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2001
2002 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2003 with archive libraries.
2004 * testsuite/Makefile.in: Regenerate.
2005 * testsuite/plugin_test.c (struct sym_info): New type.
2006 (get_input_file, release_input_file): New static variables.
2007 (onload): Capture new transfer vector entries.
2008 (claim_file_hook): Stop reading at end of file according to filesize.
2009 Factor out parsing of readelf output into separate function.
2010 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2011 APIs and get the source file name from the symbol table. Convert
2012 source file name to corresponding object file name. Print info
2013 message when adding new input files.
2014 (parse_readelf_line): New function.
2015 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2016 * testsuite/plugin_test_2.sh: Likewise.
2017 * testsuite/plugin_test_3.sh: Likewise.
2018 * testsuite/plugin_test_4.sh: New test case.
2019
2020 2009-01-07 Ian Lance Taylor <iant@google.com>
2021
2022 * version.cc (version_string): Bump to 1.8.
2023
2024 2008-12-23 Cary Coutant <ccoutant@google.com>
2025
2026 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2027 * plugin.cc (Plugin_manager::finish): Rename as
2028 layout_deferred_objects. Move cleanup to separate function.
2029 (Plugin_manager::cleanup): New function.
2030 (Plugin_finish::run): Call layout_deferred_objects and cleanup
2031 separately.
2032 * plugin.h (Plugin_manager::finish): Rename as
2033 layout_deferred_objects.
2034 (Plugin_manager::cleanup): New function.
2035 (Plugin_manager::cleanup_done): New field.
2036
2037 2008-12-23 Cary Coutant <ccoutant@google.com>
2038
2039 * plugin.cc (is_visible_from_outside): New function.
2040 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
2041 so we don't return "IR only" status for exported symbols or -r links.
2042
2043 * testsuite/Makefile.am (plugin_test_3): New test case.
2044 * testsuite/Makefile.in: Regenerate.
2045 * testsuite/plugin_test_3.sh: New file.
2046
2047 2008-12-22 Cary Coutant <ccoutant@google.com>
2048
2049 * object.cc (Sized_relobj::layout_section): New function.
2050 (Sized_relobj::do_layout): Defer layout of input sections until after
2051 plugin has provided replacement files.
2052 (Sized_relobj::do_layout_deferred_sections): New function.
2053 * object.h (Relobj::set_section_offset): Remove virtual keyword.
2054 (Relobj::layout_deferred_sections): New function.
2055 (Relobj::do_layout_deferred_sections): New function.
2056 (Sized_relobj::do_layout_deferred_sections): New function.
2057 (Sized_relobj::layout_section): New function.
2058 (Sized_relobj::Deferred_layout): New structure.
2059 (Sized_relobj::deferred_layout_): New field.
2060 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
2061 Change all callers. Layout deferred sections.
2062 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
2063 references.
2064 (Plugin_hook::run): Move code from do_plugin_hook inline.
2065 (Plugin_hook::do_plugin_hook): Remove.
2066 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
2067 (Plugin_manager::finish): Renamed, was cleanup.
2068 (Plugin_manager::should_defer_layout): New function.
2069 (Plugin_manager::add_deferred_layout_object): New function.
2070 (Plugin_manager::Deferred_layout_list): New type.
2071 (Plugin_manager::deferred_layout_objects_): New field.
2072 (Plugin_hook::do_plugin_hook): Remove.
2073
2074 2008-12-17 Ian Lance Taylor <iant@google.com>
2075
2076 * options.h (class General_options): Add --no case for
2077 --export-dynamic.
2078
2079 2008-12-16 Cary Coutant <ccoutant@google.com>
2080
2081 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
2082 vector.
2083 (Plugin_manager::claim_file): Create plugin object even if
2084 plugin did not call the add_symbols callback.
2085 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
2086 asking for more symbols than were added.
2087 * testsuite/Makefile.am (plugin_test_1): Add test case with
2088 no global symbols.
2089 (empty.syms): New target.
2090 * testsuite/Makefile.in: Regenerate.
2091 * testsuite/plugin_test.c (claim_file_hook): Add new debug
2092 message. Don't call add_symbols if no globals.
2093 (all_symbols_read_hook): Don't provide replacement for empty
2094 claimed file.
2095
2096 2008-12-12 Ian Lance Taylor <iant@google.com>
2097
2098 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
2099 r_type == 0 for a local symbol with r_sym == 0.
2100 (scan_relocatable_relocs): Pass r_sym to
2101 local_non_section_strategy.
2102 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
2103 r_sym parameter.
2104
2105 * configure.ac: Update test for TLS descriptors: they are
2106 supported as of glibc 2.9.
2107 * configure: Rebuild.
2108
2109 2008-12-11 Ian Lance Taylor <iant@google.com>
2110
2111 PR 7091
2112 * target-reloc.h (Default_scan_relocatable_relocs): For each
2113 function, map r_type == 0 to RELOC_DISCARD.
2114
2115 2008-12-10 Cary Coutant <ccoutant@google.com>
2116
2117 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
2118 object to override a kept COMDAT group from a plugin object.
2119
2120 2008-12-09 Ian Lance Taylor <iant@google.com>
2121
2122 PR 7088
2123 * yyscript.y (file_cmd): Handle INPUT.
2124
2125 * testsuite/initpri1.c: Change all declarations to be full
2126 prototypes by adding void, to avoid compiler warnings.
2127
2128 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
2129
2130 * options.cc (General_options::parse_plugin_opt): New.
2131 (General_options::add_plugin): The argument now is just the filename.
2132 (General_options::add_plugin_option): New.
2133 * options.h (plugin_opt): New.
2134 (add_plugin): Change argument name.
2135 (add_plugin_option): New.
2136 * plugin.cc (Plugin::load): Don't parse the plugin option.
2137 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
2138 (Plugin::add_option): New.
2139 (Plugin::args_): Change type.
2140 (Plugin::filename_): New.
2141 (Plugin_manager::add_plugin_option): New.
2142 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
2143 * testsuite/Makefile.in: Regenerate.
2144
2145 2008-12-05 Cary Coutant <ccoutant@google.com>
2146
2147 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
2148 Handle --strip-lto-sections option.
2149 * options.h (strip_lto_sections): New option.
2150
2151 2008-12-01 Cary Coutant <ccoutant@google.com>
2152
2153 * plugin.cc (ld_plugin_message): Change format parameter to const.
2154 Fix mismatch between new[] and delete.
2155
2156 2008-11-14 Cary Coutant <ccoutant@google.com>
2157
2158 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
2159 instead of -1U.
2160
2161 2008-11-05 Craig Silverstein <csilvers@google.com>
2162
2163 * options.cc (General_options::parse_dynamic_list): New function.
2164 * options.h (General_options): New flags dynamic_list,
2165 dynamic_list_data, dynamic_list_cpp_new, and
2166 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
2167 (General_options::in_dynamic_list): New function.
2168 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
2169 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
2170 (Lex::can_continue_name): Likewise.
2171 (yylex): Likewise.
2172 (read_script_file): New parameter script_options.
2173 (read_dynamic_list): New function.
2174 (Script_options::define_dynamic_list): New function.
2175 (dynamic_list_keyword_parsecodes): New variable.
2176 (dynamic_list_keywords): New variable.
2177 * script.h (Script_options::define_dynamic_list): New function
2178 prototype.
2179 (read_dynamic_list): New function prototype.
2180 * symtab.cc (strprefix): New macro.
2181 (Symbol::should_add_dynsym_entry): Support dynamic_list,
2182 dynamic_list_data, dynamic_list_cpp_new, and
2183 dynamic_list_cpp_typeinfo.
2184 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
2185 (dynamic_list_expr): New rule.
2186 (dynamic_list_nodes): Likewise.
2187 (dynamic_list_node): Likewise.
2188 * testsuite/Makefile.am (dynamic_list): New test.
2189 * testsuite/Makefile.in: Regenerated.
2190 * testsuite/dynamic_list.t: New file.
2191 * testsuite/dynamic_list.sh: New file.
2192
2193 2008-11-05 Craig Silverstein <csilvers@google.com>
2194
2195 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
2196 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
2197 (t11_last): Likewise.
2198 * testsuite/ver_test_6.c (main): Likewise.
2199
2200 2008-10-07 Cary Coutant <ccoutant@google.com>
2201
2202 * options.c (General_options::finalize): Add check for -static and
2203 -shared.
2204 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
2205 is not empty.
2206
2207 2008-10-02 Cary Coutant <ccoutant@google.com>
2208
2209 * plugin.cc (make_sized_plugin_object): Fix conditional
2210 compilation to work when not all targets are enabled.
2211
2212 2008-09-29 Cary Coutant <ccoutant@google.com>
2213
2214 * archive.cc (Archive::get_file_and_offset): Use filename instead
2215 of name to get library path.
2216 (Archive::include_member): Unlock external member of a thin archive.
2217
2218 * testsuite/Makefile.am (TEST_AR): New variable.
2219 (thin_archive_test_1): New test.
2220 (thin_archive_test_2): New test.
2221 * testsuite/Makefile.in: Regenerate.
2222 * testsuite/thin_archive_main.cc: New file.
2223 * testsuite/thin_archive_test_1.cc: New file.
2224 * testsuite/thin_archive_test_2.cc: New file.
2225 * testsuite/thin_archive_test_3.cc: New file.
2226 * testsuite/thin_archive_test_4.cc: New file.
2227
2228 2008-09-29 Cary Coutant <ccoutant@google.com>
2229
2230 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
2231 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
2232 instead of -1U.
2233 (Sized_relobj::do_finalize_local_symbols): Likewise.
2234 (Sized_relobj::map_to_kept_section): Likewise.
2235 * object.h (Sized_relobj::invalid_address): New constant.
2236 (Sized_relobj::do_output_section_offset): Check for invalid_address
2237 and return -1ULL.
2238 * output.cc (Output_reloc::local_section_offset): Use constant
2239 invalid_address instead of -1U.
2240 (Output_reloc::get_address): Likewise.
2241 (Output_section::output_address): Change -1U to -1ULL.
2242 * output.h (Output_reloc::invalid_address): New constant.
2243 * reloc.cc (Sized_relobj::write_sections): Use constant
2244 invalid_address instead of -1U.
2245 (Sized_relobj::relocate_sections): Likewise.
2246 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
2247 values for merge sections.
2248 * target-reloc.h (relocate_for_relocatable): Use constant
2249 invalid_address instead of -1U.
2250
2251 2008-09-19 Cary Coutant <ccoutant@google.com>
2252
2253 Add plugin functionality for link-time optimization (LTO).
2254 * configure.ac (plugins): Add --enable-plugins option.
2255 * configure: Regenerate.
2256 * config.in: Regenerate.
2257 * Makefile.am (LIBDL): New variable.
2258 (CCFILES): Add plugin.cc.
2259 (HFILES): Add plugin.h.
2260 (ldadd_var): Add LIBDL.
2261 * Makefile.in: Regenerate.
2262
2263 * archive.cc: Include "plugin.h".
2264 (Archive::setup): Don't preread archive symbols when using a plugin.
2265 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
2266 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
2267 files.
2268 (Archive::include_member): Add symbols from plugin objects.
2269 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
2270 * descriptors.cc (Descriptors::open): Check for file descriptors
2271 abandoned by plugins.
2272 (Descriptors::claim_for_plugin): New function.
2273 * descriptors.h (Descriptors::claim_for_plugin): New function.
2274 (Open_descriptor::is_claimed): New field.
2275 (claim_descriptor_for_plugin): New function.
2276 * fileread.cc (File_read::claim_for_plugin): New function.
2277 * fileread.h (File_read::claim_for_plugin): New function.
2278 (File_read::descriptor): New function.
2279 * gold.cc: Include "plugin.h".
2280 (queue_initial_tasks): Add task to call plugin hooks for generating
2281 new object files.
2282 * main.cc: Include "plugin.h".
2283 (main): Load plugin libraries.
2284 * object.h (Pluginobj): Declare.
2285 (Object::pluginobj): New function.
2286 (Object::do_pluginobj): New function.
2287 (Object::set_target): New function.
2288 * options.cc: Include "plugin.h".
2289 (General_options::parse_plugin): New function.
2290 (General_options::General_options): Initialize plugins_ field.
2291 (General_options::add_plugin): New function.
2292 * options.h (Plugin_manager): Declare.
2293 (General_options): Add --plugin option.
2294 (General_options::has_plugins): New function.
2295 (General_options::plugins): New function.
2296 (General_options::add_plugin): New function.
2297 (General_options::plugins_): New field.
2298 * plugin.cc: New file.
2299 * plugin.h: New file.
2300 * readsyms.cc: Include "plugin.h".
2301 (Read_symbols::do_read_symbols): Check for archive before checking
2302 for ELF file. Call plugin hooks to claim files.
2303 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
2304 from a real object file; force override when processing replacement
2305 files.
2306 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
2307 (Symbol::init_base_object): Likewise.
2308 (Symbol::init_base_output_data): Likewise.
2309 (Symbol::init_base_output_segment): Likewise.
2310 (Symbol::init_base_constant): Likewise.
2311 (Symbol::init_base_undefined): Likewise.
2312 (Symbol::output_section): Assert that object is not a plugin.
2313 (Symbol_table::add_from_pluginobj): New function.
2314 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
2315 undefined.
2316 (Symbol_table::sized_write_globals): Likewise.
2317 (Symbol_table::add_from_pluginobj): Instantiate template.
2318 * symtab.h (Sized_pluginobj): Declare.
2319 (Symbol::in_real_elf): New function.
2320 (Symbol::set_in_real_elf): New function.
2321 (Symbol::in_real_elf_): New field.
2322 (Symbol_table::add_from_pluginobj): New function.
2323
2324 * testsuite/Makefile.am (AM_CFLAGS): New variable.
2325 (LIBDL): New variable.
2326 (LDADD): Add LIBDL.
2327 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
2328 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
2329 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
2330 (MOSTLYCLEANFILES): Likewise.
2331 * testsuite/Makefile.in: Regenerate.
2332 * testsuite/plugin_test.c: New file.
2333 * testsuite/plugin_test_1.sh: New file.
2334 * testsuite/plugin_test_2.sh: New file.
2335
2336 2008-09-16 Ian Lance Taylor <iant@google.com>
2337
2338 * target-reloc.h (relocate_section): Check whether a symbol is
2339 defined by the ABI before reporting an undefined symbol error.
2340 * target.h (Target::is_defined_by_abi): Make parameter const.
2341 (Target::do_is_defined_by_abi): Likewise.
2342 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
2343 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
2344 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
2345 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
2346 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
2347 * testsuite/Makefile.in: Rebuild.
2348
2349 * fileread.cc (make_view): Add casts to avoid warning.
2350
2351 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2352
2353 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
2354 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2355
2356 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2357
2358 * options.h (General_options::output_is_executable): New.
2359 (General_options::output_is_pie): New.
2360 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
2361 for shared libraries.
2362 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2363
2364 2008-09-11 Chris Demetriou <cgd@google.com>
2365
2366 * options.h (origin): New -z option.
2367 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
2368 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
2369 in DT_FLAGS_1.
2370
2371 2008-09-05 Cary Coutant <ccoutant@google.com>
2372
2373 * fileread.cc (File_read::make_view): Add check for attempt to map
2374 beyond end of file.
2375
2376 2008-09-05 Cary Coutant <ccoutant@google.com>
2377
2378 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
2379 explicit instantiations.
2380
2381 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
2382
2383 PR gold/6858
2384 * options.cc (General_options::finalize): Allow undefined symbols
2385 in shlibs if linking -shared.
2386
2387 PR gold/6859
2388 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
2389 symbols as not needing a dynsym entry.
2390
2391 2008-08-20 Craig Silverstein <csilvers@google.com>
2392
2393 * fileread.cc (File_read::open): Do not lock the file unless it
2394 was successfully opened.
2395
2396 2008-08-14 Cary Coutant <ccoutant@google.com>
2397
2398 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
2399 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
2400 * testsuite/tls_test.cc (struct int128): 128-bit struct
2401 for testing TLS relocs with non-zero addend.
2402 (v12): New TLS variable.
2403 (t12): New test.
2404 (t_last): Add check for v12.
2405 * testsuite/tls_test.h (t12): New function.
2406 * testsuite/tls_test_main.cc (thread_routine): Call new test.
2407
2408 2008-08-13 Ian Lance Taylor <iant@google.com>
2409
2410 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
2411 set tls_segment_ or relro_segment_.
2412 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
2413 when appropriate.
2414 * output.h (Output_section::clear_is_relro): New function.
2415 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
2416 sections specially even when output_data_ is empty.
2417 (Output_segment::maximum_alignment): When first section is relro,
2418 only force alignment for PT_LOAD segments.
2419 * script.cc (script_data_segment_align): New function.
2420 (script_data_segment_relro_end): New function.
2421 * script-c.h (script_data_segment_align): Declare.
2422 (script_data_segment_relro_end): Declare.
2423 * script-sections.h (class Script_sections): Declare
2424 data_segment_align and data_segment_relro_end. Add fields
2425 segment_align_index_ and saw_relro_end_.
2426 * script-sections.cc (class Sections_element): Add set_is_relro
2427 virtual function. Add new bool* parameter to place_orphan_here.
2428 Add get_output_section virtual function.
2429 (class Output_section_definition): Add set_is_relro. Add new
2430 bool* parameter to place_orphan_here. Add get_output_section.
2431 Add is_relro_ field.
2432 (Output_section_definition::Output_section_definition): Initialize
2433 evaluated_address_, evaluated_load_address, evaluated_addralign_,
2434 and is_relro_ fields.
2435 (Output_section_definition::place_orphan_here): Add is_relro
2436 parameter.
2437 (Output_section_definition::set_section_addresses): Set relro for
2438 output section.
2439 (Output_section_definition::alternate_constraint): Likewise.
2440 (class Orphan_output_section): Add new bool* parameter to
2441 place_orphan_here. Add get_output_section.
2442 (Orphan_output_section::place_orphan_here): Add is_relro
2443 parameter.
2444 (Script_sections::Script_sections): Initialize
2445 data_segment_align_index_ and saw_relro_end_.
2446 (Script_sections::data_segment_align): New function.
2447 (Script_sections::data_segment_relro_end): New function.
2448 (Script_sections::place_orphan): Set or clear is_relro.
2449 (Script_sections::set_section_addresses): Force alignment of first
2450 TLS section.
2451 * yyscript.y (exp): Call script_data_segment_align and
2452 script_data_segment_relro_end.
2453 * testsuite/relro_script_test.t: New file.
2454 * testsuite/relro_test.cc (using_script): Declare.
2455 (t1, t2): Test using_script.
2456 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
2457 (relro_script_test_SOURCES): Define.
2458 (relro_script_test_DEPENDENCIES): Define.
2459 (relro_script_test_LDFLAGS): Define.
2460 (relro_script_test_LDADD): Define.
2461 (relro_script_test.so): New target.
2462 * testsuite/Makefile.in: Rebuild.
2463
2464 2008-08-06 Cary Coutant <ccoutant@google.com>
2465
2466 * archive.cc (Archive::total_archives, Archive::total_members)
2467 (Archive::total_members_loaded): New variables.
2468 (Archive::setup): Add parameter. Add option to preread
2469 archive symbols.
2470 (Archive::read_armap): Add counter.
2471 (Archive::get_file_and_offset): New function.
2472 (Archive::get_elf_object_for_member): New function.
2473 (Archive::read_all_symbols): New function.
2474 (Archive::read_symbols): New function.
2475 (Archive::add_symbols): Add counters.
2476 (Archive::include_all_members): Use armap to find members if it's
2477 already built.
2478 (Archive::include_member): Skip reading symbols if already read.
2479 Factored code into Archive::get_file_and_offset and
2480 Archive::get_elf_object_for_member. Changed call to
2481 Mapfile::report_include_archive_member.
2482 (Archive::print_stats): New function.
2483 * archive.h: Declare Object and Read_symbols_data classes.
2484 (Archive::Archive): Add initializers for new members.
2485 (Archive::setup): Add parameter.
2486 (Archive::print_stats): New function.
2487 (Archive::total_archives, Archive::total_members)
2488 (Archive::total_members_loaded): New variables.
2489 (Archive::get_file_and_offset): New function.
2490 (Archive::get_elf_object_for_member): New function.
2491 (Archive::read_all_symbols): New function.
2492 (Archive::read_symbols): New function.
2493 (Archive::Archive_member): New class.
2494 (Archive::members_): New member.
2495 (Archive::num_members_): New member.
2496 * main.cc: Include archive.h.
2497 (main): Call Archive::print_stats.
2498 * mapfile.cc (Mapfile::report_include_archive_member): Delete
2499 archive parameter; member_name is now the fully-decorated name.
2500 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
2501 * options.h: (General_options): Add --preread-archive-symbols option.
2502 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
2503 Archive::setup.
2504
2505 2008-08-04 Ian Lance Taylor <iant@google.com>
2506
2507 * symtab.h (Symbol::use_plt_offset): New function.
2508 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
2509 * powerpc.cc (Relocate::relocate): Likewise.
2510 * sparc.cc (Relocate::relocate): Likewise.
2511 * x86_64.cc (Relocate::relocate): Likewise.
2512 * testsuite/weak_plt.sh: New test.
2513 * testsuite/weak_plt_main.cc: New test.
2514 * testsuite/weak_plt_shared.cc: New test.
2515 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
2516 (check_PROGRAMS): Add weak_plt.
2517 (check_DATA): Add weak_plt_shared.so.
2518 (weak_plt_main_pic.o, weak_plt): New targets.
2519 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
2520 * testsuite/Makefile.in: Rebuild.
2521
2522 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
2523 gcctestdir/ld.
2524 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
2525 * testsuite/Makefile.in: Rebuild.
2526
2527 2008-08-04 Alan Modra <amodra@bigpond.net.au>
2528
2529 * Makefile.am (POTFILES.in): Set LC_ALL=C.
2530 * Makefile.in: Regenerate.
2531 * po/POTFILES.in: Regenerate.
2532
2533 2008-07-29 Ian Lance Taylor <iant@google.com>
2534
2535 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
2536 symbols before other symbols.
2537 * testsuite/script_test_2.cc (test_addr): Declare.
2538 (test_addr_alias): Declare.
2539 (main): Check that test_addr and test_addr_alias have the right
2540 values.
2541 * testsuite/script_test_2.t: Define test_addr_alias and
2542 test_addr.
2543
2544 2008-07-24 Ian Lance Taylor <iant@google.com>
2545
2546 PR 5990
2547 * descriptors.cc: New file.
2548 * descriptors.h: New file.
2549 * gold-threads.h (class Hold_optional_lock): New class.
2550 * fileread.cc: Include "descriptors.h".
2551 (File_read::~File_read): Release descriptor rather than closing
2552 it.
2553 (File_read::open) [file]: Call open_descriptor rather than open.
2554 Set is_descriptor_opened_.
2555 (File_read::open) [memory]: Assert that descriptor is not open.
2556 (File_read::reopen_descriptor): New function.
2557 (File_read::release): Release descriptor.
2558 (File_read::do_read): Make non-const. Reopen descriptor.
2559 (File_read::read): Make non-const.
2560 (File_read::make_view): Reopen descriptor.
2561 (File_read::do_readv): Likewise.
2562 * fileread.h (class File_read): Add is_descriptor_opened_ field.
2563 Update declarations.
2564 * layout.cc: Include "descriptors.h".
2565 (Layout::create_build_id): Use open_descriptor rather than open.
2566 * output.cc: Include "descriptors.h".
2567 (Output_file::open): Use open_descriptor rather than open.
2568 * archive.cc (Archive::const_iterator): Change Archive to be
2569 non-const.
2570 (Archive::begin, Archive::end): Make non-const.
2571 (Archive::count_members): Likewise.
2572 * archive.h (class Archive): Update declarations.
2573 * object.h (Object::read): Make non-const.
2574 * Makefile.am (CCFILES): Add descriptors.cc.
2575 (HFILES): Add descriptors.h.
2576 * Makefile.in: Rebuild.
2577
2578 PR 6716
2579 * gold.h: Always include <clocale>. Add Solaris workarounds
2580 following code in binutils/sysdep.h.
2581
2582 PR 6048
2583 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
2584 this->eh_frame_hdr_ is NULL before using it.
2585
2586 * dynobj.cc (Versions::Versions): Update comment.
2587
2588 * dynobj.cc (Versions::Versions): If there is an soname, use it as
2589 the base version name.
2590
2591 * stringpool.cc (Stringpool_template::add_with_length): Set key to
2592 array size plus one.
2593 (Stringpool_template::set_string_offsets): Subtract one from key
2594 before using it as an array index.
2595 (Stringpool_template::get_offset_with_length): Likewise.
2596 (Stringpool_template::write_to_buffer): Likewise.
2597 * stringpool.h (Stringpool_template::get_offset_from_key):
2598 Likewise.
2599
2600 2008-07-23 Ian Lance Taylor <iant@google.com>
2601
2602 PR 6658
2603 * object.h (Merged_symbol_value::value): Do our best to handle a
2604 negative addend.
2605
2606 PR 6647
2607 * script.cc (Version_script_info::get_versions): Don't add empty
2608 version tag to return value.
2609 (Version_script_info::get_symbol_version_helper): Change return
2610 type to bool. Add pversion parameter. Change all callers.
2611 (script_register_vers_node): Don't require a non-NULL tag.
2612 * script.h (class Version_script_info): Update declarations.
2613 (Version_script_info::get_symbol_version): Change return type to
2614 bool. Add version parameter. Change all callers.
2615 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
2616 handling. Handle an empty version from a version script.
2617 (Symbol_table::define_special_symbol): Likewise.
2618 * testsuite/ver_test_10.script: New file.
2619 * testsuite/ver_test_10.sh: New file.
2620 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
2621 (check_DATA): Add ver_test_10.syms.
2622 (ver_test_10.syms, ver_test_10.so): New target.
2623 * testsuite/Makefile.in: Rebuild.
2624
2625 2008-07-23 Simon Baldwin <simonb@google.com>
2626
2627 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
2628 to zero for undefined symbols from dynamic libraries.
2629
2630 2008-07-23 Ian Lance Taylor <iant@google.com>
2631
2632 * symtab.cc (Symbol_table::resolve): Remove version parameter.
2633 Change all callers.
2634 * symtab.h (class Symbol_table): Update declaration.
2635 * testsuite/ver_test_9.cc: New file.
2636 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
2637 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
2638 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
2639 (ver_test_9.so, ver_test_9.o): New targets.
2640 * testsuite/Makefile.in: Rebuild.
2641
2642 2008-07-22 Ian Lance Taylor <iant@google.com>
2643
2644 * options.h (class General_options): Define --check-sections.
2645 * layout.cc (Layout::set_segment_offsets): Handle
2646 --check-sections.
2647
2648 * options.h (class General_options): Define -n/--nmagic and
2649 -N/--omagic.
2650 * options.cc (General_options::finalize): For -n/--nmagic or
2651 -N/--omagic, set -static.
2652 * layout.cc (Layout::attach_allocated_section_to_segment): If
2653 -N/--omagic, don't put read-only and read-write sections in
2654 different segments.
2655 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
2656 finding a read-only segment.
2657 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
2658 don't set the minimum segment alignment to the common page size,
2659 and don't set the file offset to the address modulo the page size.
2660 * script-sections.cc (Script_sections::create_segments): If
2661 -n/--omagic, don't put read-only and read-write sections in
2662 different segments.
2663
2664 * cref.cc: New file.
2665 * cref.h: New file.
2666 * options.h (class General_options): Add --print-symbol-counts.
2667 * main.cc (main): Issue defined symbol report if requested.
2668 * archive.cc (Archive::interpret_header): Make into a const member
2669 function.
2670 (Archive::add_symbols): Call Input_objects::archive_start and
2671 archive_stop.
2672 (Archive::const_iterator): Define new class.
2673 (Archive::begin, Archive::end): New functions.
2674 (Archive::include_all_members): Rewrite to use iterator.
2675 (Archive::count_members): New function.
2676 * archive.h (class Archive): Update declarations.
2677 (Archive::filename): New function.
2678 * object.cc: Include "cref.h".
2679 (Sized_relobj::Sized_relobj): Initialize defined_count_.
2680 (Sized_relobj::do_get_global_symbol_counts): New function.
2681 (Input_objects::add_object): Add object to cross-referencer.
2682 (Input_objects::archive_start): New function.
2683 (Input_objects::archive_stop): New function.
2684 (Input_objects::print_symbol_counts): New function.
2685 * object.h: Declare Cref and Archive.
2686 (Object::get_global_symbol_counts): New function.
2687 (Object::do_get_global_symbol_counts): New pure virtual function.
2688 (class Sized_relobj): Add defined_count_ field. Update
2689 declarations.
2690 (class Input_objects): Add cref_ field. Update constructor.
2691 Update declarations.
2692 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
2693 defined_count_.
2694 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
2695 symbol counts.
2696 (Sized_dynobj::do_get_global_symbol_counts): New function.
2697 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
2698 defined_count_. Update declarations. Define Symbols typedef.
2699 * symtab.cc (Symbol_table::add_from_relobj): Add defined
2700 parameter. Change all callers.
2701 (Symbol_table::add_from_dynobj): Add sympointers and defined
2702 parameters. Change all callers.
2703 * symtab.h (class Symbol_table): Update declarations.
2704 * Makefile.am (CCFILES): Add cref.cc.
2705 (HFILES): Add cref.h.
2706 * Makefile.in: Rebuild.
2707
2708 2008-07-22 Simon Baldwin <simonb@google.com>
2709
2710 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
2711 to zero when writing undefined symbols.
2712
2713 2008-07-22 Ian Lance Taylor <iant@google.com>
2714
2715 * output.cc (Output_section::add_input_section): Don't try to
2716 merge empty merge sections.
2717
2718 2008-07-21 Craig Silverstein <csilvers@google.com>
2719
2720 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2721 Include symbol version in error message.
2722
2723 2008-07-20 Chris Demetriou <cgd@google.com>
2724
2725 * configure.ac (gold_cv_c_random_seed): New configured variable.
2726 (RANDOM_SEED_CFLAGS): New substituted variable.
2727 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
2728 * configure: Rebuild.
2729 * Makefile.in: Likewise.
2730 * testsuite/Makefile.in: Likewise.
2731
2732 2008-07-18 Ian Lance Taylor <iant@google.com>
2733
2734 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
2735 where we see NAME/NULL and NAME/VERSION as separate symbols.
2736 * testsuite/ver_test_main.cc (main): Call t4.
2737 (t4, t4_2a): Define.
2738 * testsuite/ver_test_2.cc (t4_2): Define.
2739 * testsuite/ver_test_2.script: Put t4_2a in VER2.
2740 * testsuite/ver_test_4.cc (t4_2a): Define.
2741 * testsuite/ver_test_4.script: Put t4_2a in VER2.
2742 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
2743
2744 2008-07-17 Ian Lance Taylor <iant@google.com>
2745
2746 * dynobj.cc (Versions::add_def): If we give an error about a
2747 missing version, go ahead and create the version anyhow.
2748
2749 2008-07-10 Ian Lance Taylor <iant@google.com>
2750
2751 Handle output sections with more than 0x7fffffff bytes.
2752 * object.h (class Relobj): Change map_to_output_ to
2753 output_sections_, and just keep a section pointer. Change all
2754 uses. Move comdat group support to Sized_relobj.
2755 (Relobj::is_section_specially_mapped): Remove.
2756 (Relobj::output_section): Remove poff parameter. Change all
2757 callers.
2758 (Relobj::output_section_offset): New function.
2759 (Relobj::set_section_offset): Rewrite.
2760 (Relobj::map_to_output): Remove.
2761 (Relobj::output_sections): New function.
2762 (Relobj::do_output_section_offset): New pure virtual function.
2763 (Relobj::do_set_section_offset): Likewise.
2764 (class Sized_relobj): Add section_offsets_ field. Add comdat
2765 group support from Relobj. Update declarations.
2766 (Sized_relobj::get_output_section_offset): New function.
2767 (Sized_relobj::do_output_section_offset): New function.
2768 (Sized_relobj::do_set_section_offset): New function.
2769 * object.cc (Relobj::output_section_address): Remove.
2770 (Sized_relobj::Sized_relobj): Initialize new fields.
2771 (Sized_relobj::include_section_group): Cast find_kept_object to
2772 Sized_relobj.
2773 (Sized_relobj::include_linkonce_section): Likewise.
2774 (Sized_relobj::do_layout): Use separate arrays for output section
2775 and output offset.
2776 (Sized_relobj::do_count_local_symbols): Change map_to_output to
2777 output_sections.
2778 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
2779 output_sections and section_offsets.
2780 (Sized_relobj::write_local_symbols): Likewise.
2781 (map_to_kept_section): Compute output address directly.
2782 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
2783 output_sections and section_offsets.
2784 (Sized_relobj::write_sections): Likewise.
2785 (Sized_relobj::relocate_sections): Likewise.
2786 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
2787 * output.h (class Output_reloc): Update declarations. Change
2788 u2_.relobj to Sized_relobj*.
2789 (class Output_data_reloc): Change add functions to use
2790 Sized_relobj*.
2791 * output.cc (Output_reloc::Output_reloc): Change relobj to
2792 Sized_relobj*.
2793 (Output_reloc::local_section_offset): Change return type to
2794 Elf_Addr. Use get_output_section_offset.
2795 (Output_reloc::get_address): Likewise.
2796 (Output_section::is_input_address_mapped): Don't call
2797 is_section_specially_mapped.
2798 (Output_section::output_offset): Likewise.
2799 (Output_section::output_address): Likewise.
2800 (Output_section::starting_output_address): Likewise.
2801 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
2802 parameter to Sized_relobj*.
2803 (Copy_relocs::need_copy_reloc): Likewise.
2804 (Copy_relocs::save): Likewise.
2805 * copy-relocs.h (class Copy_relocs): Update declarations.
2806 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
2807 Sized_relobj*. Change relobj_ field to Sized_relobj*.
2808 * target-reloc.h (relocate_for_relocatable): Change
2809 offset_in_output_section type to Elf_Addr. Change code that uses
2810 it as well.
2811 * layout.cc (Layout::layout): Always set *off.
2812 * mapfile.cc (Mapfile::print_input_section): Use
2813 output_section_offset.
2814 * i386.cc (Target_i386::copy_reloc): Change object parameter to
2815 Sized_relobj*.
2816 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
2817 * sparc.cc (Target_sparc::copy_reloc): Likewise.
2818 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
2819
2820 2008-07-03 Ian Lance Taylor <iant@google.com>
2821
2822 * layout.cc (Layout::include_section): Do not discard unrecognized
2823 SHT_STRTAB sections.
2824
2825 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
2826
2827 * script.cc (Lex::can_continue_name): Make '?' allowable in
2828 version-script names.
2829 * testsuite/version_script.map: Change glob pattern to use '?'
2830
2831 2008-06-30 Manish Singh <yosh@gimp.org>
2832
2833 PR 6585
2834 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
2835 Correct typo.
2836
2837 2008-06-30 Ian Lance Taylor <iant@google.com>
2838
2839 PR 6660
2840 PR 6682
2841 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
2842 versions]: Don't try to read the value in the contents, since we
2843 don't use it. Use the template endianness when writing.
2844
2845 2008-06-25 Cary Coutant <ccoutant@google.com>
2846
2847 * fileread.cc (File_read::make_view): Assert on zero-length view.
2848 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
2849 symbol table when there are no symbols to read.
2850
2851 2008-06-23 Craig Silverstein <csilvers@google.com>
2852
2853 * version.cc (version_string): Bump to 1.7
2854
2855 2008-06-18 Craig Silverstein <csilvers@google.com>
2856
2857 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
2858 constant 0xFFFF to type Valtype.
2859 (Powerpc_relocate_functions::rel16_ha): Likewise.
2860
2861 2008-06-17 Ian Lance Taylor <iant@google.com>
2862
2863 * output.h (Output_section::Input_section): Initialize p2align_ to
2864 zero for Output_section_data constructors.
2865 (Output_section::Input_section::addralign): If not an input
2866 section, return the alignment of the Output_section_data.
2867 * testsuite/copy_test.cc: New file.
2868 * testsuite/copy_test_1.cc: New file.
2869 * testsuite/copy_test_2.cc: New file.
2870 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
2871 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
2872 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
2873 (copy_test_1_pic.o, copy_test_1.so): New targets.
2874 (copy_test_2_pic.o, copy_test_2.so): New targets.
2875 * testsuite/Makefile.in: Rebuild.
2876
2877 * script-sections.cc (Script_sections::place_orphan): Initialize
2878 local variable exact.
2879
2880 2008-06-13 David Edelsohn <edelsohn@gnu.org>
2881
2882 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
2883
2884 2008-06-12 David Edelsohn <edelsohn@gnu.org>
2885 David S. Miller <davem@davemloft.net>
2886
2887 * powerpc.cc: New file.
2888 * Makefile.am (TARGETSOURCES): Add powerpc.cc
2889 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
2890 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
2891 * Makefile.in: Rebuild.
2892
2893 2008-06-09 Ian Lance Taylor <iant@google.com>
2894
2895 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
2896 <exception>.
2897 (throwing, orig_terminate): New static variables.
2898 (terminate_handler): New static function.
2899 (t2): Set terminate handler.
2900
2901 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
2902
2903 PR 6584
2904 * binary.cc (Binary_to_elf::sized_convert): Fix .data
2905 alignment.
2906
2907 2008-05-30 Cary Coutant <ccoutant@google.com>
2908
2909 * archive.cc (Archive::include_all_members) Correct to step
2910 over symbol table and extended name table in thin archives.
2911
2912 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
2913
2914 PR 6407
2915 * target-reloc.h (relocate_for_relocatable): Fix new_offset
2916 calculation.
2917
2918 2008-05-28 Caleb Howe <cshowe@google.com>
2919
2920 * reduced_debug_output.cc: New file.
2921 * reduced_debug_output.h: New file.
2922 * options.h (class General_options): Add --strip-debug-non-line.
2923 * options.cc (General_options::finalize): Add strip_debug_non_line
2924 to the strip heirarchy.
2925 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
2926 fields.
2927 * layout.cc: Include "reduced_debug_output.h".
2928 (Layout::Layout): Initialize new fields.
2929 (line_only_debug_sections): New static array.
2930 (is_lines_only_debug_sections): New static inline function.
2931 (Layout::include_section): Handle --strip-debug-non-line.
2932 (Layout::make_output_section): If --strip-debug-non-line, build
2933 new output sections for .debug_abbrev and .debug_info.
2934 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
2935 gold. Warn about possible overflow.
2936 (read_signed_LEB_128): Likewise.
2937 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
2938 (read_signed_LEB_128): Declare.
2939 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
2940 (HFILES): Add reduced_debug_output.h.
2941 * Makefile.in: Rebuild.
2942
2943 2008-05-21 Ian Lance Taylor <iant@google.com>
2944
2945 * mapfile.cc: New file.
2946 * mapfile.h: New file.
2947 * options.h (class General_options): Add -M/--print-map and -Map.
2948 * options.cc (General_options::finalize): Make -M equivalent to
2949 -Map -.
2950 * main.cc: Include <cstdio> and "mapfile.h".
2951 (main): Open mapfile if requested.
2952 * gold.cc (class Middle_runner): Add mapfile_ field. Update
2953 constructor. Change caller.
2954 (queue_initial_tasks): Add mapfile parameter. Change caller.
2955 (queue_middle_tasks): Likewise.
2956 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
2957 declarations.
2958 * archive.cc: Include "mapfile.h".
2959 (Archive::add_symbols): Add mapfile parameter. Change all
2960 callers. Pass mapfile, symbol, and reason to include_member.
2961 (Archive::include_all_members): Add mapfile parameter. Change all
2962 callers.
2963 (Archive::include_member): Add mapfile, sym, and why parameters.
2964 Change all callers. Report inclusion to map file.
2965 * archive.h: Include "fileread.h".
2966 (class Archive): Update declarations.
2967 (Archive::file): New const method.
2968 (class Add_archive_symbols): Add mapfile_ field. Update
2969 constructor. Change all callers.
2970 * readsyms.h (class Read_symbols): Likewise.
2971 (class Finish_group): Likewise.
2972 (class Read_script): Likewise.
2973 * common.cc: Include "mapfile.h".
2974 (Symbol_table::allocate_commons): Add mapfile parameter. Change
2975 all callers.
2976 (Symbol_table::do_allocate_commons): Likewise.
2977 (Symbol_table::do_allocate_commons_list): Likewise. Report common
2978 symbol allocation to mapfile.
2979 * common.h (class Allocate_commons_task): Add mapfile_ field.
2980 Update constructor. Change all callers.
2981 * symtab.h (class Symbol_table): Update declarations.
2982 * layout.cc: Include "mapfile.h".
2983 (Layout_task_runner::run): Print information to mapfile.
2984 (Layout::create_gold_note): Change Output_data_fixed_space to
2985 Output_data_zero_fill.
2986 (Layout::create_build_id): Likewise.
2987 (Layout::print_to_mapfile): New function.
2988 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
2989 constructor. Change caller.
2990 (class Layout): Declare print_to_mapfile.
2991 * output.cc (Output_section::Input_section::print_to_mapfile): New
2992 function.
2993 (Output_section::add_input_section): If producing a map, always
2994 add to input_sections_ list.
2995 (Output_section::do_print_to_mapfile): New function.
2996 (Output_segment::print_sections_to_mapfile): New function.
2997 (Output_segment::print_section_list_to_mapfile): New function.
2998 * output.h: Include "mapfile.h".
2999 (Output_data::print_to_mapfile): New function.
3000 (Output_data::do_print_to_mapfile): New virtual function.
3001 (Output_segment_headers::do_print_to_mapfile): New function.
3002 (Output_file_header::do_print_to_mapfile): New function.
3003 (Output_data_const::do_print_to_mapfile): New function.
3004 (class Output_data_const_buffer): Add map_name_ field. Update
3005 constructor. Change all callers. Add do_print_to_mapfile
3006 function.
3007 (class Output_data_fixed_space): Likewise.
3008 (class Output_data_space): Likewise.
3009 (class Output_data_zero_fill): New class.
3010 (Output_data_strtab::do_print_to_mapfile): New function.
3011 (Output_data_reloc_base::do_print_to_mapfile): New function.
3012 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3013 (Output_data_group::do_print_to_mapfile): New function.
3014 (Output_data_got::do_print_to_mapfile): New function.
3015 (Output_data_dynamic::do_print_to_mapfile): New function.
3016 (Output_symtab_xindex::do_print_to_mapfile): New function.
3017 (class Output_section): Declare do_print_to_mapflie. Declare
3018 print_to_mapfile in Input_section.
3019 (class Output_segment): Declare new functions.
3020 * object.h (Sized_relobj::symbol_count): New function.
3021 * script-sections.cc
3022 (Output_section_element_dot_assignment::set_section_addresses):
3023 Change Output_data_fixed_space to Output_data_zero_fill.
3024 (Output_data_expression::do_print_to_mapfile): New function.
3025 * script.cc (read_input_script): Add mapfile parameter. Change
3026 all callers.
3027 * script.h (read_input_script): Update declaration.
3028 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
3029 (Eh_frame::do_print_to_mapfile): New function.
3030 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
3031 (Output_merge_string::do_print_to_mapfile): New function.
3032 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
3033 function.
3034 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
3035 function.
3036 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
3037 function.
3038 * Makefile.am (CCFILES): Add mapfile.cc.
3039 (HFILES): Add mapfile.h.
3040 * Makefile.in: Rebuild.
3041
3042 2008-05-19 Ian Lance Taylor <iant@google.com>
3043
3044 * options.h (class General_options): Add -z relro.
3045 * layout.cc (Layout::Layout): Initialize relro_segment_.
3046 (Layout::add_output_section_data): Return the output section.
3047 (Layout::make_output_section): Rcognize relro sections and mark
3048 them appropriately.
3049 (Layout::attach_allocated_section_to_segment): Put relro sections
3050 in a PT_GNU_RELRO segment.
3051 (Layout::create_initial_dynamic_sections): Mark the .dynamic
3052 section as relro.
3053 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
3054 PT_TLS segments.
3055 (Layout::linkonce_mapping): Map d.rel.ro.local to
3056 .data.rel.ro.local.
3057 (Layout::output_section_name): Us .data.rel.ro.local for any
3058 section which begins with that.
3059 * layout.h (class Layout): Update add_output_section_data
3060 declaration. Add relro_segment_ field.
3061 * output.cc (Output_section::Output_section): Initialize is_relro_
3062 and is_relro_local_ fields.
3063 (Output_segment::add_output_section): Group relro sections.
3064 (Output_segment::is_first_section_relro): New function.
3065 (Output_segment::maximum_alignment): If there is a relro section,
3066 align the segment to the common page size.
3067 (Output_segment::set_section_addresses): Track whether we are
3068 looking at relro sections. If the last section is a relro
3069 section, align to the common page size.
3070 (Output_segment::set_section_list_addresses): Add in_relro
3071 parameter. Change all callers. Align to the page size when
3072 moving from relro to non-relro section.
3073 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
3074 segment.
3075 * output.h (class Output_section): Add is_relro_ and
3076 is_relro_local_ fields.
3077 (Output_section::is_relro): New function.
3078 (Output_section::set_is_relro): New function.
3079 (Output_section::is_relro_local): New function.
3080 (Output_section::set_is_relro_local): New function.
3081 (class Output_segment): Update declarations.
3082 * i386.cc (Target_i386::got_section): Mark .got section as relro.
3083 * sparc.cc (Target_sparc::got_section): Likewise.
3084 * x86_64.cc (Target_x86_64::got_section): Likewise.
3085 * testsuite/relro_test_main.cc: New file.
3086 * testsuite/relro_test.cc: New file.
3087 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
3088 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
3089 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
3090 (relro_test.so, relro_test_pic.o): New targets.
3091 * testsuite/Makefile.in: Rebuild.
3092
3093 2008-05-16 Ian Lance Taylor <iant@google.com>
3094
3095 * output.cc (Output_segment::add_output_section): Remove front
3096 parameter.
3097 * output.h (class Output_segment): Remove
3098 add_initial_output_section and overloaded add_output_section.
3099 Update declaration of remaining add_output_section.
3100 * layout.cc (Layout::create_interp): Call add_output_section
3101 rather than add_initial_output_section.
3102 (Layout::finish_dynamic_section): Likewise.
3103
3104 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
3105 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
3106 know the dynamic type.
3107 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
3108 field. Initialize it in constructor.
3109 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
3110 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
3111 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
3112 reloc.
3113
3114 * output.cc (Output_reloc::get_address): Change return type to
3115 Elf_Addr.
3116 * output.h (class Output_reloc): Update get_address declaration.
3117 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
3118 for section addresses.
3119
3120 2008-05-09 Ian Lance Taylor <iant@google.com>
3121
3122 PR 6493
3123 * gold.cc (gold_nomem): Use return value of write.
3124
3125 2008-05-08 Ian Lance Taylor <iant@google.com>
3126
3127 * symtab.c (Symbol::init_base_output_data): Add version
3128 parameter. Change all callers.
3129 (Symbol::init_base_output_segment): Likewise.
3130 (Symbol::init_base_constant): Likewise.
3131 (Symbol::init_base_undefined): Likewise.
3132 (Sized_symbol::init_output_data): Likewise.
3133 (Sized_symbol::init_output_segment): Likewise.
3134 (Sized_symbol::init_constant): Likewise.
3135 (Sized_symbol::init_undefined): Likewise.
3136 (Symbol_table::do_define_in_output_data): If the new symbol has a
3137 version, mark it as the default.
3138 (Symbol_table::do_define_in_output_segment): Likewise.
3139 (Symbol_table::do_define_as_constant): Likewise.
3140 * symtab.h (class Symbol): Update declarations.
3141 (class Sized_symbol): Likewise.
3142 * resolve.cc (Symbol::override_version): New function.
3143 (Symbol::override_base): Call override_version.
3144 (Symbol::override_base_with_special): Likewise.
3145 * testsuite/ver_script_8.script: New file.
3146 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
3147 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
3148 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
3149 (ver_test_8_1.so, ver_test_8_2.so): New targets.
3150
3151 2008-05-06 Ian Lance Taylor <iant@google.com>
3152
3153 PR 6049
3154 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
3155 functions.
3156 (class General_options): Remove existing --undefined, and add
3157 --no-undefined instead. Add new --undefined as synonym for -u.
3158 * archive.cc (Archive::add_symbols): Check whether symbol was
3159 named with -u.
3160 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
3161 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
3162 all uses. Add IS_UNDEFINED. Update declarations to split
3163 different versions of init_base. Declare init_base_undefined.
3164 (Symbol::is_defined): Handle IS_UNDEFINED.
3165 (Symbol::is_undefined): Likewise.
3166 (Symbol::is_weak_undefined): Call is_undefined.
3167 (Symbol::is_absolute): Handle IS_CONSTANT.
3168 (class Sized_symbol): Update declarations to split different
3169 versions of init. Declare init_undefined.
3170 (class Symbol_table): Declare new functions.
3171 * symtab.cc (Symbol::init_base_object): Rename from init_base.
3172 Change all callers.
3173 (Symbol::init_base_output_data): Likewise.
3174 (Symbol::init_base_output_segment): Likewise.
3175 (Symbol::init_base_constant): Likewise.
3176 (Symbol::init_base_undefined): New function.
3177 (Sized_symbol::init_object): Rename from init. Change all
3178 callers.
3179 (Sized_symbol::init_output_data): Likewise.
3180 (Sized_symbol::init_output_segment): Likewise.
3181 (Sized_symbol::init_constant): Likewise.
3182 (Sized_symbol::init_undefined): New function.
3183 (Symbol_table::add_undefined_symbols_from_command_line): New
3184 function.
3185 (Symbol_table::do_add_undefined_symbols_from_command_line): New
3186 function.
3187 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
3188 (Symbol::output_section): Likewise.
3189 (Symbol::set_output_section): Likewise.
3190 (Symbol_table::sized_finalize_symbol): Likewise.
3191 (Symbol_table::sized_write_globals): Likewise.
3192 * resolve.cc (Symbol_table::should_override): Likewise.
3193 (Symbol::override_base_with_special): Likewise.
3194
3195 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
3196 symbol, change it to have default visibility.
3197 * testsuite/protected_1.cc: New file.
3198 * testsuite/protected_2.cc: New file.
3199 * testsuite/protected_3.cc: New file.
3200 * testsuite/protected_main_1.cc: New file.
3201 * testsuite/protected_main_2.cc: New file.
3202 * testsuite/protected_main_3.cc: New file.
3203 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
3204 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
3205 (protected_1_LDFLAGS, protected_1_LDADD): Define.
3206 (protected_1.so): New target.
3207 (protected_1_pic.o, protected_2_pic.o): New targets.
3208 (protected_3_pic.o): New target.
3209 (check_PROGRAMS): Add protected_2.
3210 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
3211 (protected_2_LDFLAGS, protected_2_LDADD): Define.
3212 * testsuite/Makefile.in: Rebuild.
3213
3214 * options.h (DEFINE_var): Add set_user_set_##varname__.
3215 (DEFINE_bool_alias): New macro.
3216 (class General_options): Define -Bstatic using DEFINE_bool_alias
3217 rather than DEFINE_special. Add --undefined as an alias for -z
3218 defs.
3219 * options.cc (General_options::parse_Bstatic): Remove.
3220
3221 * options.h (class General_options): Add --fatal-warnings.
3222 * main.cc (main): Implement --fatal-warnings.
3223 * errors.h (Errors::warning_count): New function.
3224
3225 * options.h (class General_options): Add -Bsymbolic-functions.
3226 * symtab.h (Symbol::is_preemptible): Check for
3227 -Bsymbolic-functions.
3228
3229 2008-05-05 Ian Lance Taylor <iant@google.com>
3230
3231 * options.h (DEFINE_bool): For DASH_Z, create the negative option
3232 as noVARNAME rather than no-VARNAME.
3233 (class General_options): Add option -z combreloc.
3234 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
3235 get_address.
3236 (Output_reloc::sort_before) [SHT_REL]: New function.
3237 (Output_reloc::sort_before) [SHT_RELA]: New function.
3238 (class Output_data_reloc_base): Add sort_relocs_ field. Define
3239 Sort_relocs_comparison.
3240 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
3241 parameter. Change all callers.
3242 (Output_data_reloc::Output_data_reloc) [both versions]: Add
3243 sort_relocs parameter. Change all callers.
3244 * output.cc (Output_reloc::get_address): New function, broken out
3245 of write_rel.
3246 (Output_reloc::write_rel): Call it.
3247 (Output_reloc::compare): New function.
3248 (Output_data_reloc_base::do_write): Optionally sort relocs.
3249
3250 * configure.ac: If targ_extra_obj is set, link it in.
3251 * configure.tgt: Initialize all variables.
3252 (x86_64*): Set targ_extra_obj and targ_extra_size.
3253 * configure: Rebuild.
3254
3255 * object.cc (Sized_relobj::include_section_group): Adjust section
3256 indexes read from group data. Build vector to pass to
3257 layout_group.
3258 * layout.cc (Layout::layout_group): Add flags and shndxes
3259 parameters. Remove contents parameter. Change caller. Update
3260 explicit instantiations.
3261 * layout.h (class Layout): Update layout_group declaration.
3262 * output.cc (Output_data_group::Output_data_group): Add flags and
3263 input_shndxes parameters. Remove contents parameter. Change
3264 caller.
3265 (Output_data_group::do_write): Change input_sections_ to
3266 input_shndxes_.
3267 * output.h (class Output_data_group): Update constructor
3268 declaration. Rename input_sections_ to input_shndxes_.
3269 * testsuite/many_sections_test.cc: Add template.
3270
3271 2008-04-30 Cary Coutant <ccoutant@google.com>
3272
3273 * target-reloc.h (relocate_section): Fix dead-pointer bug.
3274
3275 * layout.cc (Layout::include_section): Refactored check for debug
3276 info section.
3277 (Layout::add_comdat): Add new parameters. Change type
3278 of signature parameter. Add object and shndx to signatures table.
3279 (Layout::find_kept_object): New function.
3280 * layout.h: Include <cstring>.
3281 (Layout::is_debug_info_section): New function.
3282 (Layout::add_comdat): Add new parameters.
3283 (Layout::find_kept_object): New function.
3284 (Layout::Kept_section): New struct.
3285 (Layout::Signatures): Change type of map range.
3286 * object.cc (Relobj::output_section_address): New function.
3287 (Sized_relobj::include_section_group): Add new parameters. Change
3288 calls to Layout::add_comdat. Change to build table of kept comdat
3289 groups and table mapping discarded sections to kept sections.
3290 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
3291 (Sized_relobj::do_layout): Change calls to include_section_group and
3292 include_linkonce_section.
3293 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
3294 value to zero when section is discarded.
3295 (Sized_relobj::map_to_kept_section): New function.
3296 * object.h (Relobj::output_section_address): New function.
3297 (Relobj::Comdat_group): New type.
3298 (Relobj::find_comdat_group): New function.
3299 (Relobj::Comdat_group_table): New type.
3300 (Relobj::Kept_comdat_section): New type.
3301 (Relobj::Kept_comdat_section_table): New type.
3302 (Relobj::add_comdat_group): New function.
3303 (Relobj::set_kept_comdat_section): New function.
3304 (Relobj::get_kept_comdat_section): New function.
3305 (Relobj::comdat_groups_): New field.
3306 (Relobj::kept_comdat_sections_): New field.
3307 (Symbol_value::input_value): Update comment.
3308 (Sized_relobj::map_to_kept_section) New function.
3309 (Sized_relobj::include_linkonce_section): Add new parameter.
3310 * target-reloc.h (Comdat_behavior): New type.
3311 (get_comdat_behavior): New function.
3312 (relocate_section): Add code to map a discarded section to the
3313 corresponding kept section when applying a relocation.
3314
3315 2008-04-30 Craig Silverstein <csilvers@google.com>
3316
3317 * dwarf_reader.cc (next_generation_count): New static var.
3318 (Addr2line_cache_entry): New struct.
3319 (addr2line_cache): New static var.
3320 (Dwarf_line_info::one_addr2line): Added caching.
3321 (Dwarf_line_info::clear_addr2line_cache): New function.
3322 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
3323 cache-size parameter.
3324 (Dwarf_line_info::one_addr2line_cache): New function.
3325 * symtab.cc (Symbol_table::detect_odr_violations): Pass
3326 new cache-size argument to one_addr2line(), and clear cache.
3327
3328 2008-04-28 Cary Coutant <ccoutant@google.com>
3329
3330 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
3331 R_386_PC8 relocations.
3332
3333 2008-04-23 Ian Lance Taylor <iant@google.com>
3334
3335 * object.cc (Sized_relobj::include_section_group): Check for
3336 invalid section group.
3337
3338 * object.cc (make_elf_object): Correct test for 64-bit ELF file
3339 header size.
3340
3341 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
3342 than read for file header.
3343 * archive.cc (Archive::include_member): Likewise.
3344
3345 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
3346
3347 * aclocal.m4: Regenerate.
3348 * configure: Regenerate.
3349
3350 2008-04-19 Ian Lance Taylor <iant@google.com>
3351
3352 * version.cc (version_string): Bump to 1.6.
3353
3354 * testsuite/Makefile.am (many_sections_r_test): New target.
3355 (many_sections_r_test_SOURCES): Remove.
3356 (many_sections_r_test_DEPENDENCIES): Remove.
3357 (many_sections_r_test_LDFLAGS): Remove.
3358 (many_sections_r_test_LDADD): Remove.
3359
3360 * object.cc (Sized_relobj::do_add_symbols): Always pass
3361 local_symbol_count_ to add_from_relobj.
3362
3363 * testsuite/Makefile.am (many_sections_check.h): Only check one in
3364 every thousand variables.
3365 * testsuite/Makefile.in: Rebuild.
3366
3367 * object.cc (Xindex::initialize_symtab_xindex): New function.
3368 (Xindex::read_symtab_xindex): New function.
3369 (Xindex::sym_xindex_to_shndx): New function.
3370 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
3371 available.
3372 (Sized_relobj::do_initialize_xindex): New function.
3373 (Sized_relobj::do_read_symbols): Adjust section links.
3374 (Sized_relobj::symbol_section_and_value): Add is_ordinary
3375 parameter. Change all callers.
3376 (Sized_relobj::include_section_group): Adjust section links and
3377 symbol section indexes.
3378 (Sized_relobj::do_layout): Adjust section links.
3379 (Sized_relobj::do_count_local_symbols): Adjust section links and
3380 symbol section indexes.
3381 (Sized_relobj::do_finalize_local_symbols): Distinguish between
3382 ordinary and special symbols.
3383 (Sized_relobj::write_local_symbols): Add symtab_xindex and
3384 dynsym_xindex parameters. Change all callers. Adjust section
3385 links. Use SHN_XINDEX when needed.
3386 (Sized_relobj::get_symbol_location_info): Adjust section links.
3387 Don't get fooled by special symbols.
3388 * object.h (class Xindex): Define.
3389 (class Object): Add xindex_ parameter. Declare virtual functoin
3390 do_initialize_xindex.
3391 (Object::adjust_sym_shndx): New function.
3392 (Object::set_xindex): New protected function.
3393 (class Symbol_value): Add is_ordinary_shndx_ field.
3394 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
3395 (Symbol_value::value): Assert ordinary section.
3396 (Symbol_value::initialize_input_to_output_map): Likewise.
3397 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
3398 Change all callers.
3399 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
3400 all callers.
3401 (class Sized_relobj): Update declarations.
3402 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
3403 parameter. Change all callers.
3404 (Sized_relobj::adjust_shndx): New function.
3405 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
3406 field.
3407 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
3408 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
3409 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
3410 (Sized_dynobj::read_dynsym_section): Adjust section links.
3411 (Sized_dynobj::read_dynamic): Likewise.
3412 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
3413 section links.
3414 (Sized_dynobj::do_initialize_xindex): New function.
3415 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
3416 do_initialize_xindex.
3417 (Sized_dynobj::adjust_shndx): New function.
3418 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
3419 dynsym_xindex_ fields.
3420 (Layout::finalize): Add a call to set_section_indexes before
3421 creating the symtab sections.
3422 (Layout::set_section_indexes): Don't do anything if the section
3423 already has a section index.
3424 (Layout::create_symtab_sections): Add shnum parameter. Change
3425 caller. Create .symtab_shndx section if needed.
3426 (Layout::create_shdrs): Add shstrtab_section parameter. Change
3427 caller.
3428 (Layout::allocated_output_section_count): New function.
3429 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
3430 needed.
3431 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
3432 fields. Update declarations.
3433 (Layout::symtab_xindex): New function.
3434 (Layout::dynsym_xindex): New function.
3435 (class Write_symbols_task): Add layout_ field.
3436 (Write_symbols_task::Write_symbols_task): Add layout parameter.
3437 Change caller.
3438 * output.cc (Output_section_headers::Output_section_headers): Add
3439 shstrtab_section parameter. Change all callers.
3440 (Output_section_headers::do_sized_write): Store overflow values
3441 for section count and section string table section index in
3442 section header zero.
3443 (Output_file_header::do_sized_write): Check for overflow of
3444 section count and section string table section index.
3445 (Output_symtab_xindex::do_write): New function.
3446 (Output_symtab_xindex::endian_do_write): New function.
3447 * output.h (class Output_section_headers): Add shstrtab_section_.
3448 Update declarations.
3449 (class Output_symtab_xindex): Define.
3450 (Output_section::has_out_shndx): New function.
3451 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
3452 field.
3453 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
3454 Change all callers.
3455 (Sized_symbol::init): Likewise.
3456 (Symbol::output_section): Check for ordinary symbol.
3457 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
3458 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
3459 callers.
3460 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
3461 Change all callers. Simplify handling of symbols from sections
3462 not included in the link.
3463 (Symbol_table::add_from_dynobj): Handle ordinary symbol
3464 distinction.
3465 (Weak_alias_sorter::operator()): Assert that symbols are
3466 ordinary.
3467 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
3468 distinction.
3469 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
3470 parameters. Change all callers.
3471 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
3472 symbol distinction. Use SHN_XINDEX when needed.
3473 (Symbol_table::write_section_symbol): Add symtab_xindex
3474 parameter. Change all callers.
3475 (Symbol_table::sized_write_section_symbol): Likewise. Use
3476 SHN_XINDEX when needed.
3477 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
3478 declarations.
3479 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
3480 (Symbol::is_defined): Check is_ordinary.
3481 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
3482 (Symbol::is_absolute, Symbol::is_common): Likewise.
3483 (class Sized_symbol): Update declarations.
3484 (class Symbol_table): Update declarations.
3485 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
3486 parameters. Change all callers.
3487 (Sized_symbol::override): Likewise.
3488 (Symbol_table::override): Likewise.
3489 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
3490 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
3491 is_ordinary, and orig_st_shndx parameters. Change all callers.
3492 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
3493 to be in an ordinary section.
3494 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
3495 object and is_ordinary parameters. Change all callers.
3496 (Sized_dwarf_line_info::read_relocs): Add object parameter.
3497 Change all callers. Don't add undefined or non-ordinary symbols
3498 to reloc_map_.
3499 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
3500 Change all callers.
3501 * dwarf_reader.h (class Sized_dwarf_line_info): Update
3502 declarations.
3503 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
3504 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
3505 (Sized_relobj::relocate_sections): Likewise.
3506 * target-reloc.h (scan_relocs): Adjust section symbol index.
3507 (scan_relocatable_relocs): Likewise.
3508 * i386.cc (Scan::local): Check for ordinary symbols.
3509 * sparc.cc (Scan::local): Likewise.
3510 * x86_64.cc (Scan::local): Likewise.
3511 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
3512 to symbol_section_and_value.
3513 * testsuite/many_sections_test.cc: New file.
3514 * testsuite/Makefile.am (BUILT_SOURCES): Define.
3515 (check_PROGRAMS): Add many_sections_test.
3516 (many_sections_test_SOURCES): Define.
3517 (many_sections_test_DEPENDENCIES): Define.
3518 (many_sections_test_LDFLAGS): Define.
3519 (BUILT_SOURCES): Add many_sections_define.h.
3520 (many_sections_define.h): New target.
3521 (BUILT_SOURCES): Add many_sections_check.h.
3522 (many_sections_check.h): New target.
3523 (check_PROGRAMS): Add many_sections_r_test.
3524 (many_sections_r_test_SOURCES): Define.
3525 (many_sections_r_test_DEPENDENCIES): Define.
3526 (many_sections_r_test_LDFLAGS): Define.
3527 (many_sections_r_test_LDADD): Define.
3528 (many_sections_r_test.o): New target.
3529 * testsuite/Makefile.in: Rebuild.
3530
3531 2008-04-17 Cary Coutant <ccoutant@google.com>
3532
3533 * errors.cc (Errors::info): New function.
3534 (gold_info): New function.
3535 * errors.h (Errors::info): New function.
3536 * gold.h (gold_info): New function.
3537 * object.cc (Input_objects::add_object): Print trace output.
3538 * options.cc (options::parse_set): New function.
3539 (General_options::parse_wrap): Deleted.
3540 (General_options::General_options): Deleted initializer.
3541 * options.h (options::String_set): New typedef.
3542 (options::parse_set): New function.
3543 (DEFINE_set): New macro.
3544 (General_options::wrap): Changed to use DEFINE_set. Changed
3545 callers of any_wrap_symbols and is_wrap_symbol.
3546 (General_options::trace, General_options::trace_symbol):
3547 New options.
3548 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
3549 (General_options::wrap_symbols_): Deleted.
3550 * symtab.cc (Symbol_table::add_from_object): Print trace output.
3551
3552 2008-04-17 David S. Miller <davem@davemloft.net>
3553
3554 * options.cc (General_options::parse_V): New function.
3555 * options.h: Add entries for -V and -Qy.
3556
3557 2008-04-17 Ian Lance Taylor <iant@google.com>
3558
3559 * common.cc (Symbol_table::allocate_commons): Remove options
3560 parameter. Change caller.
3561 (Symbol_table::do_allocate_commons): Remove options parameter.
3562 Change caller. Just call do_allocate_commons_list twice.
3563 (Symbol_table::do_allocate_commons_list): New function, broken out
3564 of do_allocate_commons.
3565 * common.h (class Allocate_commons_task): Remove options_ field.
3566 Update constructor.
3567 * symtab.cc (Symbol_table::Symbol_table): Initialize
3568 tls_commons_.
3569 (Symbol_table::add_from_object): Put TLS common symbols on
3570 tls_commons_ list.
3571 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
3572 which are IN_OUTPUT_DATA.
3573 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
3574 allocate_commons and do_allocate_commons declarations. Declare
3575 do_allocate_commons_list.
3576 * gold.cc (queue_middle_tasks): Update creation of
3577 Allocate_commons_task to not pass options.
3578 * testsuite/Makefile.am (INCLUDES): Add -I.. .
3579 (TLS_TEST_C_FLAGS): New variable.
3580 (tls_test_c_pic.o): New target.
3581 (tls_test_shared.so): Link in tls_test_c_pic.o.
3582 (tls_test_c_pic_ie.o): New target.
3583 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
3584 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
3585 (tls_test_c.o): New target.
3586 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
3587 (tls_pic_test_LDADD): Likewise.
3588 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
3589 (tls_shared_gd_to_ie_test_LDADD): Likewise.
3590 (tls_test_c_gnu2.o): New target.
3591 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
3592 tls_test_c_gnu2.o.
3593 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
3594 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
3595 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
3596 * testsuite/tls_test.cc: Include "config.h".
3597 (t_last): Call t11_last.
3598 * testsuite/tls_test.h (t11, t11_last): Declare.
3599 * testsuite/tls_test_c.c: New file.
3600 * testsuite/tls_test_main.cc (thread_routine): Call t11.
3601 * configure.ac: Check for OpenMP support.
3602 * configure, config.in, Makefile.in: Rebuild.
3603 * testsuite/Makefile.in: Rebuild.
3604
3605 2008-04-16 Cary Coutant <ccoutant@google.com>
3606
3607 * i386.cc (Target_i386::define_tls_base_symbol): New function.
3608 (Target_i386::tls_base_symbol_defined_): New field.
3609 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
3610 (Target_i386::Scan::global): Likewise.
3611 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
3612 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
3613 (Target_x86_64::tls_base_symbol_defined_): New field.
3614 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
3615 (Target_x86_64::Scan::global): Likewise.
3616
3617 2008-04-16 Cary Coutant <ccoutant@google.com>
3618
3619 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
3620 (Symbol::needs_plt_entry): Allow weak undefined symbols.
3621 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
3622 building shared libraries.
3623 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
3624 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
3625 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
3626 * testsuite/Makefile.in: Rebuild.
3627 * testsuite/weak_undef.h: New file.
3628 * testsuite/weak_undef_file1.cc: Add extra test cases.
3629 * testsuite/weak_undef_file2.cc: Likewise.
3630 * testsuite/weak_undef_test.cc: Likewise.
3631
3632 2008-04-16 David S. Miller <davem@davemloft.net>
3633
3634 * sparc.cc (Target_sparc::Scan): Change from struct to class.
3635 Add issued_non_pic_error_ field. Declare check_non_pic.
3636 (Target_sparc::Scan::check_non_pic): New function.
3637 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
3638 (Target_sparc::Scan::global): Likewise.
3639
3640 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
3641 * configure: Rebuild.
3642
3643 * options.h (DEFINE_enable): New macro.
3644 (new_dtags): New enable option.
3645 (initfirst, interpose, loadfltr, nodefaultlib,
3646 nodelete, nodlopen, nodump): New -z options.
3647 * layout.cc (Layout:finish_dynamic_section): If new
3648 dtags enabled, emit DT_RUNPATH. Also, emit a
3649 DT_FLAGS_1 containing any specified -z flags.
3650
3651 2008-04-16 Ian Lance Taylor <iant@google.com>
3652
3653 * copy-relocs.cc: New file.
3654 * copy-relocs.h: New file.
3655 * reloc.cc: Remove Copy_relocs code.
3656 * reloc.h: Likewise.
3657 * reloc-types.h (struct Reloc_types) [both versions]: Add
3658 get_reloc_addend_noerror.
3659 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
3660 variants of add_global which take an addend which must be zero.
3661 * i386.cc: Include "copy-relocs.h".
3662 (class Target_i386): Change type of copy_relocs_ to variable,
3663 update initializer.
3664 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
3665 Change all callers.
3666 (Target_i386::do_finalize_sections): Change handling of
3667 copy_relocs_.
3668 * sparc.cc: Include "copy-relocs.h".
3669 (class Target_sparc): Change type of copy_relocs_ to variable,
3670 update initializer.
3671 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
3672 Change all callers.
3673 (Target_sparc::do_finalize_sections): Change handling of
3674 copy_relocs_.
3675 * x86_64.cc: Include "copy-relocs.h".
3676 (class Target_x86_64): Change type of copy_relocs_ to variable,
3677 update initializer.
3678 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
3679 class. Change all callers.
3680 (Target_x86_64::do_finalize_sections): Change handling of
3681 copy_relocs_.
3682 * Makefile.am (CCFILES): Add copy-relocs.cc.
3683 (HFILES): Add copy-relocs.h.
3684
3685 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
3686
3687 * testsuite/script_test_4.sh: Permit leading zeroes.
3688
3689 2008-04-15 Ian Lance Taylor <iant@google.com>
3690
3691 * script-sections.cc (Script_sections::create_segments): Use
3692 header_size_adjustment even when there is enough room for the
3693 headers.
3694 * testsuite/script_test_4.sh: New file.
3695 * testsuite/script_test_4.t: New file.
3696 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
3697 (check_DATA): Add script_test_4.stdout.
3698 (MOSTLYCLEANFILES): Likewise.
3699 (script_test_4): New target.
3700 (script_test_4.stdout): New target.
3701 * testsuite/Makefile.in: Rebuild.
3702
3703 * sparc.cc: Add definitions for Output_data_plt_sparc class
3704 constants.
3705
3706 2008-04-14 David S. Miller <davem@davemloft.net>
3707
3708 * sparc.cc: New file.
3709 * Makefile.am (TARGETSOURCES): Add sparc.cc
3710 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
3711 * configure.tgt: Document targ_extra_size and
3712 targ_extra_big_endian. Add entries for sparc-* and
3713 sparc64-*.
3714 * configure.ac: Handle targ_extra_size and
3715 targ_extra_big_endian.
3716 * Makefile.in: Rebuild.
3717 * configure: Likewise.
3718 * po/POTFILES.in: Likewise.
3719 * po/gold.pot: Likewise.
3720
3721 2008-04-14 Ian Lance Taylor <iant@google.com>
3722
3723 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
3724 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
3725 in the name/type/flags to section mapping. Don't call
3726 allocate_output_section.
3727 (Layout::choose_output_section): Change parameter from adjust_name
3728 to is_input_section. Don't permit input sections after sections
3729 are attached to segments. Don't call allocate_output_section.
3730 (Layout::layout_eh_frame): Call update_flags_for_input_section,
3731 not write_enable_output_section.
3732 (Layout::make_output_section): Don't push to
3733 unattached_section_list_ nor call attach_to_segment. Call
3734 attach_section_to_segment if sections are attached.
3735 (Layout::attach_sections_to_segments): New function.
3736 (Layout::attach_section_to_segment): New function.
3737 (Layout::attach_allocated_section_to_segment): Rename from
3738 attach_to_segment. Remove flags parameter.
3739 (Layout::allocate_output_section): Remove function.
3740 (Layout::write_enable_output_section): Remove function.
3741 * layout.h (class Layout): Update for above changes. Add new
3742 field sections_are_attached_.
3743 * output.h (Output_section::update_flags_for_input_section): New
3744 function.
3745 * output.cc (Output_section::add_input_section): Call
3746 update_flags_for_input_section.
3747 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
3748
3749 2008-04-11 Cary Coutant <ccoutant@google.com>
3750
3751 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
3752 thought unnecessary.
3753 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
3754
3755 2008-04-11 Ian Lance Taylor <iant@google.com>
3756
3757 * output.h (class Output_section_data): Remove inline definition
3758 of set_addralign.
3759 * output.cc (Output_section_data::set_addralign): New function.
3760
3761 2008-04-11 Cary Coutant <ccoutant@google.com>
3762
3763 Add support for TLS descriptors for i386 and x86_64.
3764 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
3765 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
3766 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
3767 GOT_TYPE_TLS_DESC.
3768 (Target_i386::got_mod_index_entry): Remove unnecessary code.
3769 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
3770 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
3771 relocations.
3772 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
3773 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
3774 Fix problem with initial-exec relocations.
3775 (Target_i386::Relocate::relocate_tls): Likewise.
3776 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
3777 relaxation.
3778 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
3779 support for section-plus-offset dynamic table entries.
3780 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
3781 (Output_data_dynamic::Dynamic_entry): Add support for
3782 section-plus-offset dynamic table entries.
3783 (Output_data_dynamic::Classification): Likewise.
3784 (Output_data_dynamic::classification_): Renamed offset_.
3785 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
3786 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
3787 (Target_x86_64::make_plt_section): New function.
3788 (Target_x86_64::reserve_tlsdesc_entries): New function.
3789 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
3790 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
3791 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
3792 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
3793 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
3794 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
3795 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
3796 add extra PLT entry for TLS descriptors.
3797 (Output_data_plt_x86_64::got_): New field.
3798 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
3799 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
3800 fields.
3801 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
3802 descriptors.
3803 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
3804 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
3805 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
3806 R_386_TLS_DESC_CALL relocations.
3807 (Target_x86_64::Scan::global): Likewise.
3808 (Target_x86_64::do_finalize_sections): Add dynamic table entries
3809 for TLS descriptors.
3810 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
3811 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
3812 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
3813 GD-to-IE relaxation.
3814 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
3815 and TLS_DESCRIPTORS.
3816 * Makefile.in: Rebuild.
3817 * configure: Rebuild.
3818 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
3819 (tls_test_shared2.so): New target.
3820 (tls_shared_gd_to_ie_test_SOURCES): New variable.
3821 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
3822 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
3823 (tls_shared_gd_to_ie_test_LDADD): New variable.
3824 (tls_shared_gnu2_gd_to_ie_test): New target.
3825 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
3826 New targets.
3827 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
3828 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
3829 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
3830 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
3831 (tls_shared_gnu2_test): New target.
3832 (tls_test_gnu2_shared.so): New target.
3833 (tls_shared_gnu2_test_SOURCES): New variable.
3834 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
3835 (tls_shared_gnu2_test_LDFLAGS): New variable.
3836 (tls_shared_gnu2_test_LDADD): New variable.
3837 * testsuite/Makefile.in: Rebuild.
3838 * testsuite/Makefile.
3839
3840 2008-04-11 Ian Lance Taylor <iant@google.com>
3841
3842 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
3843 justsyms.t.
3844 * testsuite/Makefile.in: Rebuild.
3845
3846 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
3847 long.
3848 * testsuite/script_test_2.cc (main): Adjust test.
3849
3850 2008-04-11 David S. Miller <davem@davemloft.net>
3851 Ian Lance Taylor <iant@google.com>
3852
3853 * options.h (General_options): Add entries for '-Y' and
3854 '-relax'.
3855 * options.cc (General_options:finalize): If -Y was used, add those
3856 entries to the library path instead of the default "/lib" and
3857 "/usr/lib".
3858
3859 2008-04-11 David S. Miller <davem@davemloft.net>
3860
3861 * testsuite/justsyms.t: Start at 0x100.
3862 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
3863 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
3864 long.
3865 * testsuite/script_test_2.cc: Adjust string and section length
3866 checks.
3867
3868 2008-04-09 Ian Lance Taylor <iant@google.com>
3869
3870 PR gold/5996
3871 * script-sections.cc (Sections_element::allocate_to_segment): Add
3872 orphan parameter.
3873 (Output_section_definition::allocate_to_segment): Likewise.
3874 (Orphan_output_section::allocate_to_segment): Likewise.
3875 (Script_sections::attach_sections_using_phdrs_clause): Don't
3876 propagate non-PT_LOAD segments to orphan sections.
3877 * testsuite/Makefile.am (script_test_3.stdout): Generate using
3878 readelf rather than objdump.
3879 * testsuite/script_test_3.sh: Adjust accordingly. Test that
3880 .interp section and PT_INTERP segment are the same size.
3881 * testsuite/Makefile.in: Rebuild.
3882
3883 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
3884 aliases for symbols defined in the same object.
3885 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
3886 (weak_alias_test_SOURCES): New variable.
3887 (weak_alias_test_DEPENDENCIES): New variable.
3888 (weak_alias_test_LDFLAGS): New variable.
3889 (weak_alias_test_LDADD): New variable.
3890 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
3891 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
3892 (weak_alias_test_3.o): New target.
3893 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
3894 * testsuite/weak_alias_test_main.cc: New file.
3895 * testsuite/weak_alias_test_1.cc: New file.
3896 * testsuite/weak_alias_test_2.cc: New file.
3897 * testsuite/weak_alias_test_3.cc: New file.
3898
3899 2008-04-08 Ian Lance Taylor <iant@google.com>
3900
3901 * options.h (class General_options): Add --noinhibit-exec option.
3902 * main.cc (main): Check --noinhibit-exec.
3903
3904 * options.h (class General_options): Define --wrap as a special
3905 option. Add wrap_symbols_ field.
3906 (General_options::any_wrap_symbols): New function.
3907 (General_options::is_wrap_symbol): New function.
3908 * options.cc (General_options::parse_wrap): New function.
3909 (General_options::General_options): Initialize wrap_symbols_.
3910 * symtab.cc (Symbol_table::wrap_symbol): New function.
3911 (Symbol_table::add_from_object): Handle --wrap.
3912 * symtab.h (class Symbol_table): Declare wrap_symbol.
3913 * target.h (Target::wrap_char): New function.
3914 (Target::Target_info): Add wrap_char field.
3915 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
3916 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3917 * testsuite/testfile.cc (Target_test::test_target_info):
3918 Likewise.
3919
3920 * errors.cc (Errors::undefined_symbol): Mention symbol version if
3921 there is one.
3922
3923 * layout.h (class Layout): Add added_eh_frame_data_ field.
3924 * layout.cc (Layout::Layout): Initialize new field.
3925 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
3926 output section until we find a section we merged successfully.
3927 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
3928 that the size be non-zero.
3929
3930 * merge.cc (Object_merge_map::get_output_offset): Remove inline
3931 qualifier.
3932
3933 2008-04-08 Craig Silverstein <csilvers@google.com>
3934
3935 * configure.ac: Export new conditional variable HAVE_ZLIB.
3936 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
3937 on HAVE_ZLIB.
3938 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
3939 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3940
3941 2008-04-07 Ian Lance Taylor <iant@google.com>
3942
3943 * version.cc (version_string): Set to "1.5".
3944
3945 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
3946 Add issued_non_pic_error_ field. Declare check_non_pic.
3947 (Target_x86_64::Scan::check_non_pic): New function.
3948 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
3949 (Target_x86_64::Scan::global): Likewise.
3950
3951 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
3952 addend parameter. Change caller. Handle merge sections.
3953 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
3954 Address to Addend. Don't add in the result of
3955 local_section_offset, pass down the addend and use the returned
3956 value.
3957 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
3958 Update declarations of local_section_offset and symbol_value.
3959 * testsuite/two_file_test_1.cc (t18): New function.
3960 * testsuite/two_file_test_2.cc (f18): New function.
3961 * testsuite/two_file_test_main.cc (main): Call t18.
3962 * testsuite/two_file_test.h (t18, f18): Declare.
3963
3964 * configure.ac: Don't test for objdump, c++filt, or readelf.
3965 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
3966 conditionals.
3967 (TEST_READELF): New variable.
3968 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
3969 (check_PROGRAMS): Add two_file_strip_test.
3970 (two_file_strip_test): New target.
3971 (check_PROGRAMS): Add two_file_same_shared_strip_test.
3972 (two_file_same_shared_strip_test_SOURCES): New variable.
3973 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
3974 (two_file_same_shared_strip_test_LDFLAGS): New variable.
3975 (two_file_same_shared_strip_test_LDADD): New variable.
3976 (two_file_shared_strip.so): New target.
3977 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
3978 (ver_test_5.syms, ver_test_7.syms): Likewise.
3979 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
3980 (strip_test_3.stdout): Use TEST_OBJDUMP.
3981 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3982
3983 2008-04-04 Cary Coutant <ccoutant@google.com>
3984
3985 * symtab.h (Symbol::is_weak_undefined): New function.
3986 (Symbol::is_strong_undefined): New function.
3987 (Symbol::is_absolute): New function.
3988 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
3989 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
3990 absolute symbols.
3991 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
3992 (weak_undef_test): New target.
3993 * testsuite/Makefile.in: Rebuild.
3994 * testsuite/weak_undef_file1.cc: New file.
3995 * testsuite/weak_undef_file2.cc: New file.
3996 * testsuite/weak_undef_test.cc: New file.
3997
3998 2008-04-03 Craig Silverstein <csilvers@google.com>
3999
4000 * compressed_output.h (class Output_compressed_section): Use
4001 unsigned buffer.
4002 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4003 add zlib header.
4004 (zlib_compressed_suffix): Removed.
4005 (Output_compressed_section::set_final_data_size): Use unsigned
4006 buffers.
4007 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4008 Fix linker invocation.
4009 (flagstest_o_specialfile_and_compress_debug_sections):
4010 Likewise.
4011 * testsuite/Makefile.in: Regenerated.
4012
4013 2008-04-02 David S. Miller <davem@davemloft.net>
4014
4015 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4016 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4017
4018 2008-04-02 Craig Silverstein <csilvers@google.com>
4019
4020 * TODO: New file.
4021
4022 2008-04-02 Ian Lance Taylor <iant@google.com>
4023
4024 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4025 parameters. Update for new key type to views_. Change all
4026 callers.
4027 (File_read::read): Adjust for byteshift in returned view.
4028 (File_read::add_view): New function, broken out of
4029 find_and_make_view.
4030 (File_read::make_view): New function, broken out of
4031 find_and_make_view.
4032 (File_read::find_or_make_view): Add offset and aligned
4033 parameters. Rewrite accordingly. Change all callers.
4034 (File_read::get_view): Add offset and aligned parameters. Adjust
4035 for byteshift in return value.
4036 (File_read::get_lasting_view): Likewise.
4037 * fileread.h (class File_read): Update declarations.
4038 (class File_read::View): Add byteshift_ field. Add byteshift to
4039 constructor. Add byteshift method.
4040 * archive.h (Archive::clear_uncached_views): New function.
4041 (Archive::get_view): Add aligned parameter. Change all callers.
4042 * object.h (Object::get_view): Add aligned parameter. Change all
4043 callers.
4044 (Object::get_lasting_view): Likewise.
4045
4046 * fileread.cc (File_read::release): Don't call clear_views if
4047 there are multiple objects.
4048 * fileread.h (File_read::clear_uncached_views): New function.
4049 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
4050 on the archive.
4051
4052 2008-03-31 Cary Coutant <ccoutant@google.com>
4053
4054 Add thin archive support.
4055 * archive.cc (Archive::armagt): New const.
4056 (Archive::setup): Remove task parameter and calls to unlock.
4057 (Archive::unlock_nested_archives): New function.
4058 (Archive::read_header): Add nested_off parameter. Change
4059 all callers.
4060 (Archive::interpret_header): Likewise.
4061 (Archive::include_all_members): Change to handle thin
4062 archives.
4063 (Archive::include_member): Likewise.
4064 * archive.h (Archive::Archive): Add new parameters and
4065 initializers.
4066 (Archive::armagt): New const.
4067 (Archive::setup): Remove task parameter.
4068 (Archive::unlock_nested_archives): New function.
4069 (Archive::read_header): Add nested_off parameter.
4070 (Archive::interpret_header): Likewise.
4071 (Archive::Nested_archive_table): New typedef.
4072 (Archive::is_thin_archive_): New field.
4073 (Archive::nested_archives_): New field.
4074 (Archive::options_): New field.
4075 (Archive::dirpath_): New field.
4076 (Archive::task_): New field.
4077 * readsyms.cc (Read_symbols::do_read_symbols): Add check
4078 for thin archives. Pass additional parameters to
4079 Archive::Archive. Unlock the archive file after calling
4080 Archive::setup.
4081
4082 2008-03-29 Ian Lance Taylor <iant@google.com>
4083
4084 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
4085 version symbol to be local.
4086 * testsuite/ver_test_4.sh: New file.
4087 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
4088 (check_DATA): Add ver_test_4.syms.
4089 (ver_test_4.syms): New target.
4090 * testsuite/Makefile.in: Rebuild.
4091
4092 * output.cc
4093 (Output_section::Input_section_sort_entry::has_priority): New
4094 function.
4095 (Output_section::Input_section_sort_entry::match_file_name): New
4096 function.
4097 (Output_section::Input_section_sort_entry::match_section_name):
4098 Remove.
4099 (Output_section::Input_section_sort_entry::match_section_name_prefix):
4100 Remove.
4101 (Output_section::Input_section_sort_entry::match_section_file):
4102 Remove.
4103 (Output_section::Input_section_sort_compare::operator()): Rewrite
4104 using new Input_section_sort_entry functions. Sort crtbegin and
4105 crtend first. Sort sections with no priority before sections with
4106 a priority.
4107 * testsuite/initpri1.c (d3): Check j != 4.
4108 (cd5): New constructor/destructor function.
4109 (main): Check j != 2.
4110
4111 * symtab.cc (Symbol_table::add_from_object): If we don't use the
4112 new symbol when resolving, don't call set_is_default.
4113 * testsuite/ver_test_7.cc: New file.
4114 * testsuite/ver_test_7.sh: New file.
4115 * testsuite/Makefile.am (ver_test_7.so): New target.
4116 (ver_test_7.o): New target.
4117 (check_SCRIPTS): Add ver_test_7.sh.
4118 (check_DATA): Add ver_test_7.syms.
4119 (ver_test_7.syms): New target.
4120
4121 2008-03-28 Ian Lance Taylor <iant@google.com>
4122
4123 * layout.cc (Layout::layout): If we see an input section with a
4124 name that needs sorting, set the must_sort flag for the output
4125 section.
4126 (Layout::make_output_section): If the name of the output section
4127 indicates that it might require sorting, set the may_sort flag.
4128 * output.h (Output_section::may_sort_attached_input_sections): New
4129 function.
4130 (Output_section::set_may_sort_attached_input_sections): New
4131 function.
4132 (Output_section::must_sort_attached_input_sections): New
4133 function.
4134 (Output_section::set_must_sort_attached_input_sections): New
4135 function.
4136 (class Output_section): Declare Input_section_sort_entry. Define
4137 Input_section_sort_compare. Declare
4138 sort_attached_input_sections. Add new fields:
4139 may_sort_attached_input_sections_,
4140 must_sort_attached_input_sections_,
4141 attached_input_sections_are_sorted_.
4142 * output.cc (Output_section::Output_section): Initialize new
4143 fields.
4144 (Output_section::add_input_section): Add an entry to
4145 input_sections_ if may_sort or must_sort are true.
4146 (Output_section::set_final_data_size): Call
4147 sort_attached_input_sections if necessary.
4148 (Output_section::Input_section_sort_entry): Define new class.
4149 (Output_section::Input_section_sort_compare::operator()): New
4150 function.
4151 (Output_section::sort_attached_input_sections): New function.
4152 * configure.ac: Check whether the compiler supports constructor
4153 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
4154 * testsuite/initpri1.c: New file.
4155 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
4156 CONSTRUCTOR_PRIORITY.
4157 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
4158 (initpri1_LDFLAGS): New variable.
4159 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4160
4161 2008-03-27 Ian Lance Taylor <iant@google.com>
4162
4163 * common.cc (Sort_commons::operator): Correct sorting algorithm.
4164 * testsuite/common_test_1.c: New file.
4165 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
4166 (common_test_1_SOURCES): New variable.
4167 (common_test_1_DEPENDENCIES): New variable.
4168 (common_test_1_LDFLAGS): New variable.
4169
4170 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
4171 and commons_ correctly when NAME/VERSION does not override
4172 NAME/NULL.
4173 * testsuite/ver_test_6.c: New file.
4174 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
4175 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
4176 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
4177
4178 2008-03-26 Ian Lance Taylor <iant@google.com>
4179
4180 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
4181 of an undefined symbol from a version script.
4182 * testsuite/Makefile.am (ver_test_5.so): New target.
4183 (ver_test_5.o): New target.
4184 (check_SCRIPTS): Add ver_test_5.sh.
4185 (check_DATA): Add ver_test_5.syms.
4186 (ver_test_5.syms): New target.
4187 * testsuite/ver_test_5.cc: New file.
4188 * testsuite/ver_test_5.script: New file.
4189 * testsuite/ver_test_5.sh: New file.
4190 * Makefile.in, testsuite/Makefile.in: Rebuild.
4191
4192 PR gold/5986
4193 Fix problems building gold with gcc 4.3.0.
4194 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
4195 (gold_error_at_location, gold_warning_at_location): Use it.
4196 * configure.ac: Check whether we can compile and use a template
4197 function with a printf attribute.
4198 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
4199 when jumping over bytes.
4200 * object.cc: Instantiate Object::read_section_data.
4201 * debug.h: Include <cstring>
4202 * dwarf_reader.cc: Include <algorithm>
4203 * main.cc: Include <cstring>.
4204 * options.cc: Include <cstring>.
4205 * output.cc: Include <cstring>.
4206 * script.cc: Include <cstring>.
4207 * script.h: Include <string>.
4208 * symtab.cc: Include <cstring> and <algorithm>.
4209 * target-select.cc: Include <cstring>.
4210 * version.cc: Include <string>.
4211 * testsuite/testmain.cc: Include <cstdlib>.
4212 * configure, config.in: Rebuild.
4213
4214 2008-03-25 Ian Lance Taylor <iant@google.com>
4215
4216 * options.cc: Include "../bfd/bfdver.h".
4217 (options::help): Print bug reporting address.
4218
4219 * version.cc (print_version): Adjust output for current value of
4220 BFD_VERSION_STRING.
4221
4222 * NEWS: New file.
4223
4224 * options.cc (options::help): Print list of supported targets.
4225 * target-select.h: Include <vector>.
4226 (class Target_selector): Make machine_, size_, and is_big_endian_
4227 fields const. Add bfd_name_ and instantiated_target_ fields.
4228 (Target_selector::Target_selector): Add bfd_name parameter.
4229 (Target_selector::recognize): Make non-virtual, call
4230 do_recognize.
4231 (Target_selector::recognize_by_name): Make non-virtual, call
4232 do_recognize_by_name.
4233 (Target_selector::supported_names): New function.
4234 (Target_selector::bfd_name): New function.
4235 (Target_selector::do_instantiate_target): New pure virtual
4236 function.
4237 (Target_selector::do_recognize): New virtual function.
4238 (Target_selector::do_recognize_by_name): New virtual function.
4239 (Target_selector::instantiate_target): New private function.
4240 (supported_target_names): Declare.
4241 * target-select.cc (Target_selector::Target_selector): Update for
4242 new parameter and fields.
4243 (select_target_by_name): Check that the name matches before
4244 calling recognize_by_name.
4245 (supported_target_names): New function.
4246 * i386.cc (class Target_selector_i386): Update Target_selector
4247 constructor call. Remove recognize and recognize_by_name. Add
4248 do_instantiate_target.
4249 * x86_64.cc (class Target_selector_x86_64): Likewise.
4250 * testsuite/testfile.cc (class Target_selector_test): Update for
4251 changes to Target_selector.
4252
4253 * README: Rewrite, with some notes on unsupported features.
4254
4255 2008-03-24 Cary Coutant <ccoutant@google.com>
4256
4257 * i386.cc (Target_i386::Got_type): New enum declaration.
4258 (Target_i386::Scan::local): Updated callers of Output_data_got
4259 member functions.
4260 (Target_i386::Scan::global): Likewise.
4261 (Target_i386::Relocate::relocate): Likewise.
4262 (Target_i386::Relocate::relocate_tls): Likewise.
4263 * object.h (Got_offset_list): New class.
4264 (Sized_relobj::local_has_got_offset): Added got_type parameter.
4265 (Sized_relobj::local_got_offset): Likewise.
4266 (Sized_relobj::set_local_got_offset): Likewise.
4267 (Sized_relobj::local_has_tls_got_offset): Removed.
4268 (Sized_relobj::local_tls_got_offset): Removed.
4269 (Sized_relobj::set_local_tls_got_offset): Removed.
4270 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
4271 * output.cc (Output_data_got::add_global): Added got_type parameter.
4272 (Output_data_got::add_global_with_rel): Likewise.
4273 (Output_data_got::add_global_with_rela): Likewise.
4274 (Output_data_got::add_global_pair_with_rel): New function.
4275 (Output_data_got::add_global_pair_with_rela): New function.
4276 (Output_data_got::add_local): Added got_type parameter.
4277 (Output_data_got::add_local_with_rel): Likewise.
4278 (Output_data_got::add_local_with_rela): Likewise.
4279 (Output_data_got::add_local_pair_with_rel): New function.
4280 (Output_data_got::add_local_pair_with_rela): New function.
4281 (Output_data_got::add_global_tls): Removed.
4282 (Output_data_got::add_global_tls_with_rel): Removed.
4283 (Output_data_got::add_global_tls_with_rela): Removed.
4284 (Output_data_got::add_local_tls): Removed.
4285 (Output_data_got::add_local_tls_with_rel): Removed.
4286 (Output_data_got::add_local_tls_with_rela): Removed.
4287 * output.h (Output_data_got::add_global): Added got_type parameter.
4288 (Output_data_got::add_global_with_rel): Likewise.
4289 (Output_data_got::add_global_with_rela): Likewise.
4290 (Output_data_got::add_global_pair_with_rel): New function.
4291 (Output_data_got::add_global_pair_with_rela): New function.
4292 (Output_data_got::add_local): Added got_type parameter.
4293 (Output_data_got::add_local_with_rel): Likewise.
4294 (Output_data_got::add_local_with_rela): Likewise.
4295 (Output_data_got::add_local_pair_with_rel): New function.
4296 (Output_data_got::add_local_pair_with_rela): New function.
4297 (Output_data_got::add_global_tls): Removed.
4298 (Output_data_got::add_global_tls_with_rel): Removed.
4299 (Output_data_got::add_global_tls_with_rela): Removed.
4300 (Output_data_got::add_local_tls): Removed.
4301 (Output_data_got::add_local_tls_with_rel): Removed.
4302 (Output_data_got::add_local_tls_with_rela): Removed.
4303 * resolve.cc (Symbol::override_base_with_special): Removed
4304 reference to has_got_offset_ field.
4305 * symtab.cc (Symbol::init_fields): Replaced initialization
4306 of got_offset_ with got_offsets_. Removed initialization
4307 of has_got_offset_
4308 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
4309 (Symbol::got_offset): Likewise.
4310 (Symbol::set_got_offset): Likewise.
4311 (Symbol::has_tls_got_offset): Removed.
4312 (Symbol::tls_got_offset): Removed.
4313 (Symbol::set_tls_got_offset): Removed.
4314 (Symbol::got_offset_): Removed.
4315 (Symbol::tls_mod_got_offset_): Removed.
4316 (Symbol::tls_pair_got_offset_): Removed.
4317 (Symbol::got_offsets_): New field.
4318 (Symbol::has_got_offset): Removed.
4319 (Symbol::has_tls_mod_got_offset): Removed.
4320 (Symbol::has_tls_pair_got_offset): Removed.
4321 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
4322 (Target_x86_64::Scan::local): Updated callers of Output_data_got
4323 member functions.
4324 (Target_x86_64::Scan::global): Likewise.
4325 (Target_x86_64::Relocate::relocate): Likewise.
4326 (Target_x86_64::Relocate::relocate_tls): Likewise.
4327
4328 2008-03-25 Ben Elliston <bje@au.ibm.com>
4329
4330 * yyscript.y: Fix spelling error in comment.
4331
4332 2008-03-24 Ian Lance Taylor <iant@google.com>
4333
4334 * options.h (class General_options): Define build_id option.
4335 * layout.h (class Layout): Declare write_build_id, create_note,
4336 create_build_id. Add build_id_note_ member.
4337 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
4338 "libiberty.h", "md5.h", "sha1.h".
4339 (Layout::Layout): Initialize eh_frame_data_,
4340 eh_frame_hdr_section_, and build_id_note_.
4341 (Layout::finalize): Call create_build_id.
4342 (Layout::create_note): New function, broken out of
4343 Layout::create_gold_note.
4344 (Layout::create_gold_note): Call create_note.
4345 (Layout::create_build_id): New function.
4346 (Layout::write_build_id): New function.
4347 (Close_task_runner::run): Call write_build_id.
4348
4349 * x86_64.cc: Correct license to GPLv3.
4350
4351 2008-03-23 Ian Lance Taylor <iant@google.com>
4352
4353 * options.cc: Include "demangle.h".
4354 (parse_optional_string): New function.
4355 (parse_long_option): Handle takes_optional_argument.
4356 (parse_short_option): Update dash_z initializer. Handle
4357 takes_optional_argument.
4358 (General_options::General_options): Initialize do_demangle_.
4359 (General_options::finalize): Set do_demangle_. Handle demangling
4360 style.
4361 * options.h (parse_optional_string): Declare.
4362 (struct One_option): Add optional_arg field. Update constructor.
4363 Update call constructor calls. Add takes_optional_argument
4364 function.
4365 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
4366 (DEFINE_optional_string): Define.
4367 (General_options::demangle): Change from DEFINE_bool to
4368 DEFINE_optional_string.
4369 (General_options::no_demangle): New function.
4370 (General_options::do_demangle): New function.
4371 (General_options::set_do_demangle): New function.
4372 (General_options::execstack_status_): Move definition to end of
4373 class definition.
4374 (General_options::static_): Likewise.
4375 (General_options::do_demangle_): New field.
4376 * object.cc (big_endian>::get_symbol_location_info): Call
4377 Options::do_demangle, not Options::demangle.
4378 * symtab.cc (demangle): Likewise.
4379
4380 2008-03-22 Ian Lance Taylor <iant@google.com>
4381
4382 * gold.h: Include <cstddef> and <sys/types.h>
4383 * options.h: Include <cstring>.
4384
4385 2008-03-21 Ian Lance Taylor <iant@google.com>
4386
4387 * Added source code to GNU binutils.
This page took 0.135966 seconds and 5 git commands to generate.