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