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