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