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