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