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