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