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