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