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