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