2009-06-23 Sami Wagiaalla <swagiaal@redhat.com>
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
0639a6f6
ILT
12009-06-23 Ian Lance Taylor <iant@google.com>
2
3 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
4 * configure: Rebuild.
5
8d63875c
ILT
62009-06-23 Ian Lance Taylor <iant@google.com>
7
8 PR 10147
9 * object.cc (Object::section_contents): Don't try to get a view if
10 the section has length zero.
11 (Object::handle_gnu_warning_section): If the section is empty, use
12 the name of the section as the warning.
13
f7c8a183
ILT
142009-06-23 Ian Lance Taylor <iant@google.com>
15
16 PR 10133
17 * stringpool.h (class Stringpool_template): Add optimize_ field.
18 (Stringpool_template::set_optimize): New function.
19 * stringpool.cc (Stringpool_template::Stringpool_template):
20 Initialize optimize_ field.
21 (Stringpool_template::set_string_offsets): Test local optimize
22 fild rather than parameter.
23 * layout.cc (Layout::Layout): Call set_optimize on the section
24 name stringpool.
25
e6a307ba
ILT
262009-06-22 Ian Lance Taylor <iant@google.com>
27
28 PR 10030
29 * yyscript.y: Parse TARGET.
30 * script.cc (script_set_target): New function.
31 * script-c.h (script_set_target): Declare.
32 * options.cc (General_options::string_to_object_format): Rename
33 from string_to_object_format in anonymous namespace. Change
34 callers.
35 * options.h (class General_options): Declare
36 string_to_object_format.
37
3ee173de
ILT
382009-06-22 Ian Lance Taylor <iant@google.com>
39
40 * script-sections.cc (Script_sections::create_segments): Don't put
41 program headers in a PT_LOAD segment if -n or -N.
42
432009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
44
45 PR 10141
46 * options.h (class General_options): Add -z lazy and -z now. Sort
47 -z options into alphabetical order.
48 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
49
cd6739a1 502009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
51
52 * layout.cc (Layout::make_output_section): Call
53 Target::new_output_section.
54 (Layout::attach_allocated_section_to_segment): Put large section
55 sections in a separate load segment with the large segment flag
56 set.
57 (Layout::segment_precedes): Sort large data segments after other
58 load segments.
59 (align_file_offset): New static function.
60 (Layout::set_segment_offsets): Use align_file_offset.
61 * output.h (class Output_section): Add is_small_section_ and
62 is_large_section_ fields.
63 (Output_section::is_small_section): New function.
64 (Output_section::set_is_small_section): New function.
65 (Output_section::is_large_section): New function.
66 (Output_section::set_is_large_section): New function.
67 (Output_section::is_large_data_section): New function.
68 (class Output_segment): Add is_large_data_segment_ field.
69 (Output_segment::is_large_data_segment): New function.
70 (Output_segment::set_is_large_data_segment): New function.
71 * output.cc (Output_section::Output_section): Initialize new
72 fields.
73 (Output_segment::Output_segment): Likewise.
74 (Output_segment::add_output_section): Add assertion that large
75 data sections always go in large data segments. Force small data
76 sections to the end of the list of data sections. Force small BSS
77 sections to the start of the list of BSS sections. For large BSS
78 sections to the end of the list of BSS sections.
79 * symtab.h (class Symbol): Declare is_common_shndx.
80 (Symbol::is_defined): Check Symbol::is_common_shndx.
81 (Symbol::is_common): Likewise.
82 (class Symbol_table): Define enum Commons_section_type. Update
83 declarations. Add small_commons_ and large_commons_ fields.
84 * symtab.cc (Symbol::is_common_shndx): New function.
85 (Symbol_table::Symbol_table): Initialize new fields.
86 (Symbol_table::add_from_object): Put small and large common
87 symbols in the right list.
88 (Symbol_table::sized_finalized_symbol): Check
89 Symbol::is_common_shndx.
90 (Symbol_table::sized_write_globals): Likewise.
91 * common.cc (Symbol_table::do_allocate_commons): Allocate new
92 common symbol lists. Don't call do_allocate_commons_list if the
93 list is empty.
94 (Symbol_table::do_allocate_commons_list): Remove is_tls
95 parameter. Add comons_section_type parameter. Change all
96 callers. Handle small and large common symbols.
97 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
98 Symbol::is_common_shndx.
99 * resolve.cc (symbol_to_bits): Likewise.
100 * target.h (Target::small_common_shndx): New function.
101 (Target::small_common_section_flags): New function.
102 (Target::large_common_shndx): New function.
103 (Target::large_common_section_flags): New function.
104 (Target::new_output_section): New function.
105 (Target::Target_info): Add small_common_shndx, large_common_shndx,
106 small_common_section_flags, and large_common_section_flags
107 fields.
108 (Target::do_new_output_section): New virtual function.
109 * arm.cc (Target_arm::arm_info): Initialize new fields.
110 * i386.cc (Target_i386::i386_info): Likewise.
111 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
112 Likewise.
113 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
114 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
115 (Target_x86_64::do_new_output_section): New function.
116 * configure.ac: Define conditional MCMODEL_MEDIUM.
117 * testsuite/Makefile.am (check_PROGRAMS): Add large.
118 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
119 (large_LDFLAGS): Define.
120 * testsuite/large.c: New file.
121 * testsuite/testfile.cc (Target_test::test_target_info):
122 Initialize new fields.
123 * configure, testsuite/Makefile.in: Rebuild.
124
bb04269c
DK
1252009-06-05 Doug Kwan <dougkwan@google.com>
126
127 * Makefile.am (CCFILES): Add target.cc.
128 * Makefile.in: Regenerate.
129 * i386.cc (class Target_i386): Define new virtual method to
130 override do_is_local_label_name in parent.
131 * object.cc (Sized_relobj::do_count_local_symbols): Discard
132 local symbols if --discard-locals or -X is given.
133 * options.h (class General_options): Declare new options
134 '--discard-locals' and '-X' for discarding locals.
135 * target.h (class Target): Define new methods is_local_label_name.
136 Declare new virtual method do_is_local_label_name.
137 * target.cc: New file.
138 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
139 (check_SCRIPTS): Add discard_locals_test.sh.
140 (check_DATA): Add discard_local_tests.syms.
141 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
142 (discard_local_tests.syms, discard_locals_test.o): New make rules.
143 * testsuite/Makefile.in: Regenerate.
144 * testsuite/discard_locals_test.c: New file.
145 * testsuite/discard_locals_test.sh: Same.
146
805bb01c
DK
1472009-06-05 Doug Kwan <dougkwan@google.com>
148
149 * object.cc (Sized_relobj::Sized_relobj): Initialize
150 discarded_eh_frame_shndx_ to -1U.
151 (Sized_relobj::do_layout): Record index of a discard .eh_frame
152 section.
153 (Sized_relobj::do_count_local_symbols): Skip local symbols in
154 a discarded .eh_frame section.
155 (Sized_relobj::do_finalize_local_symbols): Ditto.
156 * object.h (class Sized_relobj): Declare new member
157 discarded_eh_frame_shndx_.
158 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
159 (local_labels_test.o, local_labels_test): New rules.
160 * testsuite/Makefile.in: Regenerate.
161
1dcd334d
DK
1622009-06-04 Doug Kwan <dougkwan@google.com>
163
164 * layout.cc (Layout::section_name_mapping): Add mapping for
165 special ARM sections.
166
96d49306
DK
1672009-06-03 Doug Kwan <dougkwan@google.com>
168
169 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
170 (utils::has_overflow): Same.
171
dff16297
ILT
1722009-06-03 Ian Lance Taylor <iant@google.com>
173
174 * layout.cc (Layout::section_name_mapping): New array, replacing
175 Layout::linkonce_mapping.
176 (Layout::section_name_mapping_count): New variable, replacing
177 Layout::linkonce_mapping_count.
178 (Layout::linkonce_output_name): Remove.
179 (Layout::output_section_name): Rewrite.
180 * layout.h (class Layout): Rename Linkonce_mapping to
181 Section_name_mapping, linkonce_mapping to section_name_mapping,
182 linkonce_mapping_count to section_name_mapping_count. Don't
183 declare linkonce_output_name.
184
c121c671
DK
1852009-06-03 Doug Kwan <dougkwan@google.com>
186
187 * gold/arm.cc (namespace utils): New.
188 (Target_arm::reloc_is_non_pic): Define new method.
189 (class Arm_relocate_functions): New.
190 (Target_arm::Relocate::relocate): Handle relocation types used by
191 Android.
192
07800fab
ILT
1932009-06-03 Ian Lance Taylor <iant@google.com>
194
195 * arm.cc (Target_arm::scan::global): Use || instead of |.
196
c121c671
DK
1972009-06-02 Doug Kwan <dougkwan@google.com>
198
199 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
200 issued_non_pic_error_.
201 (class Target_arm::Scan): Declare new method check_non_pic.
202 Define new method symbol_needs_plt_entry.
203 Declare new data member issued_non_pic_error_.
204 (class Target_arm::Relocate): Declare new method
205 should_apply_static_reloc.
206 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
207 (Target_arm::Scan::check_non_pic): Define new method.
208 (Target_arm::Scan::local): Handle a small subset of reloc types used
209 by Android.
210 (Target_arm::Scan::local): Same.
211 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
212
b19b0c6d
ILT
2132009-05-31 Mikolaj Zalewski <mikolajz@google.com>
214
215 * incremental.cc (Incremental_inputs::report_command_line): Filter
216 out --incremental-* options.
217
94cdfcff
DK
2182009-05-29 Doug Kwan <dougkwan@google.com>
219
220 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
221 template class.
222 (class Target_arm): Update comment.
223 (Target_arm::Target_arm): Initialize new data members GOT_,
224 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
225 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
226 and Target_arm::rel_dyn_section.
227 Declare new_enum Target_arm::Got_type.
228 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
229 and DYNBSS_.
230 Update commments for member do_dynsym_value.
231 (Target_arm::got_size, Target_arm::plt_section,
232 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
233 new methods inside class defintion.
234 (Target_arm::got_section): Define new method.
235 (Target_arm::rel_dyn_section): Same.
236 (Output_data_plt_arm): New template class.
237 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
238 (Output_data_plt_arm:do_adjust_output_section): Define new method.
239 (Output_data_plt_arm::add_entry): Same.
240 (Output_data_plt_arm::first_plt_entry): Define new
241 static data member for PLT instruction template.
242 (Output_data_plt_arm::plt_entry): Same.
243 (Output_data_plt_arm::do_write): Define new method.
244 (Target_arm::make_plt_entry): Same.
245 (Target_arm::do_finalize_sections): Same.
246 (Target_arm::do_dynsym_value): Same.
247
4a657b0d
DK
2482009-05-28 Doug Kwan <dougkwan@google.com>
249
250 * Makefile.am (TARGETSOURCES): Add arm.cc.
251 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
252 * Makefile.in: Regenerate.
253 * arm.cc: New file.
254 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
255
e7ae8c36
DK
2562009-05-26 Doug Kwan <dougkwan@google.com>
257
258 * options.cc (General_options::parse_exclude_libs). Fix a comment.
259 (General_options::check_excluded_libs): Strip off directories in
260 archive name before matching like GNU ld does.
261 * testsuite/Makefile.am (MOSTLYCLEANFILES,
262 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
263 (exclude_libs_test_LDFLAGS): Add linker option
264 -Wl,--exclude-libs,libexclude_libs_test_3
265 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
266 an explicit archive without using -l.
267 (alt/libexclude_libs_test_3.a): New make rule.
268 * testsuite/Makefile.in: Regenerate.
269 * testsuite/exclude_libs_test.c : Declare lib3_default().
270 (main): Call it.
271 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
272 * exclude_libs_test_3.c: New file.
273
f12e7348
NC
2742009-05-26 Nick Clifton <nickc@redhat.com>
275
276 * po/id.po: New Indonesian translation.
277 * po/gold.pot: Updated template file.
278
4daadc0d
ST
2792009-05-22 Sriraman Tallam <tmsriram@google.com>
280
281 * testsuite/Makefile.am: Add -ffunction-sections to compile
282 gc_comdat_test files. Add -Wl,--gc-sections to build
283 gc_comdat_test.
284 * testsuite/Makefile.in: Regenerate.
285 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
286
531813ad
ST
2872009-05-21 Sriraman Tallam <tmsriram@google.com>
288
289 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
290 kept comdat section was garbage collected.
291 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
292 * testsuite/Makefile.in: Regenerate.
293 * testsuite/gc_comdat_test.sh: New file.
294 * testsuite/gc_comdat_test_1.cc: New file.
295 * testsuite/gc_comdat_test_2.cc: New file.
296
65514900
CC
2972009-05-19 Doug Kwan <dougkwan@google.com>
298
299 * archive.cc (Archive::Archive): Move constructor from archive.h
300 to here. Initialize no_export_.
301 (Archive::get_elf_object_for_member): Set no_export flag of object.
302 * archive.h (Archive::Archive): Move constructor body to
303 archive.cc.
304 (Archive::no_export): New method.
305 (Archive::no_export_): New field.
306 * object.h (Object::Object): Initialize no_export_ to false.
307 (Object::no_export, Object::set_no_export): New methods.
308 (Object::no_export_): New field.
309 * options.cc (General_options::parse_exclude_libs): New method.
310 (General_options::check_excluded_libs) Same.
311 * options.h (exclude_libs): New option.
312 (General_options::check_excluded_libs): New method declaration.
313 (General_options::excluded_libs_): New field.
314 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
315 default or protected visibility if an object has no-export flag set.
316 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
317 (check_SCRIPTS): Add exclude_libs_test.sh.
318 (check_DATA): Add exclude_libs_test.syms.
319 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
320 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
321 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
322 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
323 (exclude_libs_test.syms, libexclude_libs_test_1.a,
324 libexclude_libs_test_2.a): New rules.
325 * testsuite/Makefile.in: Regenerate.
326 * testsuite/exclude_libs_test.c: New file.
327 * testsuite/exclude_libs_test.sh: Ditto.
328 * testsuite/exclude_libs_test_1.c: Ditto.
329 * testsuite/exclude_libs_test_2.c: Ditto.
330
1b77ea50
ILT
3312009-05-15 Ian Lance Taylor <iant@google.com>
332
333 * configure.ac: Check for declarations for cases where libiberty.h
334 checks HAVE_DECL_xxx.
335 * configure, config.in: Rebuild.
336
072fe7ce
ILT
3372009-05-15 Mikolaj Zalewski <mikolajz@google.com>
338
339 * gold.h (Incremental_argument_list): Remove (invalid) forward
340 declaration.
341 * incremental.cc (Incremental_inputs::report_achive): New method.
342 (Incremental_inputs::report_object): New method.
343 (Incremental_inputs::report_script): New method.
344 (Incremental_inputs::finalize_inputs): New method.
345 (Incremental_inputs::finalize): Call finalize_inputs().
346 (Incremental_inputs::sized_create_incremental_inputs_section_data):
347 Create inputs entries.
348 * incremental.h (Incremental_input_type): New enum.
349 (Incremental_inputs::Incremental_input): Initialize new fields.
350 (Incremental_inputs::report_inputs): New method.
351 (Incremental_inputs::report_achive): New method.
352 (Incremental_inputs::report_object): New method.
353 (Incremental_inputs::report_script): New method.
354 (Incremental_inputs::finalize_inputs): New method.
355 (Incremental_inputs::Input_info): New struct.
356 (Incremental_inputs::Input_info_map): New typedef.
357 (Incremental_inputs::lock_): New field.
358 (Incremental_inputs::Inputs_): New field.
359 (Incremental_inputs::Inputs_map): New field.
360 * main.cc (main): Call Incremental_input::report_inputs.
361 * options.h (Input_argument_list): Typedef moved from
362 Input_arguments.
363 (Input_file_group::Files): Remove, use ::Input_argument_list.
364 (Input_file_group::Input_argument_list): Remove, use
365 ::Input_argument_list.
366 * plugin.cc (Plugin_manager::add_input_file): Add error in
367 incremental build.
368 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
369 functions.
370 * script.cc (read_input_script): Call
371 Incremental_input::report_script.
372 * script.h (Script_info): New class.
373
b0481b0b
ILT
3742009-04-27 Ian Lance Taylor <iant@google.com>
375
376 * x86_64.cc (do_adjust_output_section): Set entsize to
377 plt_entry_size.
378
b22a5a41 3792009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
380
381 * output.cc (Output_file::close): After short writes, continue
382 writing from the correct offset in the buffer being written.
383
40fde488
CD
3842009-04-23 Chris Demetriou <cgd@google.com>
385
386 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
387 * configure: Regenerate.
388 * config.in: Regenerate.
389 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
390 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
391
3ce2c28e
ILT
3922009-04-21 Mikolaj Zalewski <mikolajz@google.com>
393
394 * incremental.cc (Incremental_inputs_header_data): Renamed from
395 Incremental_input_header_data.
396 (Incremental_inputs_header_data::data_size): New field.
397 (Incremental_inputs_header_data::put_input_file_count): Renamed
398 from input_file_count.
399 (Incremental_inputs_header_data::put_command_line_offset): Renamed
400 from command_line_offset.
401 (Incremental_inputs_header_data::put_reserved): Renamed from
402 put_reserved.
403 (Incremental_inputs_entry_data): Renamed from
404 Incremental_input_entry_data.
405 (Incremental_inputs_entry_data::data_size): New field.
406 (Incremental_inputs::report_command_line): New method.
407 (Incremental_inputs::finalize): New method.
408 (Incremental_inputs::create_incremental_inputs_data): New method.
409 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
410 * incremental.h: New file.
411 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
412 (Layout::finalize): Create incremental inputs section in
413 incremental builds.
414 (Layout::create_incremental_info_sections): New method.
415 * layout.h (Layout::incremental_inputs): New method.
416 (Layout::create_incremental_info_sections): New method.
417 (Layout::incremental_inputs_): New field.
418 * main.cc (main): Notify Incremental_input of the command line.
419
e55bde5e
ILT
4202009-04-01 Ian Lance Taylor <iant@google.com>
421 Mikolaj Zalewski <mikolajz@google.com>
422
423 * gold.h (reserve_unordered_map): Define, three versions, one for
424 each version of Unordered_map.
425 * layout.cc (Layout::Layout): Remove options parameter. Add
426 number_of_input_files parameter. Don't initialize options_.
427 Initialize number_of_input_files_ and resized_signatures_. Move
428 sections_are_attached_.
429 (Layout::layout_group): Reserve space for group_signatures_.
430 (Layout::find_or_add_kept_section): Change name parameter to be a
431 reference. Resize signatures_ map when it gets large enough.
432 (Layout::layout_eh_frame): Use parameters->options() instead of
433 this->options_.
434 (Layout::make_output_section): Likewise.
435 (Layout::attach_allocated_section_to_segment): Likewise.
436 (Layout::finalize, Layout::create_executable_stack): Likewise.
437 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
438 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
439 * layout.h (class Layout): Update declarations. Remove options_
440 field. Add number_of_input_files_ and resized_signatures_
441 fields. Move sections_are_attached_ field.
442 * main.cc (main): Pass number of input files to Layout
443 constructor. Don't pass options.
444
154b857c
ILT
4452009-03-30 Ian Lance Taylor <iant@google.com>
446
447 * ffsll.c (ffsll): Correct implementation.
448
2f35ab9b
ILT
4492009-03-27 Ian Lance Taylor <iant@google.com>
450
fd03461a
ILT
451 * ffsll.c: New file.
452 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
453 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
454 * ftruncate.c (ftruncate): Declare before definition.
455 * mremap.c (mremap): Likewise.
456 * pread.c (pread): Likewise.
457 * configure, Makefile.in, config.in: Rebuild.
458
2f35ab9b
ILT
459 * mremap.c: New file.
460 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
461 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
462 (mremap): Declare if HAVE_MREMAP is not defined.
463 * configure, Makefile.in, config.in: Rebuild.
464
33aea2fd
CC
4652009-03-27 Cary Coutant <ccoutant@google.com>
466
467 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
468 position independent.
469 * sparc.cc (Target_sparc::check_non_pic): Likewise.
470 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
471
6d479619
CC
4722009-03-24 Cary Coutant <ccoutant@google.com>
473
474 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
475 an executable.
476 (needs_dynamic_reloc): Likewise.
477
afc06bb8
ILT
4782009-03-24 Ian Lance Taylor <iant@google.com>
479
480 * yyscript.y (file_cmd): Recognize EXTERN.
481 (extern_name_list, extern_name_list_body): New nonterminals.
482 * script.cc (script_add_extern): Define.
483 * script-c.h (script_add_extern): Declare.
484
f6060a4d
ILT
4852009-03-24 Rafael Avila de Espindola <espindola@google.com>
486
487 * object.cc (is_elf_object): Define.
488 * object.h (is_elf_object): Declare.
489 * archive.cc (Archive::get_elf_object_for_member): Call
490 is_elf_object.
33aea2fd 491 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 492
26736d8e
ILT
4932009-03-24 Elliott Hughes <enh@google.com>
494
495 * output.cc (Output_file::map_anonymous): Define.
496 (Output_file::map): Use map_anonymous. If the regular mmap fails,
497 try an anonymous one. Report the size if the mmap fails.
498 * output.h (class Output_file): Declare map_anonymous.
499
22fd9730
ILT
5002009-03-24 Ian Lance Taylor <iant@google.com>
501
502 * target-select.cc (instantiate_target): Don't acquire the lock if
503 the instantiated_target_ field has already been set.
504
cb010894
ILT
5052009-03-23 Ian Lance Taylor <iant@google.com>
506
7f055c20
ILT
507 * gold-threads.h (class Initialize_lock): Define.
508 * gold-threads.cc (class Initialize_lock_once): Define.
509 (initialize_lock_control): New static variable.
510 (initialize_lock_pointer): New static variable.
511 (initialize_lock_once): New static function.
512 (Initialize_lock::Initialize_lock): Define.
513 (Initialize_lock::initialize): Define.
514 * target-select.h: Include "gold-threads.h".
515 (class Target_selector): Add lock_ and initialize_lock_ fields.
516 Don't define instantiate_target, just declare it.
517 * target-select.cc (Target_selector::Target_selector): Initialize
518 new fields.
519 (Target_selector::instantiate_target): Define.
520 * descriptors.h: Include "gold-threads.h".
521 (class Descriptors): Add initialize_lock_ field.
522 * descriptors.cc (Descriptors::Descriptors): Initialize new
523 field.
524 (Descriptors::open): Use initialize_lock_ field
525 * errors.h (class Errors): Add initialize_lock_ field.
526 * errors.cc (Errors::Errors): Initialize new field.
527 (Errors::initialize_lock): Use initialize_lock_ field.
528 * powerpc.cc (class Target_selector_powerpc): Remove
529 instantiated_target_ field. In do_recognize call
530 instantiate_target rather than do_instantiate_target. In
531 do_instantiate_target just allocate a new target.
532 * sparc.cc (class Target_selector_sparc): Likewise.
533
36959681
ILT
534 * freebsd.h: New file.
535 * i386.cc: Include "freebsd.h".
536 (Target_i386): Derive from Target_freebsd rather than
537 Sized_target.
538 (Target_selector_i386): Derive from Target_selector_freebsd rather
539 than Target_selector.
540 * x86_64.cc: Include "freebsd.h".
541 (Target_x86_64): Derive from Target_freebsd rather than
542 Sized_target.
543 (Target_selector_x86_64): Derive from Target_selector_freebsd
544 rather than Target_selector.
545 * target.h (class Target): Add adjust_elf_header and
546 do_adjust_elf_header.
547 * output.cc (Output_file_header:: do_sized_write): Call target
548 adjust_elf_header routine.
549 * configure.tgt: Set targ_osabi.
550 * configure.ac: Define GOLD_DEFAULT_OSABI.
551 * parameters.cc (Parameters::default_target): Pass
552 GOLD_DEFAULT_OSABI to select_target.
553 * target-select.h (class Target_selector): Make instantiate_target
554 protected rather than private.
555 * Makefile.am (HFILES): Add freebsd.h.
556 * configure, Makefile.in, config.in: Rebuild.
557
cb010894
ILT
558 * merge.cc (do_add_input_section): Correct pend value. Change
559 message about last entry not being null terminated from error to
560 warning.
561
0e879927
ILT
5622009-03-20 Mikolaj Zalewski <mikolajz@google.com>
563
564 * incremental.cc: New file.
565 * Makefile.am (CCFILES): Add incremental.cc.
566 * Makefile.in: Rebuild.
567
41105937
PP
5682009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
569
570 * layout.cc (Layout::output_section_name): Preserve names
571 of '.note.' sections.
572
60439920
ILT
5732009-03-19 Ian Lance Taylor <iant@google.com>
574
575 * descriptors.cc (Descriptors::open): Check that the options are
576 valid before using them.
577
0d371ad3
ILT
5782009-03-18 Ian Lance Taylor <iant@google.com>
579
580 * script-sections.h: Include <list>.
581 (class Script_sections): Change Sections_elements from std::vector
582 to std::list. Typedef public Elements_iterator. Add
583 orphan_section_placement_, data_segment_align_start_, and
584 saw_data_segment_align_ fields. Remove data_segment_align_index_
585 field.
586 * script-sections.cc (class Orphan_section_placement): New class.
587 (class Sections_element): Add virtual functions is_relro and
588 orphan_section_init. Remove virtual function place_orphan_here.
589 (class Output_section_definition): Add is_relro and
590 orphan_section_init. Remove place_orphan_here.
591 (class Orphan_output_section): Likewise.
592 (Script_sections::Script_sections): Update for field changes.
593 (Script_sections::data_segment_align): Set saw_data_segment_align_
594 and data_segment_align_start_, not data_segment_align_index.
595 (Script_sections::data_segment_relro_end): Check
596 saw_data_segment_align_. Use data_segment_align_start_ rather
597 than data_segment_align_index_.
598 (Script_sections::place_orphan): Rewrite to use
599 Orphan_section_placement.
600
9201d894
ILT
6012009-03-17 Ian Lance Taylor <iant@google.com>
602
9c5b8369
ILT
603 * archive.cc (Archive::add_symbols): Check for a version attached
604 to the symbol name in the archive map.
605 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
606 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
607 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
608 (ver_test_11.a): New target.
609 * testsuite/Makefile.in: Rebuild.
610
9201d894
ILT
611 * configure.ac: Check for chsize and posix_fallocate. Replace
612 ftruncate.
613 * ftruncate.c: New file, from gnulib.
614 * output.cc (posix_fallocate): Define dummy version if not
615 HAVE_POSIX_FALLOCATE.
616 (Output_file::map): Call posix_fallocate rather than lseek and
617 write.
618 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
619 * configure, Makefile.in, config.in: Rebuild.
620
ef4ab7a8
PP
6212009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
622
623 * layout.h (Layout::create_note): Add section_name parameter.
624 * layout.cc (Layout::create_note): Likewise.
625 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
626
8c500701
ILT
6272009-03-17 Ian Lance Taylor <iant@google.com>
628
e85b18e1
ILT
629 * descriptors.cc: Include "options.h".
630 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
631 (Descriptors::open): Always use O_CLOEXEC when opening a new
632 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
633 then set FD_CLOEXEC.
634
9efe6174
ILT
635 * sparc.cc (class Target_sparc): Add has_got_section.
636 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
637 make sure we have a GOT section.
638
639 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
640 (Target_sparc::Scan::local): Likewise.
641 (Target_sparc::Scan::global): Likewise.
642 (Target_sparc::Relocate::relocate): Likewise.
643 (Target_sparc::Relocate::relocate_tls): Likewise.
644
8c500701
ILT
645 * symtab.cc (Symbol_table::define_default_version): New function,
646 broken out of add_from_object.
647 (Symbol_table::add_from_object): Call define_default_version.
648 (Symbol_table::define_special_symbol): Add resolve_oldsym
649 parameter. Change all callers. If the version for a symbol comes
650 from a version script, resolve it with the symbol with the same
651 name with no version. Also add the symbol without a version if
652 appropriate.
653 (do_define_in_output_data): If resolving with oldsym, don't delete
654 sym.
655 (do_define_in_output_segment): Likewise.
656 (do_define_as_constant): Likewise.
657 * symtab.h (class Symbol_table): Update declarations.
658
f1ed28fb
ILT
6592009-03-13 Ian Lance Taylor <iant@google.com>
660
15f8229b
ILT
661 * readsyms.cc (Read_symbols::incompatible_warning): New function.
662 (Read_symbols::requeue): New function.
663 (Read_symbols::do_read_symbols): If make_elf_object fails because
664 the target type is not configured, and the file was searched for,
665 issue a warning and retry with the next directory.
666 (Add_symbols::run): If the file has an incompatible format, and
667 it was searched for, requeue the Read_symbols task. On error,
668 release the object.
669 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
670 dirindex parameter to constructor. Change all callers. Declare
671 incompatible_warning and requeue.
672 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
673 input_argument_ and input_group_ fields. Add them to
674 constructor. Change all callers.
675 (class Read_script): Add dirindex_ field. Add it to constructor.
676 Change all callers.
677 * archive.cc (Archive::setup): Remove input_objects parameter.
678 Change all callers.
679 (Archive::get_file_and_offset): Likewise.
680 (Archive::read_all_symbols): Likewise.
681 (Archive::read_symbols): Likewise.
682 (Archive::get_elf_object_for_member): Remove input_objects
683 parameter. Add punconfigured parameter. Change all callers.
684 (Archive::add_symbols): Change return type to bool. Check return
685 value of include_member.
686 (Archive::include_all_members): Likewise.
687 (Archive::include_member): Change return type to bool. Return
688 false if first included object has incompatible target. Set
689 included_member_ field.
690 (Add_archive_symbols::run): If add_symbols returns false, requeue
691 Read_symbols task.
692 * archive.h (class Archive): Add included_member_ field.
693 Initialize it in constructor. Add input_file and searched_for
694 methods. Update declarations.
695 (class Add_archive_symbols): Add dirpath_, dirindex_, and
696 input_argument_ fields. Add them to constructor. Change all
697 callers.
698 * script.cc: Include "target-select.h".
699 (class Parser_closure): Add skip_on_incompatible_target_ and
700 found_incompatible_target_ fields. Add
701 skip_on_incompatible_target parameter to constructor. Change all
702 callers. Add methods skip_on_incompatible_target,
703 clear_skip_on_incompatible_target, found_incompatible_target, and
704 set_found_incompatible_target.
705 (read_input_script): Add dirindex parameter. Change all callers.
706 If parser finds an incompatible target, requeue Read_symbols
707 task.
708 (script_set_symbol): Clear skip_on_incompatible_target in
709 closure.
710 (script_add_assertion, script_parse_option): Likewise.
711 (script_start_sections, script_add_phdr): Likewise.
712 (script_check_output_format): New function.
713 * script.h (read_input_script): Update declaration.
714 * script-c.h (script_check_output_format): Declare.
715 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
716 (ignore_cmd): Remove OUTPUT_FORMAT.
717 * fileread.cc (Input_file::Input_file): Add explicit this.
718 (Input_file::will_search_for): New function.
719 (Input_file::open): Add pindex parameter. Change all callers.
720 * fileread.h (class Input_file): Add input_file_argument method.
721 Declare will_search_for. Update declarations.
722 * object.cc (make_elf_object): Add punconfigured parameter.
723 Change all callers.
724 * object.h (class Object): Make input_file public. Add
725 searched_for method.
726 (make_elf_object): Update declaration.
727 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
728 restart search.
729 * dirsearch.h (class Dirsearch): Update declaration.
730 * options.h (class General_options): Add --warn-search-mismatch.
731 * parameters.cc (Parameters::is_compatible_target): New function.
732 * parameters.h (class Parameters): Declare is_compatible_target.
733 * workqueue.cc (Workqueue::add_blocker): New function.
734 * workqueue.h (class Workqueue): Declare add_blocker.
735
f1ed28fb
ILT
736 * fileread.cc (Input_file::open): Remove options parameter.
737 Change all callers.
738 (Input_file::open_binary): Likewise.
739 * script.cc (read_input_script): Likewise.
740 * readsyms.h (class Read_symbols): Remove options_ field. Remove
741 options parameter from constructor. Change all callers.
742 (class Read_script): Likewise.
743 * fileread.h (class Input_file): Update declarations.
744 * script.h (read_input_script): Update declaration.
745
34dd024a
NC
7462009-03-10 Nick Clifton <nickc@redhat.com>
747
748 * po/es.po: New Spanish translation.
749
6d71b17c
CC
7502009-03-06 Cary Coutant <ccoutant@google.com>
751
752 * options.cc (parse_short_option): Keep dash_z from registering itself.
753
031cdbed
ILT
7542009-03-03 Ian Lance Taylor <iant@google.com>
755
756 PR 9918
757 * target-reloc.h (relocate_section): Pass output_section to
758 relocate.
759 * i386.cc (Target_i386::should_apply_static_reloc): Add
760 output_section parameter. Change all callers.
761 (Target_i386::Relocate::relocate): Add output_section parameter.
762 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
763 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
764 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
765 * testsuite/two_file_shared.sh: New script.
766 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
767 (check_DATA): Add two_file_shared.dbg.
768 (two_file_shared.dbg): New target.
769 * testsuite/Makefile.in: Rebuild.
770
15d5fa16
ILT
7712009-03-01 Ian Lance Taylor <iant@google.com>
772
773 * configure.ac: Check for byteswap.h.
774 * configure: Rebuild.
775 * config.in: Rebuild.
776
8a4c0b0d
ILT
7772009-03-01 Mikolaj Zalewski <mikolajz@google.com>
778
779 * layout.cc (Layout::find_or_add_kept_section): New function.
780 (Layout::add_comdat): Removed.
781 * layout.h (struct Kept_section): Move out of class Layout.
782 Remove trailing underscores from field names. Add group_sections
783 field. Rename group_ field to is_group. Change all uses.
784 (class Layout): Declare find_or_add_kept_section, not add_comdat.
785 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
786 comdat_groups_ field.
787 (Sized_relobj::include_section_group): Use
788 find_or_add_kept_section and Kept_section::group_sections.
789 (Sized_relobj::include_linkonce_section): Likewise.
790 * object.cc (class Sized_relobj): Don't define Comdat_group or
791 Comdat_group_table. Remove find_comdat_group and
792 add_comdat_group. Remove comdat_groups_ field.
793 * plugin.cc (include_comdat_group): Use
794 Layout::find_or_add_kept_section.
795
b4ecf66b
ILT
7962009-02-28 Ian Lance Taylor <iant@google.com>
797
14359ca0
ILT
798 * README: --gc-sections and map files are now supported. Document
799 some build requirements.
800
b4ecf66b
ILT
801 PR 6992
802 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
803 relocatable link set the value of the section symbol to zero.
804 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
805 relocatable link don't include the section address in the local
806 symbol value.
807
0602e05a
ILT
8082009-02-27 Ian Lance Taylor <iant@google.com>
809
fd9d194f
ILT
810 PR 6811
811 * options.h (class Search_directory): Add is_system_directory.
812 (class General_options): Declare is_in_system_directory.
813 * options.cc (get_relative_sysroot): Make static.
814 (get_default_sysroot): Make static.
815 (General_optoins::is_in_system_directory): New function.
816 * fileread.cc (Input_file::is_in_system_directory): New function.
817 * fileread.h (class Input_file): Declare is_in_system_directory.
818 * object.h (class Object): Add is_in_system_directory.
819 (class Input_objects): Remove system_library_directory_ field.
820 * object.cc (Input_objects::add_object): Don't set
821 system_library_directory_.
822 (input_objects::found_in_system_library_directory): Remove.
823 * symtab.cc (Symbol_table::write_globals): Remove input_objects
824 parameter. Change all callers.
825 (Symbol_table::sized_write_globals): Likewise.
826 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
827 Call Object::is_in_system_directory.
828 * symtab.h (class Symbol_table): Update declarations.
829
61edd21f
ILT
830 PR 5990
831 * descriptors.h (Open_descriptor): Add is_on_stack field.
832 * descriptors.cc (Descriptors::open): If the descriptor is on the
833 top of the stack, remove it. Initialize is_on_stack field.
834 (Descriptors::release): Only add pod to stack if it is not on the
835 stack already.
836 (Descriptors::close_some_descriptor): Clear stack_next and
837 is_on_stack fields.
838
e29e076a
ILT
839 PR 7091
840 * output.cc (Output_section::find_starting_output_address): Rename
841 from starting_output_address; add PADDR parameter; change return
842 type.
843 * output.h (class Output_section): Declare
844 find_starting_output_address instead of starting_output_address.
845 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
846 section symbol for which we can't find a merge section.
847
0602e05a
ILT
848 PR 9836
849 * symtab.cc (Symbol_table::add_from_object): If the visibility is
850 hidden or internal, force the symbol to be local.
851 * resolve.cc (Symbol::override_visibility): Define.
852 (Symbol::override_base): Use override_visibility.
853 (Symbol_table::resolve): Likewise.
854 (Symbol::override_base_with_special): Likewise.
855 (Symbol_table::override_with_special): If the visibility is hidden
856 or internal, force the symbol to be local.
857 * symtab.h (class Symbol): Add set_visibility and
858 override_visibility.
859 * testsuite/ver_test_1.sh: New file.
860 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
861 (check_DATA): Add ver_test_1.syms.
862 (ver_test_1.syms): New target.
863 * testsuite/Makefile.in: Rebuild.
864
401a9a73
CC
8652009-02-25 Cary Coutant <ccoutant@google.com>
866
867 * layout.cc (Layout::choose_output_section): Don't rename sections
868 when using a linker script that has a SECTIONS clause.
869 * Makefile.in: Regenerate.
870
871 * testsuite/Makefile.am (script_test_5.sh): New test case.
872 * testsuite/Makefile.in: Regenerate.
873 * testsuite/script_test_5.cc: New file.
874 * testsuite/script_test_5.sh: New file.
875 * testsuite/script_test_5.t: New file.
876
f488e4b0
CC
8772009-02-13 Rafael Avila de Espindola <espindola@google.com>
878
879 * archive.cc (Archive::include_member): Update calls to add_symbols.
880 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
881 the Layout argument.
882 * dynobj.h (do_add_symbols): Add the Layout argument.
883 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
884 Layout argument.
885 * object.h (Object::add_symbols): Add the Layout argument.
886 (Object::do_add_symbols): Add the Layout argument.
887 (Sized_relobj::do_add_symbols): Add the Layout argument.
888 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
889 Unify the two versions.
890 (Add_plugin_symbols): Remove.
891 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
892 (Sized_pluginobj::do_add_symbols): Unify the two versions.
893 (Add_plugin_symbols): Remove.
894 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
895 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
896 (Add_symbols::run): Make it work with Pulginobj.
897
89dd1680
ILT
8982009-02-06 Ian Lance Taylor <iant@google.com>
899
900 * object.cc (Sized_relobj::do_layout): Make info message start
901 with lower case letter.
902
266d0a74
ILT
9032009-02-06 Mikolaj Zalewski <mikolajz@google.com>
904
602b464e
ILT
905 * binary.cc: Fix file comment.
906
266d0a74
ILT
907 * options.h (enum Incremental_disposition): Define.
908 (class General_options): Add new options: --incremental,
909 --incremental_changed, --incremental_unchanged,
910 --incremental_unknown. Add incremental_disposition_ and
911 implicit_incremental_ fields.
912 (General_options::incremental_disposition): New function.
913 (class Position_dependent_options): Add incremental_disposition
914 option.
915 (Position_dependent_options::copy_from_options): Set incremental
916 dispositions.
917 * options.cc (General_options::parse_incremental_changed): New
918 function.
919 (General_options::parse_incremental_unchanged): New function.
920 (General_options::parse_incremental_unknown): New function.
921 (General_options::General_options): Initialize new fields
922 incremental_disposition_ and implicit_incremental_.
923 (General_options::finalize): Check for uasge of --incremental-*
924 without --incremental.
925
f073bbf7
CD
9262009-02-06 Chris Demetriou <cgd@google.com>
927
928 * gold.h (gold_undefined_symbol): Change to take only a Symbol
929 pointer and to report location as the file name associated with
930 the symbol.
931 (gold_undefined_symbol_at_location): New function to replace the
932 old gold_undefined_symbol functionality.
933 * target-reloc.h (relocate_section): Update to use
934 gold_undefined_symbol_at_location.
935 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
936 Call gold_undefined_symbol function rather than gold_error.
937 * errors.h (Errors::undefined_symbol): Take location as a
938 string, rather than calculating it from a relocation.
939 * errors.cc (Errors::fatal): Print "fatal error:" before the
940 formatted message.
941 (Errors::error, Errors::error_at_location): Print "error: "
942 before the formatted message.
943 (Errors::undefined_symbol): Take location as a string, rather
944 than calculating it from a relocation.
945 (gold_undefined_symbol_at_location): New function akin to
946 old gold_undefined_symbol, calculates location from relocation.
947 (gold_undefined_symbol): Change to take only a Symbol pointer
948 and to report location as the file name associated with the symbol.
949 * testsuite/debug_msg.sh: Update for changed error messages.
950 * testsuite/undef_symbol.sh: Likewise.
951
8e94a90c
ILT
9522009-02-04 Duncan Sands <baldrick@free.fr>
953
954 PR 9812
955 * reduced_debug_output.h
956 (Output_reduced_debug_abbrev_section::failed): Use format for
957 gold_warning.
958 (Output_reduced_debug_info_section::faild): Likewise.
959
88a0e15b
ILT
9602009-01-31 Mikolaj Zalewski <mikolajz@google.com>
961
962 * script.cc (Lazy_demangler): New class.
963 (Version_script_info::get_symbol_version_helper): Demangle a
964 symbol only once.
965
5efc7cd2
CC
9662009-01-29 Cary Coutant <ccoutant@google.com>
967
968 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
969 to __tls_get_addr.
970 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
971
e0ebcf42
ILT
9722009-01-28 Ian Lance Taylor <iant@google.com>
973
5efc7cd2 974 * version.cc (version_string): Bump to 1.9.
75fe7426 975
e0ebcf42
ILT
976 * gold.h: Include <cstring> and <stdint.h>.
977 * version.cc: Include <cstdio>.
978 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
979 warning.
980 * reduced_debug_output.cc (insert_into_vector): Rename from
981 Insert_into_vector; change all callers. Use Swap_unaligned to
982 avoid aliasing issue; remove union since it is unnecessary.
983
8e2813be 9842009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
985
986 * Makefile.am (CCFILES): Add gc.cc.
987 (HFILES): Add gc.h.
988 * Makefile.in: Regenerate.
989 * gold.cc (Gc_runner): New class.
990 (queue_initial_tasks): Call garbage collection related tasks
991 when corresponding options are invoked.
992 (queue_middle_gc_tasks): New function.
993 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
994 processed early before laying out sections during garbage collection.
995 * gold.h (queue_middle_gc_tasks): New function.
996 (is_prefix_of): Move from "layout.cc".
997 * i386.cc (Target_i386::gc_process_relocs): New function.
998 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
999 * main.cc (main): Create object of class "Garbage_collection".
1000 * object.cc (Relobj::copy_symbols_data): New function.
1001 (Relobj::is_section_name_included): New function.
1002 (Sized_relobj::do_layout): Allow this function to be called twice
1003 during garbage collection and defer layout of section during the
1004 first call.
1005 * object.h (Relobj::get_symbols_data): New function.
1006 (Relobj::is_section_name_included): New function.
1007 (Relobj::copy_symbols_data): New function.
1008 (Relobj::set_symbols_data): New function.
1009 (Relobj::get_relocs_data): New function.
1010 (Relobj::set_relocs_data): New function.
1011 (Relobj::is_output_section_offset_invalid): New pure virtual function.
1012 (Relobj::gc_process_relocs): New function.
1013 (Relobj::do_gc_process_relocs): New pure virtual function.
1014 (Relobj::sd_): New data member.
1015 (Sized_relobj::is_output_section_offset_invalid): New function.
1016 (Sized_relobj::do_gc_process_relocs): New function.
1017 * options.h (General_options::gc_sections): Modify to not be a no-op.
1018 (General_options::print_gc_sections): New option.
1019 * plugin.cc (Plugin_finish::run): Remove function call to
1020 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
1021 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
1022 * reloc.cc (Read_relocs::run): Add task to process relocs and
1023 determine unreferenced sections when doing garbage collection.
1024 (Gc_process_relocs): New class.
1025 (Sized_relobj::do_gc_process_relocs): New function.
1026 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
1027 sections that are garbage collected.
1028 * reloc.h (Gc_process_relocs): New class.
1029 * sparc.cc (Target_sparc::gc_process_relocs): New function.
1030 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
1031 symbols whose corresponding sections are garbage collected.
1032 (Symbol_table::Symbol_table): Add new parameter for the garbage
1033 collection object.
1034 (Symbol_table::gc_mark_undef_symbols): New function.
1035 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1036 (Symbol_table::gc_mark_dyn_syms): New function.
1037 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
1038 as garbage.
1039 (Symbol_table::add_from_object): Likewise.
1040 (Symbol_table::add_from_relobj): When building shared objects, do not
1041 treat externally visible symbols as garbage.
1042 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
1043 table information for static and relocatable links.
1044 * symtab.h (Symbol_table::set_gc): New function.
1045 (Symbol_table::gc): New function.
1046 (Symbol_table::gc_mark_undef_symbols): New function.
1047 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1048 (Symbol_table::gc_mark_dyn_syms): New function.
1049 (Symbol_table::gc_): New data member.
1050 * target.h (Sized_target::gc_process_relocs): New pure virtual
1051 function.
1052 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
1053 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
1054
3b293544
CF
10552009-01-20 Chris Faylor <me.sourceware@sourceware.org>
1056
1057 * options.h (General_options::gc_sections): Define as a no-op for now.
1058 (General_options::no_keep_memory): Ditto.
1059 (General_options::Bshareable): Define.
1060 * options.cc (General_options::finalize): Honor -Bshareable.
1061
83d22aa8
AS
10622009-01-20 Andreas Schwab <schwab@suse.de>
1063
1064 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
1065 read the value in the contents, since we don't use it. Use the
1066 template endianness when writing.
1067 (Relocate::relocate): Use it for R_PPC_REL16_HA.
1068
cd536b21
AS
10692009-01-19 Andreas Schwab <schwab@suse.de>
1070
1071 * configure.tgt (powerpc64-*): Fix targ_obj.
1072
99e9a495
ILT
10732009-01-15 Ian Lance Taylor <iant@google.com>
1074
1075 * object.cc (Sized_relobj::write_local_symbols): Don't write out
1076 local symbols when stripping all symbols.
1077
bbbfea06
CC
10782009-01-14 Cary Coutant <ccoutant@google.com>
1079
99e9a495 1080 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 1081
0f7c0701
CC
10822009-01-14 Cary Coutant <ccoutant@google.com>
1083
1084 * archive.cc (Archive::get_elf_object_for_member): Remove call
1085 to File_read::claim_for_plugin.
1086 * descriptors.cc (Descriptors::open): Remove reference to
1087 is_claimed.
1088 (Descriptors::claim_for_plugin): Remove.
1089 * descriptors.h (Descriptors::claim_for_plugin): Remove.
1090 (Descriptors::is_claimed): Remove.
1091 (claim_descriptor_for_plugin): Remove.
1092 * fileread.cc (File_read::claim_for_plugin): Remove.
1093 * fileread.h (File_read::claim_for_plugin): Remove.
1094 (File_read::descriptor): Reopen descriptor if necessary.
1095 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
1096 (Plugin_manager::all_symbols_read): Add task parameter. Change
1097 all callers.
1098 (Plugin_manager::get_input_file): New function.
1099 (Plugin_manager::release_input_file): New function.
1100 (Pluginobj::Pluginobj): Add filesize parameter and initialize
1101 corresponding data member.
1102 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
1103 and pass to base constructor. Change all callers.
1104 (get_input_file, release_input_file): New functions.
1105 (make_sized_plugin_object): Add filesize parameter. Change all callers.
1106 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
1107 (Plugin_manager::all_symbols_read): Add task parameter.
1108 (Plugin_manager::get_input_file): New function.
1109 (Plugin_manager::release_input_file): New function.
1110 (Plugin_manager::task_): New data member.
1111 (Pluginobj::Pluginobj): Add filesize parameter.
1112 (Pluginobj::filename): New function.
1113 (Pluginobj::descriptor): New function.
1114 (Pluginobj::filesize): New function.
1115 (Pluginobj::filesize_): New data member.
1116 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
1117 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
1118 File_read::claim_for_plugin; use Object::unlock to unlock the file.
1119
1120 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
1121 with archive libraries.
1122 * testsuite/Makefile.in: Regenerate.
1123 * testsuite/plugin_test.c (struct sym_info): New type.
1124 (get_input_file, release_input_file): New static variables.
1125 (onload): Capture new transfer vector entries.
1126 (claim_file_hook): Stop reading at end of file according to filesize.
1127 Factor out parsing of readelf output into separate function.
1128 (all_symbols_read_hook): Exercise get_input_file and release_input_file
1129 APIs and get the source file name from the symbol table. Convert
1130 source file name to corresponding object file name. Print info
1131 message when adding new input files.
1132 (parse_readelf_line): New function.
1133 * testsuite/plugin_test_1.sh: Add checks for new info messages.
1134 * testsuite/plugin_test_2.sh: Likewise.
1135 * testsuite/plugin_test_3.sh: Likewise.
1136 * testsuite/plugin_test_4.sh: New test case.
1137
62a6d109
ILT
11382009-01-07 Ian Lance Taylor <iant@google.com>
1139
1140 * version.cc (version_string): Bump to 1.8.
1141
483620e8
CC
11422008-12-23 Cary Coutant <ccoutant@google.com>
1143
1144 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
1145 * plugin.cc (Plugin_manager::finish): Rename as
1146 layout_deferred_objects. Move cleanup to separate function.
1147 (Plugin_manager::cleanup): New function.
1148 (Plugin_finish::run): Call layout_deferred_objects and cleanup
1149 separately.
1150 * plugin.h (Plugin_manager::finish): Rename as
1151 layout_deferred_objects.
1152 (Plugin_manager::cleanup): New function.
1153 (Plugin_manager::cleanup_done): New field.
1154
d66a9eb3
CC
11552008-12-23 Cary Coutant <ccoutant@google.com>
1156
1157 * plugin.cc (is_visible_from_outside): New function.
1158 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
1159 so we don't return "IR only" status for exported symbols or -r links.
1160
1161 * testsuite/Makefile.am (plugin_test_3): New test case.
1162 * testsuite/Makefile.in: Regenerate.
1163 * testsuite/plugin_test_3.sh: New file.
1164
5995b570
CC
11652008-12-22 Cary Coutant <ccoutant@google.com>
1166
1167 * object.cc (Sized_relobj::layout_section): New function.
1168 (Sized_relobj::do_layout): Defer layout of input sections until after
1169 plugin has provided replacement files.
1170 (Sized_relobj::do_layout_deferred_sections): New function.
1171 * object.h (Relobj::set_section_offset): Remove virtual keyword.
1172 (Relobj::layout_deferred_sections): New function.
1173 (Relobj::do_layout_deferred_sections): New function.
1174 (Sized_relobj::do_layout_deferred_sections): New function.
1175 (Sized_relobj::layout_section): New function.
1176 (Sized_relobj::Deferred_layout): New structure.
1177 (Sized_relobj::deferred_layout_): New field.
1178 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
1179 Change all callers. Layout deferred sections.
1180 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
1181 references.
1182 (Plugin_hook::run): Move code from do_plugin_hook inline.
1183 (Plugin_hook::do_plugin_hook): Remove.
1184 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
1185 (Plugin_manager::finish): Renamed, was cleanup.
1186 (Plugin_manager::should_defer_layout): New function.
1187 (Plugin_manager::add_deferred_layout_object): New function.
1188 (Plugin_manager::Deferred_layout_list): New type.
1189 (Plugin_manager::deferred_layout_objects_): New field.
1190 (Plugin_hook::do_plugin_hook): Remove.
1191
ee769c88
ILT
11922008-12-17 Ian Lance Taylor <iant@google.com>
1193
1194 * options.h (class General_options): Add --no case for
1195 --export-dynamic.
1196
abc8dcba
CC
11972008-12-16 Cary Coutant <ccoutant@google.com>
1198
1199 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
1200 vector.
1201 (Plugin_manager::claim_file): Create plugin object even if
1202 plugin did not call the add_symbols callback.
1203 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
1204 asking for more symbols than were added.
1205 * testsuite/Makefile.am (plugin_test_1): Add test case with
1206 no global symbols.
1207 (empty.syms): New target.
1208 * testsuite/Makefile.in: Regenerate.
1209 * testsuite/plugin_test.c (claim_file_hook): Add new debug
1210 message. Don't call add_symbols if no globals.
1211 (all_symbols_read_hook): Don't provide replacement for empty
1212 claimed file.
1213
b0074644
ILT
12142008-12-12 Ian Lance Taylor <iant@google.com>
1215
68943102
ILT
1216 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
1217 r_type == 0 for a local symbol with r_sym == 0.
1218 (scan_relocatable_relocs): Pass r_sym to
1219 local_non_section_strategy.
1220 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
1221 r_sym parameter.
1222
b0074644
ILT
1223 * configure.ac: Update test for TLS descriptors: they are
1224 supported as of glibc 2.9.
1225 * configure: Rebuild.
1226
c2508178
ILT
12272008-12-11 Ian Lance Taylor <iant@google.com>
1228
1229 PR 7091
1230 * target-reloc.h (Default_scan_relocatable_relocs): For each
1231 function, map r_type == 0 to RELOC_DISCARD.
1232
2756a258
CC
12332008-12-10 Cary Coutant <ccoutant@google.com>
1234
1235 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
1236 object to override a kept COMDAT group from a plugin object.
1237
bb6f53d3
ILT
12382008-12-09 Ian Lance Taylor <iant@google.com>
1239
fbc558e1
ILT
1240 PR 7088
1241 * yyscript.y (file_cmd): Handle INPUT.
1242
bb6f53d3
ILT
1243 * testsuite/initpri1.c: Change all declarations to be full
1244 prototypes by adding void, to avoid compiler warnings.
1245
4674ecfc
CC
12462008-12-05 Rafael Avila de Espindola <espindola@google.com>
1247
1248 * options.cc (General_options::parse_plugin_opt): New.
1249 (General_options::add_plugin): The argument now is just the filename.
1250 (General_options::add_plugin_option): New.
1251 * options.h (plugin_opt): New.
1252 (add_plugin): Change argument name.
1253 (add_plugin_option): New.
1254 * plugin.cc (Plugin::load): Don't parse the plugin option.
1255 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
1256 (Plugin::add_option): New.
1257 (Plugin::args_): Change type.
1258 (Plugin::filename_): New.
1259 (Plugin_manager::add_plugin_option): New.
1260 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
1261 * testsuite/Makefile.in: Regenerate.
1262
fd06b4aa
CC
12632008-12-05 Cary Coutant <ccoutant@google.com>
1264
1265 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
1266 Handle --strip-lto-sections option.
1267 * options.h (strip_lto_sections): New option.
1268
6c52134c
CC
12692008-12-01 Cary Coutant <ccoutant@google.com>
1270
1271 * plugin.cc (ld_plugin_message): Change format parameter to const.
1272 Fix mismatch between new[] and delete.
1273
a45248e0
CC
12742008-11-14 Cary Coutant <ccoutant@google.com>
1275
1276 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
1277 instead of -1U.
1278
c82fbeee
CS
12792008-11-05 Craig Silverstein <csilvers@google.com>
1280
1281 * options.cc (General_options::parse_dynamic_list): New function.
1282 * options.h (General_options): New flags dynamic_list,
1283 dynamic_list_data, dynamic_list_cpp_new, and
1284 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
1285 (General_options::in_dynamic_list): New function.
1286 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
1287 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
1288 (Lex::can_continue_name): Likewise.
1289 (yylex): Likewise.
1290 (read_script_file): New parameter script_options.
1291 (read_dynamic_list): New function.
1292 (Script_options::define_dynamic_list): New function.
1293 (dynamic_list_keyword_parsecodes): New variable.
1294 (dynamic_list_keywords): New variable.
1295 * script.h (Script_options::define_dynamic_list): New function
1296 prototype.
1297 (read_dynamic_list): New function prototype.
1298 * symtab.cc (strprefix): New macro.
1299 (Symbol::should_add_dynsym_entry): Support dynamic_list,
1300 dynamic_list_data, dynamic_list_cpp_new, and
1301 dynamic_list_cpp_typeinfo.
1302 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
1303 (dynamic_list_expr): New rule.
1304 (dynamic_list_nodes): Likewise.
1305 (dynamic_list_node): Likewise.
1306 * testsuite/Makefile.am (dynamic_list): New test.
1307 * testsuite/Makefile.in: Regenerated.
1308 * testsuite/dynamic_list.t: New file.
1309 * testsuite/dynamic_list.sh: New file.
1310
e0bb29a5
CS
13112008-11-05 Craig Silverstein <csilvers@google.com>
1312
1313 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
1314 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
1315 (t11_last): Likewise.
1316 * testsuite/ver_test_6.c (main): Likewise.
1317
4e1e25e0
CC
13182008-10-07 Cary Coutant <ccoutant@google.com>
1319
1320 * options.c (General_options::finalize): Add check for -static and
1321 -shared.
1322 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
1323 is not empty.
1324
92f03fcb
CC
13252008-10-02 Cary Coutant <ccoutant@google.com>
1326
1327 * plugin.cc (make_sized_plugin_object): Fix conditional
1328 compilation to work when not all targets are enabled.
1329
fbd8a257
CC
13302008-09-29 Cary Coutant <ccoutant@google.com>
1331
1332 * archive.cc (Archive::get_file_and_offset): Use filename instead
1333 of name to get library path.
1334 (Archive::include_member): Unlock external member of a thin archive.
1335
1336 * testsuite/Makefile.am (TEST_AR): New variable.
1337 (thin_archive_test_1): New test.
1338 (thin_archive_test_2): New test.
81636b3f
CC
1339 * testsuite/Makefile.in: Regenerate.
1340 * testsuite/thin_archive_main.cc: New file.
1341 * testsuite/thin_archive_test_1.cc: New file.
1342 * testsuite/thin_archive_test_2.cc: New file.
1343 * testsuite/thin_archive_test_3.cc: New file.
1344 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 1345
eff45813
CC
13462008-09-29 Cary Coutant <ccoutant@google.com>
1347
1348 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
1349 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
1350 instead of -1U.
1351 (Sized_relobj::do_finalize_local_symbols): Likewise.
1352 (Sized_relobj::map_to_kept_section): Likewise.
1353 * object.h (Sized_relobj::invalid_address): New constant.
1354 (Sized_relobj::do_output_section_offset): Check for invalid_address
1355 and return -1ULL.
1356 * output.cc (Output_reloc::local_section_offset): Use constant
1357 invalid_address instead of -1U.
1358 (Output_reloc::get_address): Likewise.
1359 (Output_section::output_address): Change -1U to -1ULL.
1360 * output.h (Output_reloc::invalid_address): New constant.
1361 * reloc.cc (Sized_relobj::write_sections): Use constant
1362 invalid_address instead of -1U.
1363 (Sized_relobj::relocate_sections): Likewise.
1364 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
1365 values for merge sections.
1366 * target-reloc.h (relocate_for_relocatable): Use constant
1367 invalid_address instead of -1U.
1368
89fc3421
CC
13692008-09-19 Cary Coutant <ccoutant@google.com>
1370
1371 Add plugin functionality for link-time optimization (LTO).
1372 * configure.ac (plugins): Add --enable-plugins option.
1373 * configure: Regenerate.
1374 * config.in: Regenerate.
1375 * Makefile.am (LIBDL): New variable.
1376 (CCFILES): Add plugin.cc.
1377 (HFILES): Add plugin.h.
1378 (ldadd_var): Add LIBDL.
1379 * Makefile.in: Regenerate.
1380
1381 * archive.cc: Include "plugin.h".
1382 (Archive::setup): Don't preread archive symbols when using a plugin.
1383 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
1384 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
1385 files.
1386 (Archive::include_member): Add symbols from plugin objects.
1387 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
1388 * descriptors.cc (Descriptors::open): Check for file descriptors
1389 abandoned by plugins.
1390 (Descriptors::claim_for_plugin): New function.
1391 * descriptors.h (Descriptors::claim_for_plugin): New function.
1392 (Open_descriptor::is_claimed): New field.
1393 (claim_descriptor_for_plugin): New function.
1394 * fileread.cc (File_read::claim_for_plugin): New function.
1395 * fileread.h (File_read::claim_for_plugin): New function.
1396 (File_read::descriptor): New function.
1397 * gold.cc: Include "plugin.h".
1398 (queue_initial_tasks): Add task to call plugin hooks for generating
1399 new object files.
1400 * main.cc: Include "plugin.h".
1401 (main): Load plugin libraries.
1402 * object.h (Pluginobj): Declare.
1403 (Object::pluginobj): New function.
1404 (Object::do_pluginobj): New function.
1405 (Object::set_target): New function.
1406 * options.cc: Include "plugin.h".
1407 (General_options::parse_plugin): New function.
1408 (General_options::General_options): Initialize plugins_ field.
1409 (General_options::add_plugin): New function.
1410 * options.h (Plugin_manager): Declare.
1411 (General_options): Add --plugin option.
1412 (General_options::has_plugins): New function.
1413 (General_options::plugins): New function.
1414 (General_options::add_plugin): New function.
1415 (General_options::plugins_): New field.
1416 * plugin.cc: New file.
1417 * plugin.h: New file.
1418 * readsyms.cc: Include "plugin.h".
1419 (Read_symbols::do_read_symbols): Check for archive before checking
1420 for ELF file. Call plugin hooks to claim files.
1421 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
1422 from a real object file; force override when processing replacement
1423 files.
1424 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
1425 (Symbol::init_base_object): Likewise.
1426 (Symbol::init_base_output_data): Likewise.
1427 (Symbol::init_base_output_segment): Likewise.
1428 (Symbol::init_base_constant): Likewise.
1429 (Symbol::init_base_undefined): Likewise.
1430 (Symbol::output_section): Assert that object is not a plugin.
1431 (Symbol_table::add_from_pluginobj): New function.
1432 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
1433 undefined.
1434 (Symbol_table::sized_write_globals): Likewise.
1435 (Symbol_table::add_from_pluginobj): Instantiate template.
1436 * symtab.h (Sized_pluginobj): Declare.
1437 (Symbol::in_real_elf): New function.
1438 (Symbol::set_in_real_elf): New function.
1439 (Symbol::in_real_elf_): New field.
1440 (Symbol_table::add_from_pluginobj): New function.
1441
1442 * testsuite/Makefile.am (AM_CFLAGS): New variable.
1443 (LIBDL): New variable.
1444 (LDADD): Add LIBDL.
1445 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
1446 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
1447 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
1448 (MOSTLYCLEANFILES): Likewise.
1449 * testsuite/Makefile.in: Regenerate.
1450 * testsuite/plugin_test.c: New file.
1451 * testsuite/plugin_test_1.sh: New file.
1452 * testsuite/plugin_test_2.sh: New file.
1453
de31bda5
ILT
14542008-09-16 Ian Lance Taylor <iant@google.com>
1455
9c2d0ef9
ILT
1456 * target-reloc.h (relocate_section): Check whether a symbol is
1457 defined by the ABI before reporting an undefined symbol error.
1458 * target.h (Target::is_defined_by_abi): Make parameter const.
1459 (Target::do_is_defined_by_abi): Likewise.
1460 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
1461 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
1462 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
1463 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
1464 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
1465 * testsuite/Makefile.in: Rebuild.
1466
de31bda5
ILT
1467 * fileread.cc (make_view): Add casts to avoid warning.
1468
9fa33bee
AO
14692008-09-16 Alexandre Oliva <aoliva@redhat.com>
1470
1471 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
1472 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
1473
183fd0e3
AO
14742008-09-16 Alexandre Oliva <aoliva@redhat.com>
1475
1476 * options.h (General_options::output_is_executable): New.
1477 (General_options::output_is_pie): New.
1478 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
1479 for shared libraries.
1480 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
1481
7be8330a
CD
14822008-09-11 Chris Demetriou <cgd@google.com>
1483
1484 * options.h (origin): New -z option.
1485 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
1486 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
1487 in DT_FLAGS_1.
1488
a9caad02
CC
14892008-09-05 Cary Coutant <ccoutant@google.com>
1490
1491 * fileread.cc (File_read::make_view): Add check for attempt to map
1492 beyond end of file.
1493
ae6dce4d
CC
14942008-09-05 Cary Coutant <ccoutant@google.com>
1495
1496 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
1497 explicit instantiations.
1498
d7ab2a47
KVH
14992008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
1500
1501 PR gold/6858
1502 * options.cc (General_options::finalize): Allow undefined symbols
1503 in shlibs if linking -shared.
1504
1505 PR gold/6859
1506 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
1507 symbols as not needing a dynsym entry.
1508
1e52a9c1
CS
15092008-08-20 Craig Silverstein <csilvers@google.com>
1510
1511 * fileread.cc (File_read::open): Do not lock the file unless it
1512 was successfully opened.
1513
d85c80a3
CC
15142008-08-14 Cary Coutant <ccoutant@google.com>
1515
1516 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
1517 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
1518 * testsuite/tls_test.cc (struct int128): 128-bit struct
1519 for testing TLS relocs with non-zero addend.
1520 (v12): New TLS variable.
1521 (t12): New test.
1522 (t_last): Add check for v12.
1523 * testsuite/tls_test.h (t12): New function.
1524 * testsuite/tls_test_main.cc (thread_routine): Call new test.
1525
2d924fd9
ILT
15262008-08-13 Ian Lance Taylor <iant@google.com>
1527
1528 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
1529 set tls_segment_ or relro_segment_.
1530 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
1531 when appropriate.
1532 * output.h (Output_section::clear_is_relro): New function.
1533 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
1534 sections specially even when output_data_ is empty.
1535 (Output_segment::maximum_alignment): When first section is relro,
1536 only force alignment for PT_LOAD segments.
1537 * script.cc (script_data_segment_align): New function.
1538 (script_data_segment_relro_end): New function.
1539 * script-c.h (script_data_segment_align): Declare.
1540 (script_data_segment_relro_end): Declare.
1541 * script-sections.h (class Script_sections): Declare
1542 data_segment_align and data_segment_relro_end. Add fields
1543 segment_align_index_ and saw_relro_end_.
1544 * script-sections.cc (class Sections_element): Add set_is_relro
1545 virtual function. Add new bool* parameter to place_orphan_here.
1546 Add get_output_section virtual function.
1547 (class Output_section_definition): Add set_is_relro. Add new
1548 bool* parameter to place_orphan_here. Add get_output_section.
1549 Add is_relro_ field.
1550 (Output_section_definition::Output_section_definition): Initialize
1551 evaluated_address_, evaluated_load_address, evaluated_addralign_,
1552 and is_relro_ fields.
1553 (Output_section_definition::place_orphan_here): Add is_relro
1554 parameter.
1555 (Output_section_definition::set_section_addresses): Set relro for
1556 output section.
1557 (Output_section_definition::alternate_constraint): Likewise.
1558 (class Orphan_output_section): Add new bool* parameter to
1559 place_orphan_here. Add get_output_section.
1560 (Orphan_output_section::place_orphan_here): Add is_relro
1561 parameter.
1562 (Script_sections::Script_sections): Initialize
1563 data_segment_align_index_ and saw_relro_end_.
1564 (Script_sections::data_segment_align): New function.
1565 (Script_sections::data_segment_relro_end): New function.
1566 (Script_sections::place_orphan): Set or clear is_relro.
1567 (Script_sections::set_section_addresses): Force alignment of first
1568 TLS section.
1569 * yyscript.y (exp): Call script_data_segment_align and
1570 script_data_segment_relro_end.
1571 * testsuite/relro_script_test.t: New file.
1572 * testsuite/relro_test.cc (using_script): Declare.
1573 (t1, t2): Test using_script.
1574 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
1575 (relro_script_test_SOURCES): Define.
1576 (relro_script_test_DEPENDENCIES): Define.
1577 (relro_script_test_LDFLAGS): Define.
1578 (relro_script_test_LDADD): Define.
1579 (relro_script_test.so): New target.
1580 * testsuite/Makefile.in: Rebuild.
1581
f827c9a9
CC
15822008-08-06 Cary Coutant <ccoutant@google.com>
1583
1584 * archive.cc (Archive::total_archives, Archive::total_members)
1585 (Archive::total_members_loaded): New variables.
1586 (Archive::setup): Add parameter. Add option to preread
1587 archive symbols.
1588 (Archive::read_armap): Add counter.
1589 (Archive::get_file_and_offset): New function.
1590 (Archive::get_elf_object_for_member): New function.
1591 (Archive::read_all_symbols): New function.
1592 (Archive::read_symbols): New function.
1593 (Archive::add_symbols): Add counters.
1594 (Archive::include_all_members): Use armap to find members if it's
1595 already built.
1596 (Archive::include_member): Skip reading symbols if already read.
1597 Factored code into Archive::get_file_and_offset and
1598 Archive::get_elf_object_for_member. Changed call to
1599 Mapfile::report_include_archive_member.
1600 (Archive::print_stats): New function.
1601 * archive.h: Declare Object and Read_symbols_data classes.
1602 (Archive::Archive): Add initializers for new members.
1603 (Archive::setup): Add parameter.
1604 (Archive::print_stats): New function.
1605 (Archive::total_archives, Archive::total_members)
1606 (Archive::total_members_loaded): New variables.
1607 (Archive::get_file_and_offset): New function.
1608 (Archive::get_elf_object_for_member): New function.
1609 (Archive::read_all_symbols): New function.
1610 (Archive::read_symbols): New function.
1611 (Archive::Archive_member): New class.
1612 (Archive::members_): New member.
1613 (Archive::num_members_): New member.
1614 * main.cc: Include archive.h.
1615 (main): Call Archive::print_stats.
1616 * mapfile.cc (Mapfile::report_include_archive_member): Delete
1617 archive parameter; member_name is now the fully-decorated name.
1618 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
1619 * options.h: (General_options): Add --preread-archive-symbols option.
1620 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
1621 Archive::setup.
1622
de4c45bd
ILT
16232008-08-04 Ian Lance Taylor <iant@google.com>
1624
1625 * symtab.h (Symbol::use_plt_offset): New function.
1626 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
1627 * powerpc.cc (Relocate::relocate): Likewise.
1628 * sparc.cc (Relocate::relocate): Likewise.
1629 * x86_64.cc (Relocate::relocate): Likewise.
1630 * testsuite/weak_plt.sh: New test.
1631 * testsuite/weak_plt_main.cc: New test.
1632 * testsuite/weak_plt_shared.cc: New test.
1633 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
1634 (check_PROGRAMS): Add weak_plt.
1635 (check_DATA): Add weak_plt_shared.so.
1636 (weak_plt_main_pic.o, weak_plt): New targets.
1637 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
1638 * testsuite/Makefile.in: Rebuild.
1639
1640 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
1641 gcctestdir/ld.
1642 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
1643 * testsuite/Makefile.in: Rebuild.
1644
323ee3f4
AM
16452008-08-04 Alan Modra <amodra@bigpond.net.au>
1646
1647 * Makefile.am (POTFILES.in): Set LC_ALL=C.
1648 * Makefile.in: Regenerate.
1649 * po/POTFILES.in: Regenerate.
1650
7c07ecec
ILT
16512008-07-29 Ian Lance Taylor <iant@google.com>
1652
1653 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
1654 symbols before other symbols.
1655 * testsuite/script_test_2.cc (test_addr): Declare.
1656 (test_addr_alias): Declare.
1657 (main): Check that test_addr and test_addr_alias have the right
cd536b21 1658 values.
7c07ecec
ILT
1659 * testsuite/script_test_2.t: Define test_addr_alias and
1660 test_addr.
1661
5778530e
ILT
16622008-07-24 Ian Lance Taylor <iant@google.com>
1663
2a00e4fb
ILT
1664 PR 5990
1665 * descriptors.cc: New file.
1666 * descriptors.h: New file.
1667 * gold-threads.h (class Hold_optional_lock): New class.
1668 * fileread.cc: Include "descriptors.h".
1669 (File_read::~File_read): Release descriptor rather than closing
1670 it.
1671 (File_read::open) [file]: Call open_descriptor rather than open.
1672 Set is_descriptor_opened_.
1673 (File_read::open) [memory]: Assert that descriptor is not open.
1674 (File_read::reopen_descriptor): New function.
1675 (File_read::release): Release descriptor.
1676 (File_read::do_read): Make non-const. Reopen descriptor.
1677 (File_read::read): Make non-const.
1678 (File_read::make_view): Reopen descriptor.
1679 (File_read::do_readv): Likewise.
1680 * fileread.h (class File_read): Add is_descriptor_opened_ field.
1681 Update declarations.
1682 * layout.cc: Include "descriptors.h".
1683 (Layout::create_build_id): Use open_descriptor rather than open.
1684 * output.cc: Include "descriptors.h".
1685 (Output_file::open): Use open_descriptor rather than open.
1686 * archive.cc (Archive::const_iterator): Change Archive to be
1687 non-const.
1688 (Archive::begin, Archive::end): Make non-const.
1689 (Archive::count_members): Likewise.
1690 * archive.h (class Archive): Update declarations.
1691 * object.h (Object::read): Make non-const.
1692 * Makefile.am (CCFILES): Add descriptors.cc.
1693 (HFILES): Add descriptors.h.
1694 * Makefile.in: Rebuild.
1695
801647d1
ILT
1696 PR 6716
1697 * gold.h: Always include <clocale>. Add Solaris workarounds
1698 following code in binutils/sysdep.h.
1699
5edd166e
ILT
1700 PR 6048
1701 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
1702 this->eh_frame_hdr_ is NULL before using it.
1703
c89ad728
ILT
1704 * dynobj.cc (Versions::Versions): Update comment.
1705
aa86f06b
ILT
1706 * dynobj.cc (Versions::Versions): If there is an soname, use it as
1707 the base version name.
1708
5778530e
ILT
1709 * stringpool.cc (Stringpool_template::add_with_length): Set key to
1710 array size plus one.
1711 (Stringpool_template::set_string_offsets): Subtract one from key
1712 before using it as an array index.
1713 (Stringpool_template::get_offset_with_length): Likewise.
1714 (Stringpool_template::write_to_buffer): Likewise.
1715 * stringpool.h (Stringpool_template::get_offset_from_key):
1716 Likewise.
1717
057ead22
ILT
17182008-07-23 Ian Lance Taylor <iant@google.com>
1719
7f649c59
ILT
1720 PR 6658
1721 * object.h (Merged_symbol_value::value): Do our best to handle a
1722 negative addend.
1723
057ead22
ILT
1724 PR 6647
1725 * script.cc (Version_script_info::get_versions): Don't add empty
1726 version tag to return value.
1727 (Version_script_info::get_symbol_version_helper): Change return
1728 type to bool. Add pversion parameter. Change all callers.
1729 (script_register_vers_node): Don't require a non-NULL tag.
1730 * script.h (class Version_script_info): Update declarations.
1731 (Version_script_info::get_symbol_version): Change return type to
1732 bool. Add version parameter. Change all callers.
1733 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
1734 handling. Handle an empty version from a version script.
1735 (Symbol_table::define_special_symbol): Likewise.
1736 * testsuite/ver_test_10.script: New file.
1737 * testsuite/ver_test_10.sh: New file.
1738 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
1739 (check_DATA): Add ver_test_10.syms.
1740 (ver_test_10.syms, ver_test_10.so): New target.
1741 * testsuite/Makefile.in: Rebuild.
1742
58e54ac2
CD
17432008-07-23 Simon Baldwin <simonb@google.com>
1744
1745 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
1746 to zero for undefined symbols from dynamic libraries.
1747
95d14cd3
ILT
17482008-07-23 Ian Lance Taylor <iant@google.com>
1749
1750 * symtab.cc (Symbol_table::resolve): Remove version parameter.
1751 Change all callers.
1752 * symtab.h (class Symbol_table): Update declaration.
1753 * testsuite/ver_test_9.cc: New file.
1754 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
1755 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
1756 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
1757 (ver_test_9.so, ver_test_9.o): New targets.
1758 * testsuite/Makefile.in: Rebuild.
1759
92de84a6
ILT
17602008-07-22 Ian Lance Taylor <iant@google.com>
1761
34810851
ILT
1762 * options.h (class General_options): Define --check-sections.
1763 * layout.cc (Layout::set_segment_offsets): Handle
1764 --check-sections.
1765
af6156ef
ILT
1766 * options.h (class General_options): Define -n/--nmagic and
1767 -N/--omagic.
1768 * options.cc (General_options::finalize): For -n/--nmagic or
1769 -N/--omagic, set -static.
1770 * layout.cc (Layout::attach_allocated_section_to_segment): If
1771 -N/--omagic, don't put read-only and read-write sections in
1772 different segments.
1773 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
1774 finding a read-only segment.
1775 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
1776 don't set the minimum segment alignment to the common page size,
1777 and don't set the file offset to the address modulo the page size.
1778 * script-sections.cc (Script_sections::create_segments): If
1779 -n/--omagic, don't put read-only and read-write sections in
1780 different segments.
1781
92de84a6
ILT
1782 * cref.cc: New file.
1783 * cref.h: New file.
1784 * options.h (class General_options): Add --print-symbol-counts.
1785 * main.cc (main): Issue defined symbol report if requested.
1786 * archive.cc (Archive::interpret_header): Make into a const member
1787 function.
1788 (Archive::add_symbols): Call Input_objects::archive_start and
1789 archive_stop.
1790 (Archive::const_iterator): Define new class.
1791 (Archive::begin, Archive::end): New functions.
1792 (Archive::include_all_members): Rewrite to use iterator.
1793 (Archive::count_members): New function.
1794 * archive.h (class Archive): Update declarations.
1795 (Archive::filename): New function.
1796 * object.cc: Include "cref.h".
1797 (Sized_relobj::Sized_relobj): Initialize defined_count_.
1798 (Sized_relobj::do_get_global_symbol_counts): New function.
1799 (Input_objects::add_object): Add object to cross-referencer.
1800 (Input_objects::archive_start): New function.
1801 (Input_objects::archive_stop): New function.
1802 (Input_objects::print_symbol_counts): New function.
1803 * object.h: Declare Cref and Archive.
1804 (Object::get_global_symbol_counts): New function.
1805 (Object::do_get_global_symbol_counts): New pure virtual function.
1806 (class Sized_relobj): Add defined_count_ field. Update
1807 declarations.
1808 (class Input_objects): Add cref_ field. Update constructor.
1809 Update declarations.
1810 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
1811 defined_count_.
1812 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
1813 symbol counts.
1814 (Sized_dynobj::do_get_global_symbol_counts): New function.
1815 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
1816 defined_count_. Update declarations. Define Symbols typedef.
1817 * symtab.cc (Symbol_table::add_from_relobj): Add defined
1818 parameter. Change all callers.
1819 (Symbol_table::add_from_dynobj): Add sympointers and defined
1820 parameters. Change all callers.
1821 * symtab.h (class Symbol_table): Update declarations.
1822 * Makefile.am (CCFILES): Add cref.cc.
1823 (HFILES): Add cref.h.
1824 * Makefile.in: Rebuild.
1825
3f7c5e1d
CD
18262008-07-22 Simon Baldwin <simonb@google.com>
1827
1828 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
1829 to zero when writing undefined symbols.
1830
e0b64032
ILT
18312008-07-22 Ian Lance Taylor <iant@google.com>
1832
1833 * output.cc (Output_section::add_input_section): Don't try to
1834 merge empty merge sections.
1835
096b02cf
CS
18362008-07-21 Craig Silverstein <csilvers@google.com>
1837
1838 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1839 Include symbol version in error message.
cd536b21 1840
1d1f116d
CD
18412008-07-20 Chris Demetriou <cgd@google.com>
1842
cd536b21 1843 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
1844 (RANDOM_SEED_CFLAGS): New substituted variable.
1845 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
1846 * configure: Rebuild.
1847 * Makefile.in: Likewise.
1848 * testsuite/Makefile.in: Likewise.
1849
a18f591e
ILT
18502008-07-18 Ian Lance Taylor <iant@google.com>
1851
1852 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
1853 where we see NAME/NULL and NAME/VERSION as separate symbols.
1854 * testsuite/ver_test_main.cc (main): Call t4.
1855 (t4, t4_2a): Define.
1856 * testsuite/ver_test_2.cc (t4_2): Define.
1857 * testsuite/ver_test_2.script: Put t4_2a in VER2.
1858 * testsuite/ver_test_4.cc (t4_2a): Define.
1859 * testsuite/ver_test_4.script: Put t4_2a in VER2.
1860 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
1861
c6e3f6ed
ILT
18622008-07-17 Ian Lance Taylor <iant@google.com>
1863
1864 * dynobj.cc (Versions::add_def): If we give an error about a
1865 missing version, go ahead and create the version anyhow.
1866
ef9beddf
ILT
18672008-07-10 Ian Lance Taylor <iant@google.com>
1868
1869 Handle output sections with more than 0x7fffffff bytes.
1870 * object.h (class Relobj): Change map_to_output_ to
1871 output_sections_, and just keep a section pointer. Change all
1872 uses. Move comdat group support to Sized_relobj.
1873 (Relobj::is_section_specially_mapped): Remove.
1874 (Relobj::output_section): Remove poff parameter. Change all
1875 callers.
1876 (Relobj::output_section_offset): New function.
1877 (Relobj::set_section_offset): Rewrite.
1878 (Relobj::map_to_output): Remove.
1879 (Relobj::output_sections): New function.
1880 (Relobj::do_output_section_offset): New pure virtual function.
1881 (Relobj::do_set_section_offset): Likewise.
1882 (class Sized_relobj): Add section_offsets_ field. Add comdat
1883 group support from Relobj. Update declarations.
1884 (Sized_relobj::get_output_section_offset): New function.
1885 (Sized_relobj::do_output_section_offset): New function.
1886 (Sized_relobj::do_set_section_offset): New function.
1887 * object.cc (Relobj::output_section_address): Remove.
1888 (Sized_relobj::Sized_relobj): Initialize new fields.
1889 (Sized_relobj::include_section_group): Cast find_kept_object to
1890 Sized_relobj.
1891 (Sized_relobj::include_linkonce_section): Likewise.
1892 (Sized_relobj::do_layout): Use separate arrays for output section
1893 and output offset.
1894 (Sized_relobj::do_count_local_symbols): Change map_to_output to
1895 output_sections.
1896 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
1897 output_sections and section_offsets.
1898 (Sized_relobj::write_local_symbols): Likewise.
1899 (map_to_kept_section): Compute output address directly.
1900 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
1901 output_sections and section_offsets.
1902 (Sized_relobj::write_sections): Likewise.
1903 (Sized_relobj::relocate_sections): Likewise.
1904 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
1905 * output.h (class Output_reloc): Update declarations. Change
1906 u2_.relobj to Sized_relobj*.
1907 (class Output_data_reloc): Change add functions to use
1908 Sized_relobj*.
1909 * output.cc (Output_reloc::Output_reloc): Change relobj to
1910 Sized_relobj*.
1911 (Output_reloc::local_section_offset): Change return type to
1912 Elf_Addr. Use get_output_section_offset.
1913 (Output_reloc::get_address): Likewise.
1914 (Output_section::is_input_address_mapped): Don't call
1915 is_section_specially_mapped.
1916 (Output_section::output_offset): Likewise.
1917 (Output_section::output_address): Likewise.
1918 (Output_section::starting_output_address): Likewise.
1919 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
1920 parameter to Sized_relobj*.
1921 (Copy_relocs::need_copy_reloc): Likewise.
1922 (Copy_relocs::save): Likewise.
1923 * copy-relocs.h (class Copy_relocs): Update declarations.
1924 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
1925 Sized_relobj*. Change relobj_ field to Sized_relobj*.
1926 * target-reloc.h (relocate_for_relocatable): Change
1927 offset_in_output_section type to Elf_Addr. Change code that uses
1928 it as well.
1929 * layout.cc (Layout::layout): Always set *off.
1930 * mapfile.cc (Mapfile::print_input_section): Use
1931 output_section_offset.
1932 * i386.cc (Target_i386::copy_reloc): Change object parameter to
1933 Sized_relobj*.
1934 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
1935 * sparc.cc (Target_sparc::copy_reloc): Likewise.
1936 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
1937
5cb66f97
ILT
19382008-07-03 Ian Lance Taylor <iant@google.com>
1939
1940 * layout.cc (Layout::include_section): Do not discard unrecognized
1941 SHT_STRTAB sections.
1942
afe47622
CS
19432008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
1944
1945 * script.cc (Lex::can_continue_name): Make '?' allowable in
1946 version-script names.
1947 * testsuite/version_script.map: Change glob pattern to use '?'
1948
5adf9721
ILT
19492008-06-30 Manish Singh <yosh@gimp.org>
1950
1951 PR 6585
1952 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
1953 Correct typo.
1954
e6fde208
ILT
19552008-06-30 Ian Lance Taylor <iant@google.com>
1956
1957 PR 6660
1958 PR 6682
1959 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
1960 versions]: Don't try to read the value in the contents, since we
1961 don't use it. Use the template endianness when writing.
1962
3f2e6a2d
CC
19632008-06-25 Cary Coutant <ccoutant@google.com>
1964
1965 * fileread.cc (File_read::make_view): Assert on zero-length view.
1966 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
1967 symbol table when there are no symbols to read.
1968
c43d3a48
CS
19692008-06-23 Craig Silverstein <csilvers@google.com>
1970
1971 * version.cc (version_string): Bump to 1.7
1972
5f494ea0
CS
19732008-06-18 Craig Silverstein <csilvers@google.com>
1974
1975 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
1976 constant 0xFFFF to type Valtype.
1977 (Powerpc_relocate_functions::rel16_ha): Likewise.
1978
c42e122e
ILT
19792008-06-17 Ian Lance Taylor <iant@google.com>
1980
f34787f8
ILT
1981 * output.h (Output_section::Input_section): Initialize p2align_ to
1982 zero for Output_section_data constructors.
1983 (Output_section::Input_section::addralign): If not an input
1984 section, return the alignment of the Output_section_data.
1985 * testsuite/copy_test.cc: New file.
1986 * testsuite/copy_test_1.cc: New file.
1987 * testsuite/copy_test_2.cc: New file.
1988 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
1989 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
1990 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
1991 (copy_test_1_pic.o, copy_test_1.so): New targets.
1992 (copy_test_2_pic.o, copy_test_2.so): New targets.
1993 * testsuite/Makefile.in: Rebuild.
1994
c42e122e
ILT
1995 * script-sections.cc (Script_sections::place_orphan): Initialize
1996 local variable exact.
1997
ce3ac18a
DE
19982008-06-13 David Edelsohn <edelsohn@gnu.org>
1999
2000 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
2001
42cacb20
DE
20022008-06-12 David Edelsohn <edelsohn@gnu.org>
2003 David S. Miller <davem@davemloft.net>
2004
2005 * powerpc.cc: New file.
2006 * Makefile.am (TARGETSOURCES): Add powerpc.cc
2007 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
2008 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
2009 * Makefile.in: Rebuild.
2010
7b308235
ILT
20112008-06-09 Ian Lance Taylor <iant@google.com>
2012
2013 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
2014 <exception>.
2015 (throwing, orig_terminate): New static variables.
2016 (terminate_handler): New static function.
2017 (t2): Set terminate handler.
2018
f0b886e3
ILT
20192008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
2020
2021 PR 6584
cd536b21 2022 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
2023 alignment.
2024
3e90f135
CC
20252008-05-30 Cary Coutant <ccoutant@google.com>
2026
2027 * archive.cc (Archive::include_all_members) Correct to step
2028 over symbol table and extended name table in thin archives.
2029
e09ad04a
ILT
20302008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
2031
2032 PR 6407
2033 * target-reloc.h (relocate_for_relocatable): Fix new_offset
2034 calculation.
2035
62b01cb5
ILT
20362008-05-28 Caleb Howe <cshowe@google.com>
2037
2038 * reduced_debug_output.cc: New file.
2039 * reduced_debug_output.h: New file.
92de84a6 2040 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
2041 * options.cc (General_options::finalize): Add strip_debug_non_line
2042 to the strip heirarchy.
2043 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
2044 fields.
2045 * layout.cc: Include "reduced_debug_output.h".
2046 (Layout::Layout): Initialize new fields.
2047 (line_only_debug_sections): New static array.
2048 (is_lines_only_debug_sections): New static inline function.
2049 (Layout::include_section): Handle --strip-debug-non-line.
2050 (Layout::make_output_section): If --strip-debug-non-line, build
2051 new output sections for .debug_abbrev and .debug_info.
2052 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
2053 gold. Warn about possible overflow.
2054 (read_signed_LEB_128): Likewise.
2055 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
2056 (read_signed_LEB_128): Declare.
2057 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
2058 (HFILES): Add reduced_debug_output.h.
2059 * Makefile.in: Rebuild.
2060
7d9e3d98
ILT
20612008-05-21 Ian Lance Taylor <iant@google.com>
2062
2063 * mapfile.cc: New file.
2064 * mapfile.h: New file.
2065 * options.h (class General_options): Add -M/--print-map and -Map.
2066 * options.cc (General_options::finalize): Make -M equivalent to
2067 -Map -.
2068 * main.cc: Include <cstdio> and "mapfile.h".
2069 (main): Open mapfile if requested.
2070 * gold.cc (class Middle_runner): Add mapfile_ field. Update
2071 constructor. Change caller.
2072 (queue_initial_tasks): Add mapfile parameter. Change caller.
2073 (queue_middle_tasks): Likewise.
2074 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
2075 declarations.
2076 * archive.cc: Include "mapfile.h".
2077 (Archive::add_symbols): Add mapfile parameter. Change all
2078 callers. Pass mapfile, symbol, and reason to include_member.
2079 (Archive::include_all_members): Add mapfile parameter. Change all
2080 callers.
2081 (Archive::include_member): Add mapfile, sym, and why parameters.
2082 Change all callers. Report inclusion to map file.
2083 * archive.h: Include "fileread.h".
2084 (class Archive): Update declarations.
2085 (Archive::file): New const method.
2086 (class Add_archive_symbols): Add mapfile_ field. Update
2087 constructor. Change all callers.
2088 * readsyms.h (class Read_symbols): Likewise.
2089 (class Finish_group): Likewise.
2090 (class Read_script): Likewise.
2091 * common.cc: Include "mapfile.h".
2092 (Symbol_table::allocate_commons): Add mapfile parameter. Change
2093 all callers.
2094 (Symbol_table::do_allocate_commons): Likewise.
2095 (Symbol_table::do_allocate_commons_list): Likewise. Report common
2096 symbol allocation to mapfile.
2097 * common.h (class Allocate_commons_task): Add mapfile_ field.
2098 Update constructor. Change all callers.
2099 * symtab.h (class Symbol_table): Update declarations.
2100 * layout.cc: Include "mapfile.h".
2101 (Layout_task_runner::run): Print information to mapfile.
2102 (Layout::create_gold_note): Change Output_data_fixed_space to
2103 Output_data_zero_fill.
2104 (Layout::create_build_id): Likewise.
2105 (Layout::print_to_mapfile): New function.
2106 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
2107 constructor. Change caller.
2108 (class Layout): Declare print_to_mapfile.
2109 * output.cc (Output_section::Input_section::print_to_mapfile): New
2110 function.
2111 (Output_section::add_input_section): If producing a map, always
2112 add to input_sections_ list.
2113 (Output_section::do_print_to_mapfile): New function.
2114 (Output_segment::print_sections_to_mapfile): New function.
2115 (Output_segment::print_section_list_to_mapfile): New function.
2116 * output.h: Include "mapfile.h".
2117 (Output_data::print_to_mapfile): New function.
2118 (Output_data::do_print_to_mapfile): New virtual function.
2119 (Output_segment_headers::do_print_to_mapfile): New function.
2120 (Output_file_header::do_print_to_mapfile): New function.
2121 (Output_data_const::do_print_to_mapfile): New function.
2122 (class Output_data_const_buffer): Add map_name_ field. Update
2123 constructor. Change all callers. Add do_print_to_mapfile
2124 function.
2125 (class Output_data_fixed_space): Likewise.
2126 (class Output_data_space): Likewise.
2127 (class Output_data_zero_fill): New class.
2128 (Output_data_strtab::do_print_to_mapfile): New function.
2129 (Output_data_reloc_base::do_print_to_mapfile): New function.
2130 (Output_relocatable_relocs::do_print_to_mapfile): New function.
2131 (Output_data_group::do_print_to_mapfile): New function.
2132 (Output_data_got::do_print_to_mapfile): New function.
2133 (Output_data_dynamic::do_print_to_mapfile): New function.
2134 (Output_symtab_xindex::do_print_to_mapfile): New function.
2135 (class Output_section): Declare do_print_to_mapflie. Declare
2136 print_to_mapfile in Input_section.
2137 (class Output_segment): Declare new functions.
2138 * object.h (Sized_relobj::symbol_count): New function.
2139 * script-sections.cc
2140 (Output_section_element_dot_assignment::set_section_addresses):
2141 Change Output_data_fixed_space to Output_data_zero_fill.
2142 (Output_data_expression::do_print_to_mapfile): New function.
2143 * script.cc (read_input_script): Add mapfile parameter. Change
2144 all callers.
2145 * script.h (read_input_script): Update declaration.
2146 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
2147 (Eh_frame::do_print_to_mapfile): New function.
2148 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
2149 (Output_merge_string::do_print_to_mapfile): New function.
2150 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
2151 function.
2152 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
2153 function.
2154 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
2155 function.
2156 * Makefile.am (CCFILES): Add mapfile.cc.
2157 (HFILES): Add mapfile.h.
2158 * Makefile.in: Rebuild.
2159
9f1d377b
ILT
21602008-05-19 Ian Lance Taylor <iant@google.com>
2161
2162 * options.h (class General_options): Add -z relro.
2163 * layout.cc (Layout::Layout): Initialize relro_segment_.
2164 (Layout::add_output_section_data): Return the output section.
2165 (Layout::make_output_section): Rcognize relro sections and mark
2166 them appropriately.
2167 (Layout::attach_allocated_section_to_segment): Put relro sections
2168 in a PT_GNU_RELRO segment.
2169 (Layout::create_initial_dynamic_sections): Mark the .dynamic
2170 section as relro.
2171 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
2172 PT_TLS segments.
2173 (Layout::linkonce_mapping): Map d.rel.ro.local to
2174 .data.rel.ro.local.
2175 (Layout::output_section_name): Us .data.rel.ro.local for any
2176 section which begins with that.
2177 * layout.h (class Layout): Update add_output_section_data
2178 declaration. Add relro_segment_ field.
2179 * output.cc (Output_section::Output_section): Initialize is_relro_
2180 and is_relro_local_ fields.
2181 (Output_segment::add_output_section): Group relro sections.
2182 (Output_segment::is_first_section_relro): New function.
2183 (Output_segment::maximum_alignment): If there is a relro section,
2184 align the segment to the common page size.
2185 (Output_segment::set_section_addresses): Track whether we are
2186 looking at relro sections. If the last section is a relro
2187 section, align to the common page size.
2188 (Output_segment::set_section_list_addresses): Add in_relro
2189 parameter. Change all callers. Align to the page size when
2190 moving from relro to non-relro section.
2191 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
2192 segment.
2193 * output.h (class Output_section): Add is_relro_ and
2194 is_relro_local_ fields.
2195 (Output_section::is_relro): New function.
2196 (Output_section::set_is_relro): New function.
2197 (Output_section::is_relro_local): New function.
2198 (Output_section::set_is_relro_local): New function.
2199 (class Output_segment): Update declarations.
2200 * i386.cc (Target_i386::got_section): Mark .got section as relro.
2201 * sparc.cc (Target_sparc::got_section): Likewise.
2202 * x86_64.cc (Target_x86_64::got_section): Likewise.
2203 * testsuite/relro_test_main.cc: New file.
2204 * testsuite/relro_test.cc: New file.
2205 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
2206 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
2207 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
2208 (relro_test.so, relro_test_pic.o): New targets.
2209 * testsuite/Makefile.in: Rebuild.
2210
a984ee1d
ILT
22112008-05-16 Ian Lance Taylor <iant@google.com>
2212
01676dcd
ILT
2213 * output.cc (Output_segment::add_output_section): Remove front
2214 parameter.
2215 * output.h (class Output_segment): Remove
2216 add_initial_output_section and overloaded add_output_section.
2217 Update declaration of remaining add_output_section.
2218 * layout.cc (Layout::create_interp): Call add_output_section
2219 rather than add_initial_output_section.
2220 (Layout::finish_dynamic_section): Likewise.
2221
497897f9
ILT
2222 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
2223 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
2224 know the dynamic type.
2225 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
2226 field. Initialize it in constructor.
2227 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
2228 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
2229 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
2230 reloc.
2231
a984ee1d
ILT
2232 * output.cc (Output_reloc::get_address): Change return type to
2233 Elf_Addr.
2234 * output.h (class Output_reloc): Update get_address declaration.
2235 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
2236 for section addresses.
2237
55ba0940
ILT
22382008-05-09 Ian Lance Taylor <iant@google.com>
2239
2240 PR 6493
2241 * gold.cc (gold_nomem): Use return value of write.
2242
75517b77
ILT
22432008-05-08 Ian Lance Taylor <iant@google.com>
2244
2245 * symtab.c (Symbol::init_base_output_data): Add version
2246 parameter. Change all callers.
2247 (Symbol::init_base_output_segment): Likewise.
2248 (Symbol::init_base_constant): Likewise.
2249 (Symbol::init_base_undefined): Likewise.
2250 (Sized_symbol::init_output_data): Likewise.
2251 (Sized_symbol::init_output_segment): Likewise.
2252 (Sized_symbol::init_constant): Likewise.
2253 (Sized_symbol::init_undefined): Likewise.
2254 (Symbol_table::do_define_in_output_data): If the new symbol has a
2255 version, mark it as the default.
2256 (Symbol_table::do_define_in_output_segment): Likewise.
2257 (Symbol_table::do_define_as_constant): Likewise.
2258 * symtab.h (class Symbol): Update declarations.
2259 (class Sized_symbol): Likewise.
2260 * resolve.cc (Symbol::override_version): New function.
c42e122e 2261 (Symbol::override_base): Call override_version.
75517b77
ILT
2262 (Symbol::override_base_with_special): Likewise.
2263 * testsuite/ver_script_8.script: New file.
2264 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
2265 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
2266 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
2267 (ver_test_8_1.so, ver_test_8_2.so): New targets.
2268
f1f70eae
ILT
22692008-05-06 Ian Lance Taylor <iant@google.com>
2270
f3e9c5c5
ILT
2271 PR 6049
2272 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
2273 functions.
2274 (class General_options): Remove existing --undefined, and add
2275 --no-undefined instead. Add new --undefined as synonym for -u.
2276 * archive.cc (Archive::add_symbols): Check whether symbol was
2277 named with -u.
2278 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
2279 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
2280 all uses. Add IS_UNDEFINED. Update declarations to split
2281 different versions of init_base. Declare init_base_undefined.
2282 (Symbol::is_defined): Handle IS_UNDEFINED.
2283 (Symbol::is_undefined): Likewise.
2284 (Symbol::is_weak_undefined): Call is_undefined.
2285 (Symbol::is_absolute): Handle IS_CONSTANT.
2286 (class Sized_symbol): Update declarations to split different
2287 versions of init. Declare init_undefined.
2288 (class Symbol_table): Declare new functions.
2289 * symtab.cc (Symbol::init_base_object): Rename from init_base.
2290 Change all callers.
2291 (Symbol::init_base_output_data): Likewise.
2292 (Symbol::init_base_output_segment): Likewise.
2293 (Symbol::init_base_constant): Likewise.
2294 (Symbol::init_base_undefined): New function.
2295 (Sized_symbol::init_object): Rename from init. Change all
2296 callers.
2297 (Sized_symbol::init_output_data): Likewise.
2298 (Sized_symbol::init_output_segment): Likewise.
2299 (Sized_symbol::init_constant): Likewise.
2300 (Sized_symbol::init_undefined): New function.
2301 (Symbol_table::add_undefined_symbols_from_command_line): New
2302 function.
2303 (Symbol_table::do_add_undefined_symbols_from_command_line): New
2304 function.
2305 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
2306 (Symbol::output_section): Likewise.
2307 (Symbol::set_output_section): Likewise.
2308 (Symbol_table::sized_finalize_symbol): Likewise.
2309 (Symbol_table::sized_write_globals): Likewise.
2310 * resolve.cc (Symbol_table::should_override): Likewise.
2311 (Symbol::override_base_with_special): Likewise.
2312
8bdcdf2c
ILT
2313 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
2314 symbol, change it to have default visibility.
2315 * testsuite/protected_1.cc: New file.
2316 * testsuite/protected_2.cc: New file.
2317 * testsuite/protected_3.cc: New file.
2318 * testsuite/protected_main_1.cc: New file.
2319 * testsuite/protected_main_2.cc: New file.
2320 * testsuite/protected_main_3.cc: New file.
2321 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
2322 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
2323 (protected_1_LDFLAGS, protected_1_LDADD): Define.
2324 (protected_1.so): New target.
2325 (protected_1_pic.o, protected_2_pic.o): New targets.
2326 (protected_3_pic.o): New target.
2327 (check_PROGRAMS): Add protected_2.
2328 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
2329 (protected_2_LDFLAGS, protected_2_LDADD): Define.
2330 * testsuite/Makefile.in: Rebuild.
2331
2b706932
ILT
2332 * options.h (DEFINE_var): Add set_user_set_##varname__.
2333 (DEFINE_bool_alias): New macro.
2334 (class General_options): Define -Bstatic using DEFINE_bool_alias
2335 rather than DEFINE_special. Add --undefined as an alias for -z
2336 defs.
2337 * options.cc (General_options::parse_Bstatic): Remove.
2338
d82a5bcc
ILT
2339 * options.h (class General_options): Add --fatal-warnings.
2340 * main.cc (main): Implement --fatal-warnings.
2341 * errors.h (Errors::warning_count): New function.
2342
f1f70eae
ILT
2343 * options.h (class General_options): Add -Bsymbolic-functions.
2344 * symtab.h (Symbol::is_preemptible): Check for
2345 -Bsymbolic-functions.
2346
8825ac63
ILT
23472008-05-05 Ian Lance Taylor <iant@google.com>
2348
d98bc257
ILT
2349 * options.h (DEFINE_bool): For DASH_Z, create the negative option
2350 as noVARNAME rather than no-VARNAME.
2351 (class General_options): Add option -z combreloc.
2352 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
2353 get_address.
2354 (Output_reloc::sort_before) [SHT_REL]: New function.
2355 (Output_reloc::sort_before) [SHT_RELA]: New function.
2356 (class Output_data_reloc_base): Add sort_relocs_ field. Define
2357 Sort_relocs_comparison.
2358 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
2359 parameter. Change all callers.
2360 (Output_data_reloc::Output_data_reloc) [both versions]: Add
2361 sort_relocs parameter. Change all callers.
2362 * output.cc (Output_reloc::get_address): New function, broken out
2363 of write_rel.
2364 (Output_reloc::write_rel): Call it.
2365 (Output_reloc::compare): New function.
2366 (Output_data_reloc_base::do_write): Optionally sort relocs.
2367
60b2b4e7
ILT
2368 * configure.ac: If targ_extra_obj is set, link it in.
2369 * configure.tgt: Initialize all variables.
2370 (x86_64*): Set targ_extra_obj and targ_extra_size.
2371 * configure: Rebuild.
2372
8825ac63
ILT
2373 * object.cc (Sized_relobj::include_section_group): Adjust section
2374 indexes read from group data. Build vector to pass to
2375 layout_group.
2376 * layout.cc (Layout::layout_group): Add flags and shndxes
2377 parameters. Remove contents parameter. Change caller. Update
2378 explicit instantiations.
2379 * layout.h (class Layout): Update layout_group declaration.
2380 * output.cc (Output_data_group::Output_data_group): Add flags and
2381 input_shndxes parameters. Remove contents parameter. Change
2382 caller.
2383 (Output_data_group::do_write): Change input_sections_ to
2384 input_shndxes_.
2385 * output.h (class Output_data_group): Update constructor
2386 declaration. Rename input_sections_ to input_shndxes_.
2387 * testsuite/many_sections_test.cc: Add template.
2388
e94cf127
CC
23892008-04-30 Cary Coutant <ccoutant@google.com>
2390
4418b2d5
CC
2391 * target-reloc.h (relocate_section): Fix dead-pointer bug.
2392
e94cf127
CC
2393 * layout.cc (Layout::include_section): Refactored check for debug
2394 info section.
2395 (Layout::add_comdat): Add new parameters. Change type
2396 of signature parameter. Add object and shndx to signatures table.
2397 (Layout::find_kept_object): New function.
2398 * layout.h: Include <cstring>.
2399 (Layout::is_debug_info_section): New function.
2400 (Layout::add_comdat): Add new parameters.
2401 (Layout::find_kept_object): New function.
2402 (Layout::Kept_section): New struct.
2403 (Layout::Signatures): Change type of map range.
2404 * object.cc (Relobj::output_section_address): New function.
2405 (Sized_relobj::include_section_group): Add new parameters. Change
2406 calls to Layout::add_comdat. Change to build table of kept comdat
2407 groups and table mapping discarded sections to kept sections.
2408 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
2409 (Sized_relobj::do_layout): Change calls to include_section_group and
2410 include_linkonce_section.
2411 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
2412 value to zero when section is discarded.
2413 (Sized_relobj::map_to_kept_section): New function.
2414 * object.h (Relobj::output_section_address): New function.
2415 (Relobj::Comdat_group): New type.
2416 (Relobj::find_comdat_group): New function.
2417 (Relobj::Comdat_group_table): New type.
2418 (Relobj::Kept_comdat_section): New type.
2419 (Relobj::Kept_comdat_section_table): New type.
2420 (Relobj::add_comdat_group): New function.
2421 (Relobj::set_kept_comdat_section): New function.
2422 (Relobj::get_kept_comdat_section): New function.
2423 (Relobj::comdat_groups_): New field.
2424 (Relobj::kept_comdat_sections_): New field.
2425 (Symbol_value::input_value): Update comment.
2426 (Sized_relobj::map_to_kept_section) New function.
2427 (Sized_relobj::include_linkonce_section): Add new parameter.
2428 * target-reloc.h (Comdat_behavior): New type.
2429 (get_comdat_behavior): New function.
2430 (relocate_section): Add code to map a discarded section to the
2431 corresponding kept section when applying a relocation.
2432
e4e5049b
CS
24332008-04-30 Craig Silverstein <csilvers@google.com>
2434
2435 * dwarf_reader.cc (next_generation_count): New static var.
2436 (Addr2line_cache_entry): New struct.
2437 (addr2line_cache): New static var.
2438 (Dwarf_line_info::one_addr2line): Added caching.
2439 (Dwarf_line_info::clear_addr2line_cache): New function.
2440 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
2441 cache-size parameter.
2442 (Dwarf_line_info::one_addr2line_cache): New function.
2443 * symtab.cc (Symbol_table::detect_odr_violations): Pass
2444 new cache-size argument to one_addr2line(), and clear cache.
2445
d09e9154
CC
24462008-04-28 Cary Coutant <ccoutant@google.com>
2447
2448 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
2449 R_386_PC8 relocations.
2450
7ef73768
ILT
24512008-04-23 Ian Lance Taylor <iant@google.com>
2452
55438702
ILT
2453 * object.cc (Sized_relobj::include_section_group): Check for
2454 invalid section group.
2455
c165fb93
ILT
2456 * object.cc (make_elf_object): Correct test for 64-bit ELF file
2457 header size.
2458
7ef73768
ILT
2459 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
2460 than read for file header.
2461 * archive.cc (Archive::include_member): Likewise.
2462
6194aaab
L
24632008-04-23 Paolo Bonzini <bonzini@gnu.org>
2464
2465 * aclocal.m4: Regenerate.
2466 * configure: Regenerate.
2467
d491d34e
ILT
24682008-04-19 Ian Lance Taylor <iant@google.com>
2469
5ea2bac6
ILT
2470 * version.cc (version_string): Bump to 1.6.
2471
7bc3e21a
ILT
2472 * testsuite/Makefile.am (many_sections_r_test): New target.
2473 (many_sections_r_test_SOURCES): Remove.
2474 (many_sections_r_test_DEPENDENCIES): Remove.
2475 (many_sections_r_test_LDFLAGS): Remove.
2476 (many_sections_r_test_LDADD): Remove.
2477
7fcd3aa9
ILT
2478 * object.cc (Sized_relobj::do_add_symbols): Always pass
2479 local_symbol_count_ to add_from_relobj.
2480
4c94d6ae
ILT
2481 * testsuite/Makefile.am (many_sections_check.h): Only check one in
2482 every thousand variables.
2483 * testsuite/Makefile.in: Rebuild.
2484
d491d34e
ILT
2485 * object.cc (Xindex::initialize_symtab_xindex): New function.
2486 (Xindex::read_symtab_xindex): New function.
2487 (Xindex::sym_xindex_to_shndx): New function.
2488 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
2489 available.
2490 (Sized_relobj::do_initialize_xindex): New function.
2491 (Sized_relobj::do_read_symbols): Adjust section links.
2492 (Sized_relobj::symbol_section_and_value): Add is_ordinary
2493 parameter. Change all callers.
2494 (Sized_relobj::include_section_group): Adjust section links and
2495 symbol section indexes.
2496 (Sized_relobj::do_layout): Adjust section links.
2497 (Sized_relobj::do_count_local_symbols): Adjust section links and
2498 symbol section indexes.
2499 (Sized_relobj::do_finalize_local_symbols): Distinguish between
2500 ordinary and special symbols.
2501 (Sized_relobj::write_local_symbols): Add symtab_xindex and
2502 dynsym_xindex parameters. Change all callers. Adjust section
2503 links. Use SHN_XINDEX when needed.
2504 (Sized_relobj::get_symbol_location_info): Adjust section links.
2505 Don't get fooled by special symbols.
2506 * object.h (class Xindex): Define.
2507 (class Object): Add xindex_ parameter. Declare virtual functoin
2508 do_initialize_xindex.
2509 (Object::adjust_sym_shndx): New function.
2510 (Object::set_xindex): New protected function.
2511 (class Symbol_value): Add is_ordinary_shndx_ field.
2512 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
2513 (Symbol_value::value): Assert ordinary section.
2514 (Symbol_value::initialize_input_to_output_map): Likewise.
2515 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
2516 Change all callers.
2517 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
2518 all callers.
2519 (class Sized_relobj): Update declarations.
2520 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
2521 parameter. Change all callers.
2522 (Sized_relobj::adjust_shndx): New function.
2523 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
2524 field.
2525 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
2526 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
2527 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
2528 (Sized_dynobj::read_dynsym_section): Adjust section links.
2529 (Sized_dynobj::read_dynamic): Likewise.
2530 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
2531 section links.
2532 (Sized_dynobj::do_initialize_xindex): New function.
2533 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
2534 do_initialize_xindex.
2535 (Sized_dynobj::adjust_shndx): New function.
2536 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
2537 dynsym_xindex_ fields.
2538 (Layout::finalize): Add a call to set_section_indexes before
2539 creating the symtab sections.
2540 (Layout::set_section_indexes): Don't do anything if the section
2541 already has a section index.
2542 (Layout::create_symtab_sections): Add shnum parameter. Change
2543 caller. Create .symtab_shndx section if needed.
2544 (Layout::create_shdrs): Add shstrtab_section parameter. Change
2545 caller.
2546 (Layout::allocated_output_section_count): New function.
2547 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
2548 needed.
2549 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
2550 fields. Update declarations.
2551 (Layout::symtab_xindex): New function.
2552 (Layout::dynsym_xindex): New function.
2553 (class Write_symbols_task): Add layout_ field.
2554 (Write_symbols_task::Write_symbols_task): Add layout parameter.
2555 Change caller.
2556 * output.cc (Output_section_headers::Output_section_headers): Add
2557 shstrtab_section parameter. Change all callers.
2558 (Output_section_headers::do_sized_write): Store overflow values
2559 for section count and section string table section index in
2560 section header zero.
2561 (Output_file_header::do_sized_write): Check for overflow of
2562 section count and section string table section index.
2563 (Output_symtab_xindex::do_write): New function.
2564 (Output_symtab_xindex::endian_do_write): New function.
2565 * output.h (class Output_section_headers): Add shstrtab_section_.
2566 Update declarations.
2567 (class Output_symtab_xindex): Define.
2568 (Output_section::has_out_shndx): New function.
2569 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
2570 field.
2571 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
2572 Change all callers.
2573 (Sized_symbol::init): Likewise.
2574 (Symbol::output_section): Check for ordinary symbol.
2575 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
2576 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
2577 callers.
2578 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
2579 Change all callers. Simplify handling of symbols from sections
2580 not included in the link.
2581 (Symbol_table::add_from_dynobj): Handle ordinary symbol
2582 distinction.
2583 (Weak_alias_sorter::operator()): Assert that symbols are
2584 ordinary.
2585 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
2586 distinction.
2587 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
2588 parameters. Change all callers.
2589 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
2590 symbol distinction. Use SHN_XINDEX when needed.
2591 (Symbol_table::write_section_symbol): Add symtab_xindex
2592 parameter. Change all callers.
2593 (Symbol_table::sized_write_section_symbol): Likewise. Use
2594 SHN_XINDEX when needed.
2595 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
2596 declarations.
2597 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
2598 (Symbol::is_defined): Check is_ordinary.
2599 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
2600 (Symbol::is_absolute, Symbol::is_common): Likewise.
2601 (class Sized_symbol): Update declarations.
2602 (class Symbol_table): Update declarations.
2603 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
2604 parameters. Change all callers.
2605 (Sized_symbol::override): Likewise.
2606 (Symbol_table::override): Likewise.
2607 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
2608 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
2609 is_ordinary, and orig_st_shndx parameters. Change all callers.
2610 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
2611 to be in an ordinary section.
2612 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
2613 object and is_ordinary parameters. Change all callers.
2614 (Sized_dwarf_line_info::read_relocs): Add object parameter.
2615 Change all callers. Don't add undefined or non-ordinary symbols
2616 to reloc_map_.
2617 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
2618 Change all callers.
2619 * dwarf_reader.h (class Sized_dwarf_line_info): Update
2620 declarations.
2621 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
2622 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
2623 (Sized_relobj::relocate_sections): Likewise.
2624 * target-reloc.h (scan_relocs): Adjust section symbol index.
2625 (scan_relocatable_relocs): Likewise.
2626 * i386.cc (Scan::local): Check for ordinary symbols.
2627 * sparc.cc (Scan::local): Likewise.
2628 * x86_64.cc (Scan::local): Likewise.
2629 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
2630 to symbol_section_and_value.
2631 * testsuite/many_sections_test.cc: New file.
2632 * testsuite/Makefile.am (BUILT_SOURCES): Define.
2633 (check_PROGRAMS): Add many_sections_test.
2634 (many_sections_test_SOURCES): Define.
2635 (many_sections_test_DEPENDENCIES): Define.
2636 (many_sections_test_LDFLAGS): Define.
2637 (BUILT_SOURCES): Add many_sections_define.h.
2638 (many_sections_define.h): New target.
2639 (BUILT_SOURCES): Add many_sections_check.h.
2640 (many_sections_check.h): New target.
2641 (check_PROGRAMS): Add many_sections_r_test.
2642 (many_sections_r_test_SOURCES): Define.
2643 (many_sections_r_test_DEPENDENCIES): Define.
2644 (many_sections_r_test_LDFLAGS): Define.
2645 (many_sections_r_test_LDADD): Define.
2646 (many_sections_r_test.o): New target.
2647 * testsuite/Makefile.in: Rebuild.
2648
c5818ff1
CC
26492008-04-17 Cary Coutant <ccoutant@google.com>
2650
2651 * errors.cc (Errors::info): New function.
2652 (gold_info): New function.
2653 * errors.h (Errors::info): New function.
2654 * gold.h (gold_info): New function.
2655 * object.cc (Input_objects::add_object): Print trace output.
2656 * options.cc (options::parse_set): New function.
2657 (General_options::parse_wrap): Deleted.
2658 (General_options::General_options): Deleted initializer.
2659 * options.h (options::String_set): New typedef.
2660 (options::parse_set): New function.
2661 (DEFINE_set): New macro.
2662 (General_options::wrap): Changed to use DEFINE_set. Changed
2663 callers of any_wrap_symbols and is_wrap_symbol.
2664 (General_options::trace, General_options::trace_symbol):
2665 New options.
2666 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
2667 (General_options::wrap_symbols_): Deleted.
2668 * symtab.cc (Symbol_table::add_from_object): Print trace output.
2669
b5be4a7c
DM
26702008-04-17 David S. Miller <davem@davemloft.net>
2671
2672 * options.cc (General_options::parse_V): New function.
2673 * options.h: Add entries for -V and -Qy.
2674
155a0dd7
ILT
26752008-04-17 Ian Lance Taylor <iant@google.com>
2676
2677 * common.cc (Symbol_table::allocate_commons): Remove options
2678 parameter. Change caller.
2679 (Symbol_table::do_allocate_commons): Remove options parameter.
2680 Change caller. Just call do_allocate_commons_list twice.
2681 (Symbol_table::do_allocate_commons_list): New function, broken out
2682 of do_allocate_commons.
2683 * common.h (class Allocate_commons_task): Remove options_ field.
2684 Update constructor.
2685 * symtab.cc (Symbol_table::Symbol_table): Initialize
2686 tls_commons_.
2687 (Symbol_table::add_from_object): Put TLS common symbols on
2688 tls_commons_ list.
2689 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
2690 which are IN_OUTPUT_DATA.
2691 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
2692 allocate_commons and do_allocate_commons declarations. Declare
2693 do_allocate_commons_list.
2694 * gold.cc (queue_middle_tasks): Update creation of
2695 Allocate_commons_task to not pass options.
2696 * testsuite/Makefile.am (INCLUDES): Add -I.. .
2697 (TLS_TEST_C_FLAGS): New variable.
2698 (tls_test_c_pic.o): New target.
2699 (tls_test_shared.so): Link in tls_test_c_pic.o.
2700 (tls_test_c_pic_ie.o): New target.
2701 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
2702 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
2703 (tls_test_c.o): New target.
2704 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
2705 (tls_pic_test_LDADD): Likewise.
2706 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
2707 (tls_shared_gd_to_ie_test_LDADD): Likewise.
2708 (tls_test_c_gnu2.o): New target.
2709 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
2710 tls_test_c_gnu2.o.
2711 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
2712 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
2713 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
2714 * testsuite/tls_test.cc: Include "config.h".
2715 (t_last): Call t11_last.
2716 * testsuite/tls_test.h (t11, t11_last): Declare.
2717 * testsuite/tls_test_c.c: New file.
2718 * testsuite/tls_test_main.cc (thread_routine): Call t11.
2719 * configure.ac: Check for OpenMP support.
2720 * configure, config.in, Makefile.in: Rebuild.
2721 * testsuite/Makefile.in: Rebuild.
2722
edfbb029
CC
27232008-04-16 Cary Coutant <ccoutant@google.com>
2724
2725 * i386.cc (Target_i386::define_tls_base_symbol): New function.
2726 (Target_i386::tls_base_symbol_defined_): New field.
2727 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2728 (Target_i386::Scan::global): Likewise.
2729 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
2730 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
2731 (Target_x86_64::tls_base_symbol_defined_): New field.
2732 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
2733 (Target_x86_64::Scan::global): Likewise.
2734
f3c69fca
CC
27352008-04-16 Cary Coutant <ccoutant@google.com>
2736
2737 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
2738 (Symbol::needs_plt_entry): Allow weak undefined symbols.
2739 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
2740 building shared libraries.
2741 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
2742 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
2743 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
2744 * testsuite/Makefile.in: Rebuild.
2745 * testsuite/weak_undef.h: New file.
2746 * testsuite/weak_undef_file1.cc: Add extra test cases.
2747 * testsuite/weak_undef_file2.cc: Likewise.
2748 * testsuite/weak_undef_test.cc: Likewise.
2749
7c414435
DM
27502008-04-16 David S. Miller <davem@davemloft.net>
2751
32b769e1
DM
2752 * sparc.cc (Target_sparc::Scan): Change from struct to class.
2753 Add issued_non_pic_error_ field. Declare check_non_pic.
2754 (Target_sparc::Scan::check_non_pic): New function.
2755 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
2756 (Target_sparc::Scan::global): Likewise.
2757
11936fb1
DM
2758 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
2759 * configure: Rebuild.
2760
7c414435
DM
2761 * options.h (DEFINE_enable): New macro.
2762 (new_dtags): New enable option.
2763 (initfirst, interpose, loadfltr, nodefaultlib,
2764 nodelete, nodlopen, nodump): New -z options.
2765 * layout.cc (Layout:finish_dynamic_section): If new
2766 dtags enabled, emit DT_RUNPATH. Also, emit a
2767 DT_FLAGS_1 containing any specified -z flags.
2768
85c7bf8b
ILT
27692008-04-16 Ian Lance Taylor <iant@google.com>
2770
12c0daef
ILT
2771 * copy-relocs.cc: New file.
2772 * copy-relocs.h: New file.
2773 * reloc.cc: Remove Copy_relocs code.
2774 * reloc.h: Likewise.
2775 * reloc-types.h (struct Reloc_types) [both versions]: Add
2776 get_reloc_addend_noerror.
2777 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
2778 variants of add_global which take an addend which must be zero.
2779 * i386.cc: Include "copy-relocs.h".
2780 (class Target_i386): Change type of copy_relocs_ to variable,
2781 update initializer.
2782 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
2783 Change all callers.
2784 (Target_i386::do_finalize_sections): Change handling of
2785 copy_relocs_.
2786 * sparc.cc: Include "copy-relocs.h".
2787 (class Target_sparc): Change type of copy_relocs_ to variable,
2788 update initializer.
2789 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
2790 Change all callers.
2791 (Target_sparc::do_finalize_sections): Change handling of
2792 copy_relocs_.
2793 * x86_64.cc: Include "copy-relocs.h".
2794 (class Target_x86_64): Change type of copy_relocs_ to variable,
2795 update initializer.
2796 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
2797 class. Change all callers.
2798 (Target_x86_64::do_finalize_sections): Change handling of
2799 copy_relocs_.
2800 * Makefile.am (CCFILES): Add copy-relocs.cc.
2801 (HFILES): Add copy-relocs.h.
2802
4f4995b6
ILT
2803 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
2804
85c7bf8b
ILT
2805 * testsuite/script_test_4.sh: Permit leading zeroes.
2806
4f2a9edd
ILT
28072008-04-15 Ian Lance Taylor <iant@google.com>
2808
e6188289
ILT
2809 * script-sections.cc (Script_sections::create_segments): Use
2810 header_size_adjustment even when there is enough room for the
2811 headers.
2812 * testsuite/script_test_4.sh: New file.
2813 * testsuite/script_test_4.t: New file.
2814 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
2815 (check_DATA): Add script_test_4.stdout.
2816 (MOSTLYCLEANFILES): Likewise.
2817 (script_test_4): New target.
2818 (script_test_4.stdout): New target.
2819 * testsuite/Makefile.in: Rebuild.
2820
4f2a9edd
ILT
2821 * sparc.cc: Add definitions for Output_data_plt_sparc class
2822 constants.
2823
f5314dd5
DM
28242008-04-14 David S. Miller <davem@davemloft.net>
2825
2826 * sparc.cc: New file.
2827 * Makefile.am (TARGETSOURCES): Add sparc.cc
2828 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
2829 * configure.tgt: Document targ_extra_size and
2830 targ_extra_big_endian. Add entries for sparc-* and
2831 sparc64-*.
2832 * configure.ac: Handle targ_extra_size and
2833 targ_extra_big_endian.
2834 * Makefile.in: Rebuild.
2835 * configure: Likewise.
2836 * po/POTFILES.in: Likewise.
2837 * po/gold.pot: Likewise.
2838
154e0e9a
ILT
28392008-04-14 Ian Lance Taylor <iant@google.com>
2840
2841 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
2842 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
2843 in the name/type/flags to section mapping. Don't call
2844 allocate_output_section.
2845 (Layout::choose_output_section): Change parameter from adjust_name
2846 to is_input_section. Don't permit input sections after sections
2847 are attached to segments. Don't call allocate_output_section.
2848 (Layout::layout_eh_frame): Call update_flags_for_input_section,
2849 not write_enable_output_section.
2850 (Layout::make_output_section): Don't push to
2851 unattached_section_list_ nor call attach_to_segment. Call
2852 attach_section_to_segment if sections are attached.
2853 (Layout::attach_sections_to_segments): New function.
2854 (Layout::attach_section_to_segment): New function.
2855 (Layout::attach_allocated_section_to_segment): Rename from
2856 attach_to_segment. Remove flags parameter.
2857 (Layout::allocate_output_section): Remove function.
2858 (Layout::write_enable_output_section): Remove function.
2859 * layout.h (class Layout): Update for above changes. Add new
2860 field sections_are_attached_.
2861 * output.h (Output_section::update_flags_for_input_section): New
2862 function.
2863 * output.cc (Output_section::add_input_section): Call
2864 update_flags_for_input_section.
2865 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
2866
009a67a2
CC
28672008-04-11 Cary Coutant <ccoutant@google.com>
2868
2869 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
2870 thought unnecessary.
2871 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
2872
759b1a24
ILT
28732008-04-11 Ian Lance Taylor <iant@google.com>
2874
2875 * output.h (class Output_section_data): Remove inline definition
2876 of set_addralign.
2877 * output.cc (Output_section_data::set_addralign): New function.
2878
c2b45e22
CC
28792008-04-11 Cary Coutant <ccoutant@google.com>
2880
2881 Add support for TLS descriptors for i386 and x86_64.
2882 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
2883 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
2884 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
2885 GOT_TYPE_TLS_DESC.
2886 (Target_i386::got_mod_index_entry): Remove unnecessary code.
2887 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
2888 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
2889 relocations.
2890 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
2891 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
2892 Fix problem with initial-exec relocations.
2893 (Target_i386::Relocate::relocate_tls): Likewise.
2894 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
2895 relaxation.
2896 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
2897 support for section-plus-offset dynamic table entries.
2898 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
2899 (Output_data_dynamic::Dynamic_entry): Add support for
2900 section-plus-offset dynamic table entries.
2901 (Output_data_dynamic::Classification): Likewise.
2902 (Output_data_dynamic::classification_): Renamed offset_.
2903 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
2904 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
2905 (Target_x86_64::make_plt_section): New function.
2906 (Target_x86_64::reserve_tlsdesc_entries): New function.
2907 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
2908 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
2909 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
2910 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
2911 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
2912 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
2913 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
2914 add extra PLT entry for TLS descriptors.
2915 (Output_data_plt_x86_64::got_): New field.
2916 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
2917 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
2918 fields.
2919 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
2920 descriptors.
2921 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
2922 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
2923 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
2924 R_386_TLS_DESC_CALL relocations.
2925 (Target_x86_64::Scan::global): Likewise.
2926 (Target_x86_64::do_finalize_sections): Add dynamic table entries
2927 for TLS descriptors.
2928 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
2929 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
2930 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
2931 GD-to-IE relaxation.
2932 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
2933 and TLS_DESCRIPTORS.
2934 * Makefile.in: Rebuild.
2935 * configure: Rebuild.
2936 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
2937 (tls_test_shared2.so): New target.
2938 (tls_shared_gd_to_ie_test_SOURCES): New variable.
2939 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
2940 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
2941 (tls_shared_gd_to_ie_test_LDADD): New variable.
2942 (tls_shared_gnu2_gd_to_ie_test): New target.
2943 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
2944 New targets.
2945 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
2946 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
2947 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
2948 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
2949 (tls_shared_gnu2_test): New target.
2950 (tls_test_gnu2_shared.so): New target.
2951 (tls_shared_gnu2_test_SOURCES): New variable.
2952 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
2953 (tls_shared_gnu2_test_LDFLAGS): New variable.
2954 (tls_shared_gnu2_test_LDADD): New variable.
2955 * testsuite/Makefile.in: Rebuild.
2956 * testsuite/Makefile.
2957
83bfb6b7
ILT
29582008-04-11 Ian Lance Taylor <iant@google.com>
2959
2960 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
2961 justsyms.t.
2962 * testsuite/Makefile.in: Rebuild.
2963
2964 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
2965 long.
2966 * testsuite/script_test_2.cc (main): Adjust test.
2967
706e1f5e
ILT
29682008-04-11 David S. Miller <davem@davemloft.net>
2969 Ian Lance Taylor <iant@google.com>
2970
2971 * options.h (General_options): Add entries for '-Y' and
2972 '-relax'.
2973 * options.cc (General_options:finalize): If -Y was used, add those
2974 entries to the library path instead of the default "/lib" and
2975 "/usr/lib".
2976
7c98e6bb
DM
29772008-04-11 David S. Miller <davem@davemloft.net>
2978
2979 * testsuite/justsyms.t: Start at 0x100.
2980 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
2981 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
2982 long.
2983 * testsuite/script_test_2.cc: Adjust string and section length
2984 checks.
7c98e6bb 2985
99a37bfd
ILT
29862008-04-09 Ian Lance Taylor <iant@google.com>
2987
2cefc357
ILT
2988 PR gold/5996
2989 * script-sections.cc (Sections_element::allocate_to_segment): Add
2990 orphan parameter.
2991 (Output_section_definition::allocate_to_segment): Likewise.
2992 (Orphan_output_section::allocate_to_segment): Likewise.
2993 (Script_sections::attach_sections_using_phdrs_clause): Don't
2994 propagate non-PT_LOAD segments to orphan sections.
2995 * testsuite/Makefile.am (script_test_3.stdout): Generate using
2996 readelf rather than objdump.
2997 * testsuite/script_test_3.sh: Adjust accordingly. Test that
2998 .interp section and PT_INTERP segment are the same size.
2999 * testsuite/Makefile.in: Rebuild.
3000
99a37bfd
ILT
3001 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
3002 aliases for symbols defined in the same object.
3003 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
3004 (weak_alias_test_SOURCES): New variable.
3005 (weak_alias_test_DEPENDENCIES): New variable.
3006 (weak_alias_test_LDFLAGS): New variable.
3007 (weak_alias_test_LDADD): New variable.
3008 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
3009 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
3010 (weak_alias_test_3.o): New target.
3011 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
3012 * testsuite/weak_alias_test_main.cc: New file.
3013 * testsuite/weak_alias_test_1.cc: New file.
3014 * testsuite/weak_alias_test_2.cc: New file.
3015 * testsuite/weak_alias_test_3.cc: New file.
3016
780e49c5
ILT
30172008-04-08 Ian Lance Taylor <iant@google.com>
3018
cdb0b8f5
ILT
3019 * options.h (class General_options): Add --noinhibit-exec option.
3020 * main.cc (main): Check --noinhibit-exec.
3021
0864d551
ILT
3022 * options.h (class General_options): Define --wrap as a special
3023 option. Add wrap_symbols_ field.
3024 (General_options::any_wrap_symbols): New function.
3025 (General_options::is_wrap_symbol): New function.
3026 * options.cc (General_options::parse_wrap): New function.
3027 (General_options::General_options): Initialize wrap_symbols_.
3028 * symtab.cc (Symbol_table::wrap_symbol): New function.
3029 (Symbol_table::add_from_object): Handle --wrap.
3030 * symtab.h (class Symbol_table): Declare wrap_symbol.
3031 * target.h (Target::wrap_char): New function.
3032 (Target::Target_info): Add wrap_char field.
3033 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
3034 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3035 * testsuite/testfile.cc (Target_test::test_target_info):
3036 Likewise.
3037
789aa6de
ILT
3038 * errors.cc (Errors::undefined_symbol): Mention symbol version if
3039 there is one.
3040
2c38906f
ILT
3041 * layout.h (class Layout): Add added_eh_frame_data_ field.
3042 * layout.cc (Layout::Layout): Initialize new field.
3043 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
3044 output section until we find a section we merged successfully.
3045 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
3046 that the size be non-zero.
3047
780e49c5
ILT
3048 * merge.cc (Object_merge_map::get_output_offset): Remove inline
3049 qualifier.
3050
7fcd0256
ILT
30512008-04-08 Craig Silverstein <csilvers@google.com>
3052
3053 * configure.ac: Export new conditional variable HAVE_ZLIB.
3054 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
3055 on HAVE_ZLIB.
3056 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
3057 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3058
6835af53
ILT
30592008-04-07 Ian Lance Taylor <iant@google.com>
3060
e24f324c
ILT
3061 * version.cc (version_string): Set to "1.5".
3062
a036edd8
ILT
3063 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
3064 Add issued_non_pic_error_ field. Declare check_non_pic.
3065 (Target_x86_64::Scan::check_non_pic): New function.
3066 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
3067 (Target_x86_64::Scan::global): Likewise.
3068
624f8810
ILT
3069 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
3070 addend parameter. Change caller. Handle merge sections.
3071 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
3072 Address to Addend. Don't add in the result of
3073 local_section_offset, pass down the addend and use the returned
3074 value.
3075 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
3076 Update declarations of local_section_offset and symbol_value.
3077 * testsuite/two_file_test_1.cc (t18): New function.
3078 * testsuite/two_file_test_2.cc (f18): New function.
3079 * testsuite/two_file_test_main.cc (main): Call t18.
3080 * testsuite/two_file_test.h (t18, f18): Declare.
3081
6835af53
ILT
3082 * configure.ac: Don't test for objdump, c++filt, or readelf.
3083 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
3084 conditionals.
3085 (TEST_READELF): New variable.
3086 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
3087 (check_PROGRAMS): Add two_file_strip_test.
3088 (two_file_strip_test): New target.
3089 (check_PROGRAMS): Add two_file_same_shared_strip_test.
3090 (two_file_same_shared_strip_test_SOURCES): New variable.
3091 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
3092 (two_file_same_shared_strip_test_LDFLAGS): New variable.
3093 (two_file_same_shared_strip_test_LDADD): New variable.
3094 (two_file_shared_strip.so): New target.
3095 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
3096 (ver_test_5.syms, ver_test_7.syms): Likewise.
3097 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
3098 (strip_test_3.stdout): Use TEST_OBJDUMP.
3099 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3100
86925eef
CC
31012008-04-04 Cary Coutant <ccoutant@google.com>
3102
3103 * symtab.h (Symbol::is_weak_undefined): New function.
3104 (Symbol::is_strong_undefined): New function.
3105 (Symbol::is_absolute): New function.
3106 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
3107 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
3108 absolute symbols.
3109 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
3110 (weak_undef_test): New target.
3111 * testsuite/Makefile.in: Rebuild.
3112 * testsuite/weak_undef_file1.cc: New file.
3113 * testsuite/weak_undef_file2.cc: New file.
3114 * testsuite/weak_undef_test.cc: New file.
3115
126f3ece
ILT
31162008-04-03 Craig Silverstein <csilvers@google.com>
3117
3118 * compressed_output.h (class Output_compressed_section): Use
3119 unsigned buffer.
3120 * compressed_output.cc (zlib_compress): Use unsigned buffers,
3121 add zlib header.
3122 (zlib_compressed_suffix): Removed.
3123 (Output_compressed_section::set_final_data_size): Use unsigned
3124 buffers.
3125 * testsuite/Makefile.am (flagstest_compress_debug_sections):
3126 Fix linker invocation.
3127 (flagstest_o_specialfile_and_compress_debug_sections):
3128 Likewise.
3129 * testsuite/Makefile.in: Regenerated.
3130
deae2a14
DM
31312008-04-02 David S. Miller <davem@davemloft.net>
3132
3133 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
3134 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
3135
70752818
ILT
31362008-04-02 Craig Silverstein <csilvers@google.com>
3137
3138 * TODO: New file.
3139
39d0cb0e
ILT
31402008-04-02 Ian Lance Taylor <iant@google.com>
3141
3142 * fileread.cc (File_read::find_view): Add byteshift and vshifted
3143 parameters. Update for new key type to views_. Change all
3144 callers.
3145 (File_read::read): Adjust for byteshift in returned view.
3146 (File_read::add_view): New function, broken out of
3147 find_and_make_view.
3148 (File_read::make_view): New function, broken out of
3149 find_and_make_view.
3150 (File_read::find_or_make_view): Add offset and aligned
3151 parameters. Rewrite accordingly. Change all callers.
3152 (File_read::get_view): Add offset and aligned parameters. Adjust
3153 for byteshift in return value.
3154 (File_read::get_lasting_view): Likewise.
3155 * fileread.h (class File_read): Update declarations.
3156 (class File_read::View): Add byteshift_ field. Add byteshift to
3157 constructor. Add byteshift method.
3158 * archive.h (Archive::clear_uncached_views): New function.
3159 (Archive::get_view): Add aligned parameter. Change all callers.
3160 * object.h (Object::get_view): Add aligned parameter. Change all
3161 callers.
3162 (Object::get_lasting_view): Likewise.
3163
3164 * fileread.cc (File_read::release): Don't call clear_views if
3165 there are multiple objects.
3166 * fileread.h (File_read::clear_uncached_views): New function.
3167 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
3168 on the archive.
3169
a1207466
CC
31702008-03-31 Cary Coutant <ccoutant@google.com>
3171
3172 Add thin archive support.
3173 * archive.cc (Archive::armagt): New const.
3174 (Archive::setup): Remove task parameter and calls to unlock.
3175 (Archive::unlock_nested_archives): New function.
3176 (Archive::read_header): Add nested_off parameter. Change
3177 all callers.
3178 (Archive::interpret_header): Likewise.
3179 (Archive::include_all_members): Change to handle thin
3180 archives.
3181 (Archive::include_member): Likewise.
3182 * archive.h (Archive::Archive): Add new parameters and
3183 initializers.
3184 (Archive::armagt): New const.
3185 (Archive::setup): Remove task parameter.
3186 (Archive::unlock_nested_archives): New function.
3187 (Archive::read_header): Add nested_off parameter.
3188 (Archive::interpret_header): Likewise.
3189 (Archive::Nested_archive_table): New typedef.
3190 (Archive::is_thin_archive_): New field.
3191 (Archive::nested_archives_): New field.
3192 (Archive::options_): New field.
3193 (Archive::dirpath_): New field.
3194 (Archive::task_): New field.
3195 * readsyms.cc (Read_symbols::do_read_symbols): Add check
3196 for thin archives. Pass additional parameters to
3197 Archive::Archive. Unlock the archive file after calling
3198 Archive::setup.
cd536b21 3199
479f6503
ILT
32002008-03-29 Ian Lance Taylor <iant@google.com>
3201
686c8caf
ILT
3202 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
3203 version symbol to be local.
3204 * testsuite/ver_test_4.sh: New file.
3205 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
3206 (check_DATA): Add ver_test_4.syms.
3207 (ver_test_4.syms): New target.
3208 * testsuite/Makefile.in: Rebuild.
3209
ab794b6b
ILT
3210 * output.cc
3211 (Output_section::Input_section_sort_entry::has_priority): New
3212 function.
3213 (Output_section::Input_section_sort_entry::match_file_name): New
3214 function.
3215 (Output_section::Input_section_sort_entry::match_section_name):
3216 Remove.
3217 (Output_section::Input_section_sort_entry::match_section_name_prefix):
3218 Remove.
3219 (Output_section::Input_section_sort_entry::match_section_file):
3220 Remove.
3221 (Output_section::Input_section_sort_compare::operator()): Rewrite
3222 using new Input_section_sort_entry functions. Sort crtbegin and
3223 crtend first. Sort sections with no priority before sections with
3224 a priority.
3225 * testsuite/initpri1.c (d3): Check j != 4.
3226 (cd5): New constructor/destructor function.
3227 (main): Check j != 2.
3228
479f6503
ILT
3229 * symtab.cc (Symbol_table::add_from_object): If we don't use the
3230 new symbol when resolving, don't call set_is_default.
3231 * testsuite/ver_test_7.cc: New file.
3232 * testsuite/ver_test_7.sh: New file.
3233 * testsuite/Makefile.am (ver_test_7.so): New target.
3234 (ver_test_7.o): New target.
3235 (check_SCRIPTS): Add ver_test_7.sh.
3236 (check_DATA): Add ver_test_7.syms.
3237 (ver_test_7.syms): New target.
3238
2fd32231
ILT
32392008-03-28 Ian Lance Taylor <iant@google.com>
3240
3241 * layout.cc (Layout::layout): If we see an input section with a
3242 name that needs sorting, set the must_sort flag for the output
3243 section.
3244 (Layout::make_output_section): If the name of the output section
3245 indicates that it might require sorting, set the may_sort flag.
3246 * output.h (Output_section::may_sort_attached_input_sections): New
3247 function.
3248 (Output_section::set_may_sort_attached_input_sections): New
3249 function.
3250 (Output_section::must_sort_attached_input_sections): New
3251 function.
3252 (Output_section::set_must_sort_attached_input_sections): New
3253 function.
3254 (class Output_section): Declare Input_section_sort_entry. Define
3255 Input_section_sort_compare. Declare
3256 sort_attached_input_sections. Add new fields:
3257 may_sort_attached_input_sections_,
3258 must_sort_attached_input_sections_,
3259 attached_input_sections_are_sorted_.
3260 * output.cc (Output_section::Output_section): Initialize new
3261 fields.
3262 (Output_section::add_input_section): Add an entry to
3263 input_sections_ if may_sort or must_sort are true.
3264 (Output_section::set_final_data_size): Call
3265 sort_attached_input_sections if necessary.
3266 (Output_section::Input_section_sort_entry): Define new class.
3267 (Output_section::Input_section_sort_compare::operator()): New
3268 function.
3269 (Output_section::sort_attached_input_sections): New function.
3270 * configure.ac: Check whether the compiler supports constructor
3271 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
3272 * testsuite/initpri1.c: New file.
3273 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
3274 CONSTRUCTOR_PRIORITY.
3275 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
3276 (initpri1_LDFLAGS): New variable.
3277 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3278
18e6b24e
ILT
32792008-03-27 Ian Lance Taylor <iant@google.com>
3280
49bdd526
ILT
3281 * common.cc (Sort_commons::operator): Correct sorting algorithm.
3282 * testsuite/common_test_1.c: New file.
3283 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
3284 (common_test_1_SOURCES): New variable.
3285 (common_test_1_DEPENDENCIES): New variable.
3286 (common_test_1_LDFLAGS): New variable.
3287
18e6b24e
ILT
3288 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
3289 and commons_ correctly when NAME/VERSION does not override
3290 NAME/NULL.
3291 * testsuite/ver_test_6.c: New file.
3292 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
3293 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
3294 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
3295
04bf7072
ILT
32962008-03-26 Ian Lance Taylor <iant@google.com>
3297
5871526f
ILT
3298 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
3299 of an undefined symbol from a version script.
3300 * testsuite/Makefile.am (ver_test_5.so): New target.
3301 (ver_test_5.o): New target.
3302 (check_SCRIPTS): Add ver_test_5.sh.
3303 (check_DATA): Add ver_test_5.syms.
3304 (ver_test_5.syms): New target.
3305 * testsuite/ver_test_5.cc: New file.
3306 * testsuite/ver_test_5.script: New file.
3307 * testsuite/ver_test_5.sh: New file.
3308 * Makefile.in, testsuite/Makefile.in: Rebuild.
3309
04bf7072
ILT
3310 PR gold/5986
3311 Fix problems building gold with gcc 4.3.0.
3312 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
3313 (gold_error_at_location, gold_warning_at_location): Use it.
3314 * configure.ac: Check whether we can compile and use a template
3315 function with a printf attribute.
3316 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
3317 when jumping over bytes.
3318 * object.cc: Instantiate Object::read_section_data.
3319 * debug.h: Include <cstring>
3320 * dwarf_reader.cc: Include <algorithm>
3321 * main.cc: Include <cstring>.
3322 * options.cc: Include <cstring>.
3323 * output.cc: Include <cstring>.
3324 * script.cc: Include <cstring>.
3325 * script.h: Include <string>.
3326 * symtab.cc: Include <cstring> and <algorithm>.
3327 * target-select.cc: Include <cstring>.
3328 * version.cc: Include <string>.
3329 * testsuite/testmain.cc: Include <cstdlib>.
3330 * configure, config.in: Rebuild.
3331
874c5b28
ILT
33322008-03-25 Ian Lance Taylor <iant@google.com>
3333
819d6c3a
ILT
3334 * options.cc: Include "../bfd/bfdver.h".
3335 (options::help): Print bug reporting address.
3336
f4b2c6f5
ILT
3337 * version.cc (print_version): Adjust output for current value of
3338 BFD_VERSION_STRING.
3339
3340 * NEWS: New file.
3341
e96caa79
ILT
3342 * options.cc (options::help): Print list of supported targets.
3343 * target-select.h: Include <vector>.
3344 (class Target_selector): Make machine_, size_, and is_big_endian_
3345 fields const. Add bfd_name_ and instantiated_target_ fields.
3346 (Target_selector::Target_selector): Add bfd_name parameter.
3347 (Target_selector::recognize): Make non-virtual, call
3348 do_recognize.
3349 (Target_selector::recognize_by_name): Make non-virtual, call
3350 do_recognize_by_name.
3351 (Target_selector::supported_names): New function.
3352 (Target_selector::bfd_name): New function.
3353 (Target_selector::do_instantiate_target): New pure virtual
3354 function.
3355 (Target_selector::do_recognize): New virtual function.
3356 (Target_selector::do_recognize_by_name): New virtual function.
3357 (Target_selector::instantiate_target): New private function.
3358 (supported_target_names): Declare.
3359 * target-select.cc (Target_selector::Target_selector): Update for
3360 new parameter and fields.
3361 (select_target_by_name): Check that the name matches before
3362 calling recognize_by_name.
3363 (supported_target_names): New function.
3364 * i386.cc (class Target_selector_i386): Update Target_selector
3365 constructor call. Remove recognize and recognize_by_name. Add
3366 do_instantiate_target.
3367 * x86_64.cc (class Target_selector_x86_64): Likewise.
3368 * testsuite/testfile.cc (class Target_selector_test): Update for
3369 changes to Target_selector.
3370
874c5b28
ILT
3371 * README: Rewrite, with some notes on unsupported features.
3372
0a65a3a7
CC
33732008-03-24 Cary Coutant <ccoutant@google.com>
3374
3375 * i386.cc (Target_i386::Got_type): New enum declaration.
3376 (Target_i386::Scan::local): Updated callers of Output_data_got
3377 member functions.
3378 (Target_i386::Scan::global): Likewise.
3379 (Target_i386::Relocate::relocate): Likewise.
3380 (Target_i386::Relocate::relocate_tls): Likewise.
3381 * object.h (Got_offset_list): New class.
3382 (Sized_relobj::local_has_got_offset): Added got_type parameter.
3383 (Sized_relobj::local_got_offset): Likewise.
3384 (Sized_relobj::set_local_got_offset): Likewise.
3385 (Sized_relobj::local_has_tls_got_offset): Removed.
3386 (Sized_relobj::local_tls_got_offset): Removed.
3387 (Sized_relobj::set_local_tls_got_offset): Removed.
3388 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
3389 * output.cc (Output_data_got::add_global): Added got_type parameter.
3390 (Output_data_got::add_global_with_rel): Likewise.
3391 (Output_data_got::add_global_with_rela): Likewise.
3392 (Output_data_got::add_global_pair_with_rel): New function.
3393 (Output_data_got::add_global_pair_with_rela): New function.
3394 (Output_data_got::add_local): Added got_type parameter.
3395 (Output_data_got::add_local_with_rel): Likewise.
3396 (Output_data_got::add_local_with_rela): Likewise.
3397 (Output_data_got::add_local_pair_with_rel): New function.
3398 (Output_data_got::add_local_pair_with_rela): New function.
3399 (Output_data_got::add_global_tls): Removed.
3400 (Output_data_got::add_global_tls_with_rel): Removed.
3401 (Output_data_got::add_global_tls_with_rela): Removed.
3402 (Output_data_got::add_local_tls): Removed.
3403 (Output_data_got::add_local_tls_with_rel): Removed.
3404 (Output_data_got::add_local_tls_with_rela): Removed.
3405 * output.h (Output_data_got::add_global): Added got_type parameter.
3406 (Output_data_got::add_global_with_rel): Likewise.
3407 (Output_data_got::add_global_with_rela): Likewise.
3408 (Output_data_got::add_global_pair_with_rel): New function.
3409 (Output_data_got::add_global_pair_with_rela): New function.
3410 (Output_data_got::add_local): Added got_type parameter.
3411 (Output_data_got::add_local_with_rel): Likewise.
3412 (Output_data_got::add_local_with_rela): Likewise.
3413 (Output_data_got::add_local_pair_with_rel): New function.
3414 (Output_data_got::add_local_pair_with_rela): New function.
3415 (Output_data_got::add_global_tls): Removed.
3416 (Output_data_got::add_global_tls_with_rel): Removed.
3417 (Output_data_got::add_global_tls_with_rela): Removed.
3418 (Output_data_got::add_local_tls): Removed.
3419 (Output_data_got::add_local_tls_with_rel): Removed.
3420 (Output_data_got::add_local_tls_with_rela): Removed.
3421 * resolve.cc (Symbol::override_base_with_special): Removed
3422 reference to has_got_offset_ field.
3423 * symtab.cc (Symbol::init_fields): Replaced initialization
3424 of got_offset_ with got_offsets_. Removed initialization
3425 of has_got_offset_
53fcba31 3426 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
3427 (Symbol::got_offset): Likewise.
3428 (Symbol::set_got_offset): Likewise.
3429 (Symbol::has_tls_got_offset): Removed.
3430 (Symbol::tls_got_offset): Removed.
3431 (Symbol::set_tls_got_offset): Removed.
3432 (Symbol::got_offset_): Removed.
3433 (Symbol::tls_mod_got_offset_): Removed.
3434 (Symbol::tls_pair_got_offset_): Removed.
3435 (Symbol::got_offsets_): New field.
3436 (Symbol::has_got_offset): Removed.
3437 (Symbol::has_tls_mod_got_offset): Removed.
3438 (Symbol::has_tls_pair_got_offset): Removed.
3439 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
3440 (Target_x86_64::Scan::local): Updated callers of Output_data_got
3441 member functions.
3442 (Target_x86_64::Scan::global): Likewise.
3443 (Target_x86_64::Relocate::relocate): Likewise.
3444 (Target_x86_64::Relocate::relocate_tls): Likewise.
3445
bd52eafb
BE
34462008-03-25 Ben Elliston <bje@au.ibm.com>
3447
3448 * yyscript.y: Fix spelling error in comment.
3449
8b105e34
ILT
34502008-03-24 Ian Lance Taylor <iant@google.com>
3451
8ed814a9
ILT
3452 * options.h (class General_options): Define build_id option.
3453 * layout.h (class Layout): Declare write_build_id, create_note,
3454 create_build_id. Add build_id_note_ member.
3455 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
3456 "libiberty.h", "md5.h", "sha1.h".
3457 (Layout::Layout): Initialize eh_frame_data_,
3458 eh_frame_hdr_section_, and build_id_note_.
3459 (Layout::finalize): Call create_build_id.
3460 (Layout::create_note): New function, broken out of
3461 Layout::create_gold_note.
3462 (Layout::create_gold_note): Call create_note.
3463 (Layout::create_build_id): New function.
3464 (Layout::write_build_id): New function.
3465 (Close_task_runner::run): Call write_build_id.
3466
8b105e34
ILT
3467 * x86_64.cc: Correct license to GPLv3.
3468
086a1841
ILT
34692008-03-23 Ian Lance Taylor <iant@google.com>
3470
3471 * options.cc: Include "demangle.h".
3472 (parse_optional_string): New function.
3473 (parse_long_option): Handle takes_optional_argument.
3474 (parse_short_option): Update dash_z initializer. Handle
3475 takes_optional_argument.
3476 (General_options::General_options): Initialize do_demangle_.
3477 (General_options::finalize): Set do_demangle_. Handle demangling
3478 style.
3479 * options.h (parse_optional_string): Declare.
3480 (struct One_option): Add optional_arg field. Update constructor.
3481 Update call constructor calls. Add takes_optional_argument
3482 function.
3483 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
3484 (DEFINE_optional_string): Define.
3485 (General_options::demangle): Change from DEFINE_bool to
3486 DEFINE_optional_string.
3487 (General_options::no_demangle): New function.
3488 (General_options::do_demangle): New function.
3489 (General_options::set_do_demangle): New function.
3490 (General_options::execstack_status_): Move definition to end of
3491 class definition.
3492 (General_options::static_): Likewise.
3493 (General_options::do_demangle_): New field.
3494 * object.cc (big_endian>::get_symbol_location_info): Call
3495 Options::do_demangle, not Options::demangle.
3496 * symtab.cc (demangle): Likewise.
3497
cbb93e63
ILT
34982008-03-22 Ian Lance Taylor <iant@google.com>
3499
3500 * gold.h: Include <cstddef> and <sys/types.h>
3501 * options.h: Include <cstring>.
3502
ec531623
ILT
35032008-03-21 Ian Lance Taylor <iant@google.com>
3504
3505 * Added source code to GNU binutils.
This page took 0.272338 seconds and 4 git commands to generate.