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