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