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