missed from last commit
[binutils-gdb.git] / gold / ChangeLog
1 2008-07-24 Ian Lance Taylor <iant@google.com>
2
3 PR 5990
4 * descriptors.cc: New file.
5 * descriptors.h: New file.
6 * gold-threads.h (class Hold_optional_lock): New class.
7 * fileread.cc: Include "descriptors.h".
8 (File_read::~File_read): Release descriptor rather than closing
9 it.
10 (File_read::open) [file]: Call open_descriptor rather than open.
11 Set is_descriptor_opened_.
12 (File_read::open) [memory]: Assert that descriptor is not open.
13 (File_read::reopen_descriptor): New function.
14 (File_read::release): Release descriptor.
15 (File_read::do_read): Make non-const. Reopen descriptor.
16 (File_read::read): Make non-const.
17 (File_read::make_view): Reopen descriptor.
18 (File_read::do_readv): Likewise.
19 * fileread.h (class File_read): Add is_descriptor_opened_ field.
20 Update declarations.
21 * layout.cc: Include "descriptors.h".
22 (Layout::create_build_id): Use open_descriptor rather than open.
23 * output.cc: Include "descriptors.h".
24 (Output_file::open): Use open_descriptor rather than open.
25 * archive.cc (Archive::const_iterator): Change Archive to be
26 non-const.
27 (Archive::begin, Archive::end): Make non-const.
28 (Archive::count_members): Likewise.
29 * archive.h (class Archive): Update declarations.
30 * object.h (Object::read): Make non-const.
31 * Makefile.am (CCFILES): Add descriptors.cc.
32 (HFILES): Add descriptors.h.
33 * Makefile.in: Rebuild.
34
35 PR 6716
36 * gold.h: Always include <clocale>. Add Solaris workarounds
37 following code in binutils/sysdep.h.
38
39 PR 6048
40 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
41 this->eh_frame_hdr_ is NULL before using it.
42
43 * dynobj.cc (Versions::Versions): Update comment.
44
45 * dynobj.cc (Versions::Versions): If there is an soname, use it as
46 the base version name.
47
48 * stringpool.cc (Stringpool_template::add_with_length): Set key to
49 array size plus one.
50 (Stringpool_template::set_string_offsets): Subtract one from key
51 before using it as an array index.
52 (Stringpool_template::get_offset_with_length): Likewise.
53 (Stringpool_template::write_to_buffer): Likewise.
54 * stringpool.h (Stringpool_template::get_offset_from_key):
55 Likewise.
56
57 2008-07-23 Ian Lance Taylor <iant@google.com>
58
59 PR 6658
60 * object.h (Merged_symbol_value::value): Do our best to handle a
61 negative addend.
62
63 PR 6647
64 * script.cc (Version_script_info::get_versions): Don't add empty
65 version tag to return value.
66 (Version_script_info::get_symbol_version_helper): Change return
67 type to bool. Add pversion parameter. Change all callers.
68 (script_register_vers_node): Don't require a non-NULL tag.
69 * script.h (class Version_script_info): Update declarations.
70 (Version_script_info::get_symbol_version): Change return type to
71 bool. Add version parameter. Change all callers.
72 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
73 handling. Handle an empty version from a version script.
74 (Symbol_table::define_special_symbol): Likewise.
75 * testsuite/ver_test_10.script: New file.
76 * testsuite/ver_test_10.sh: New file.
77 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
78 (check_DATA): Add ver_test_10.syms.
79 (ver_test_10.syms, ver_test_10.so): New target.
80 * testsuite/Makefile.in: Rebuild.
81
82 2008-07-23 Simon Baldwin <simonb@google.com>
83
84 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
85 to zero for undefined symbols from dynamic libraries.
86
87 2008-07-23 Ian Lance Taylor <iant@google.com>
88
89 * symtab.cc (Symbol_table::resolve): Remove version parameter.
90 Change all callers.
91 * symtab.h (class Symbol_table): Update declaration.
92 * testsuite/ver_test_9.cc: New file.
93 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
94 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
95 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
96 (ver_test_9.so, ver_test_9.o): New targets.
97 * testsuite/Makefile.in: Rebuild.
98
99 2008-07-22 Ian Lance Taylor <iant@google.com>
100
101 * options.h (class General_options): Define --check-sections.
102 * layout.cc (Layout::set_segment_offsets): Handle
103 --check-sections.
104
105 * options.h (class General_options): Define -n/--nmagic and
106 -N/--omagic.
107 * options.cc (General_options::finalize): For -n/--nmagic or
108 -N/--omagic, set -static.
109 * layout.cc (Layout::attach_allocated_section_to_segment): If
110 -N/--omagic, don't put read-only and read-write sections in
111 different segments.
112 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
113 finding a read-only segment.
114 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
115 don't set the minimum segment alignment to the common page size,
116 and don't set the file offset to the address modulo the page size.
117 * script-sections.cc (Script_sections::create_segments): If
118 -n/--omagic, don't put read-only and read-write sections in
119 different segments.
120
121 * cref.cc: New file.
122 * cref.h: New file.
123 * options.h (class General_options): Add --print-symbol-counts.
124 * main.cc (main): Issue defined symbol report if requested.
125 * archive.cc (Archive::interpret_header): Make into a const member
126 function.
127 (Archive::add_symbols): Call Input_objects::archive_start and
128 archive_stop.
129 (Archive::const_iterator): Define new class.
130 (Archive::begin, Archive::end): New functions.
131 (Archive::include_all_members): Rewrite to use iterator.
132 (Archive::count_members): New function.
133 * archive.h (class Archive): Update declarations.
134 (Archive::filename): New function.
135 * object.cc: Include "cref.h".
136 (Sized_relobj::Sized_relobj): Initialize defined_count_.
137 (Sized_relobj::do_get_global_symbol_counts): New function.
138 (Input_objects::add_object): Add object to cross-referencer.
139 (Input_objects::archive_start): New function.
140 (Input_objects::archive_stop): New function.
141 (Input_objects::print_symbol_counts): New function.
142 * object.h: Declare Cref and Archive.
143 (Object::get_global_symbol_counts): New function.
144 (Object::do_get_global_symbol_counts): New pure virtual function.
145 (class Sized_relobj): Add defined_count_ field. Update
146 declarations.
147 (class Input_objects): Add cref_ field. Update constructor.
148 Update declarations.
149 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
150 defined_count_.
151 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
152 symbol counts.
153 (Sized_dynobj::do_get_global_symbol_counts): New function.
154 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
155 defined_count_. Update declarations. Define Symbols typedef.
156 * symtab.cc (Symbol_table::add_from_relobj): Add defined
157 parameter. Change all callers.
158 (Symbol_table::add_from_dynobj): Add sympointers and defined
159 parameters. Change all callers.
160 * symtab.h (class Symbol_table): Update declarations.
161 * Makefile.am (CCFILES): Add cref.cc.
162 (HFILES): Add cref.h.
163 * Makefile.in: Rebuild.
164
165 2008-07-22 Simon Baldwin <simonb@google.com>
166
167 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
168 to zero when writing undefined symbols.
169
170 2008-07-22 Ian Lance Taylor <iant@google.com>
171
172 * output.cc (Output_section::add_input_section): Don't try to
173 merge empty merge sections.
174
175 2008-07-21 Craig Silverstein <csilvers@google.com>
176
177 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
178 Include symbol version in error message.
179
180 2008-07-20 Chris Demetriou <cgd@google.com>
181
182 * configure.ac (gold_cv_c_random_seed): New configured variable.
183 (RANDOM_SEED_CFLAGS): New substituted variable.
184 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
185 * configure: Rebuild.
186 * Makefile.in: Likewise.
187 * testsuite/Makefile.in: Likewise.
188
189 2008-07-18 Ian Lance Taylor <iant@google.com>
190
191 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
192 where we see NAME/NULL and NAME/VERSION as separate symbols.
193 * testsuite/ver_test_main.cc (main): Call t4.
194 (t4, t4_2a): Define.
195 * testsuite/ver_test_2.cc (t4_2): Define.
196 * testsuite/ver_test_2.script: Put t4_2a in VER2.
197 * testsuite/ver_test_4.cc (t4_2a): Define.
198 * testsuite/ver_test_4.script: Put t4_2a in VER2.
199 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
200
201 2008-07-17 Ian Lance Taylor <iant@google.com>
202
203 * dynobj.cc (Versions::add_def): If we give an error about a
204 missing version, go ahead and create the version anyhow.
205
206 2008-07-10 Ian Lance Taylor <iant@google.com>
207
208 Handle output sections with more than 0x7fffffff bytes.
209 * object.h (class Relobj): Change map_to_output_ to
210 output_sections_, and just keep a section pointer. Change all
211 uses. Move comdat group support to Sized_relobj.
212 (Relobj::is_section_specially_mapped): Remove.
213 (Relobj::output_section): Remove poff parameter. Change all
214 callers.
215 (Relobj::output_section_offset): New function.
216 (Relobj::set_section_offset): Rewrite.
217 (Relobj::map_to_output): Remove.
218 (Relobj::output_sections): New function.
219 (Relobj::do_output_section_offset): New pure virtual function.
220 (Relobj::do_set_section_offset): Likewise.
221 (class Sized_relobj): Add section_offsets_ field. Add comdat
222 group support from Relobj. Update declarations.
223 (Sized_relobj::get_output_section_offset): New function.
224 (Sized_relobj::do_output_section_offset): New function.
225 (Sized_relobj::do_set_section_offset): New function.
226 * object.cc (Relobj::output_section_address): Remove.
227 (Sized_relobj::Sized_relobj): Initialize new fields.
228 (Sized_relobj::include_section_group): Cast find_kept_object to
229 Sized_relobj.
230 (Sized_relobj::include_linkonce_section): Likewise.
231 (Sized_relobj::do_layout): Use separate arrays for output section
232 and output offset.
233 (Sized_relobj::do_count_local_symbols): Change map_to_output to
234 output_sections.
235 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
236 output_sections and section_offsets.
237 (Sized_relobj::write_local_symbols): Likewise.
238 (map_to_kept_section): Compute output address directly.
239 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
240 output_sections and section_offsets.
241 (Sized_relobj::write_sections): Likewise.
242 (Sized_relobj::relocate_sections): Likewise.
243 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
244 * output.h (class Output_reloc): Update declarations. Change
245 u2_.relobj to Sized_relobj*.
246 (class Output_data_reloc): Change add functions to use
247 Sized_relobj*.
248 * output.cc (Output_reloc::Output_reloc): Change relobj to
249 Sized_relobj*.
250 (Output_reloc::local_section_offset): Change return type to
251 Elf_Addr. Use get_output_section_offset.
252 (Output_reloc::get_address): Likewise.
253 (Output_section::is_input_address_mapped): Don't call
254 is_section_specially_mapped.
255 (Output_section::output_offset): Likewise.
256 (Output_section::output_address): Likewise.
257 (Output_section::starting_output_address): Likewise.
258 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
259 parameter to Sized_relobj*.
260 (Copy_relocs::need_copy_reloc): Likewise.
261 (Copy_relocs::save): Likewise.
262 * copy-relocs.h (class Copy_relocs): Update declarations.
263 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
264 Sized_relobj*. Change relobj_ field to Sized_relobj*.
265 * target-reloc.h (relocate_for_relocatable): Change
266 offset_in_output_section type to Elf_Addr. Change code that uses
267 it as well.
268 * layout.cc (Layout::layout): Always set *off.
269 * mapfile.cc (Mapfile::print_input_section): Use
270 output_section_offset.
271 * i386.cc (Target_i386::copy_reloc): Change object parameter to
272 Sized_relobj*.
273 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
274 * sparc.cc (Target_sparc::copy_reloc): Likewise.
275 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
276
277 2008-07-03 Ian Lance Taylor <iant@google.com>
278
279 * layout.cc (Layout::include_section): Do not discard unrecognized
280 SHT_STRTAB sections.
281
282 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
283
284 * script.cc (Lex::can_continue_name): Make '?' allowable in
285 version-script names.
286 * testsuite/version_script.map: Change glob pattern to use '?'
287
288 2008-06-30 Manish Singh <yosh@gimp.org>
289
290 PR 6585
291 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
292 Correct typo.
293
294 2008-06-30 Ian Lance Taylor <iant@google.com>
295
296 PR 6660
297 PR 6682
298 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
299 versions]: Don't try to read the value in the contents, since we
300 don't use it. Use the template endianness when writing.
301
302 2008-06-25 Cary Coutant <ccoutant@google.com>
303
304 * fileread.cc (File_read::make_view): Assert on zero-length view.
305 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
306 symbol table when there are no symbols to read.
307
308 2008-06-23 Craig Silverstein <csilvers@google.com>
309
310 * version.cc (version_string): Bump to 1.7
311
312 2008-06-18 Craig Silverstein <csilvers@google.com>
313
314 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
315 constant 0xFFFF to type Valtype.
316 (Powerpc_relocate_functions::rel16_ha): Likewise.
317
318 2008-06-17 Ian Lance Taylor <iant@google.com>
319
320 * output.h (Output_section::Input_section): Initialize p2align_ to
321 zero for Output_section_data constructors.
322 (Output_section::Input_section::addralign): If not an input
323 section, return the alignment of the Output_section_data.
324 * testsuite/copy_test.cc: New file.
325 * testsuite/copy_test_1.cc: New file.
326 * testsuite/copy_test_2.cc: New file.
327 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
328 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
329 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
330 (copy_test_1_pic.o, copy_test_1.so): New targets.
331 (copy_test_2_pic.o, copy_test_2.so): New targets.
332 * testsuite/Makefile.in: Rebuild.
333
334 * script-sections.cc (Script_sections::place_orphan): Initialize
335 local variable exact.
336
337 2008-06-13 David Edelsohn <edelsohn@gnu.org>
338
339 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
340
341 2008-06-12 David Edelsohn <edelsohn@gnu.org>
342 David S. Miller <davem@davemloft.net>
343
344 * powerpc.cc: New file.
345 * Makefile.am (TARGETSOURCES): Add powerpc.cc
346 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
347 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
348 * Makefile.in: Rebuild.
349
350 2008-06-09 Ian Lance Taylor <iant@google.com>
351
352 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
353 <exception>.
354 (throwing, orig_terminate): New static variables.
355 (terminate_handler): New static function.
356 (t2): Set terminate handler.
357
358 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
359
360 PR 6584
361 * binary.cc (Binary_to_elf::sized_convert): Fix .data
362 alignment.
363
364 2008-05-30 Cary Coutant <ccoutant@google.com>
365
366 * archive.cc (Archive::include_all_members) Correct to step
367 over symbol table and extended name table in thin archives.
368
369 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
370
371 PR 6407
372 * target-reloc.h (relocate_for_relocatable): Fix new_offset
373 calculation.
374
375 2008-05-28 Caleb Howe <cshowe@google.com>
376
377 * reduced_debug_output.cc: New file.
378 * reduced_debug_output.h: New file.
379 * options.h (class General_options): Add --strip-debug-non-line.
380 * options.cc (General_options::finalize): Add strip_debug_non_line
381 to the strip heirarchy.
382 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
383 fields.
384 * layout.cc: Include "reduced_debug_output.h".
385 (Layout::Layout): Initialize new fields.
386 (line_only_debug_sections): New static array.
387 (is_lines_only_debug_sections): New static inline function.
388 (Layout::include_section): Handle --strip-debug-non-line.
389 (Layout::make_output_section): If --strip-debug-non-line, build
390 new output sections for .debug_abbrev and .debug_info.
391 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
392 gold. Warn about possible overflow.
393 (read_signed_LEB_128): Likewise.
394 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
395 (read_signed_LEB_128): Declare.
396 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
397 (HFILES): Add reduced_debug_output.h.
398 * Makefile.in: Rebuild.
399
400 2008-05-21 Ian Lance Taylor <iant@google.com>
401
402 * mapfile.cc: New file.
403 * mapfile.h: New file.
404 * options.h (class General_options): Add -M/--print-map and -Map.
405 * options.cc (General_options::finalize): Make -M equivalent to
406 -Map -.
407 * main.cc: Include <cstdio> and "mapfile.h".
408 (main): Open mapfile if requested.
409 * gold.cc (class Middle_runner): Add mapfile_ field. Update
410 constructor. Change caller.
411 (queue_initial_tasks): Add mapfile parameter. Change caller.
412 (queue_middle_tasks): Likewise.
413 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
414 declarations.
415 * archive.cc: Include "mapfile.h".
416 (Archive::add_symbols): Add mapfile parameter. Change all
417 callers. Pass mapfile, symbol, and reason to include_member.
418 (Archive::include_all_members): Add mapfile parameter. Change all
419 callers.
420 (Archive::include_member): Add mapfile, sym, and why parameters.
421 Change all callers. Report inclusion to map file.
422 * archive.h: Include "fileread.h".
423 (class Archive): Update declarations.
424 (Archive::file): New const method.
425 (class Add_archive_symbols): Add mapfile_ field. Update
426 constructor. Change all callers.
427 * readsyms.h (class Read_symbols): Likewise.
428 (class Finish_group): Likewise.
429 (class Read_script): Likewise.
430 * common.cc: Include "mapfile.h".
431 (Symbol_table::allocate_commons): Add mapfile parameter. Change
432 all callers.
433 (Symbol_table::do_allocate_commons): Likewise.
434 (Symbol_table::do_allocate_commons_list): Likewise. Report common
435 symbol allocation to mapfile.
436 * common.h (class Allocate_commons_task): Add mapfile_ field.
437 Update constructor. Change all callers.
438 * symtab.h (class Symbol_table): Update declarations.
439 * layout.cc: Include "mapfile.h".
440 (Layout_task_runner::run): Print information to mapfile.
441 (Layout::create_gold_note): Change Output_data_fixed_space to
442 Output_data_zero_fill.
443 (Layout::create_build_id): Likewise.
444 (Layout::print_to_mapfile): New function.
445 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
446 constructor. Change caller.
447 (class Layout): Declare print_to_mapfile.
448 * output.cc (Output_section::Input_section::print_to_mapfile): New
449 function.
450 (Output_section::add_input_section): If producing a map, always
451 add to input_sections_ list.
452 (Output_section::do_print_to_mapfile): New function.
453 (Output_segment::print_sections_to_mapfile): New function.
454 (Output_segment::print_section_list_to_mapfile): New function.
455 * output.h: Include "mapfile.h".
456 (Output_data::print_to_mapfile): New function.
457 (Output_data::do_print_to_mapfile): New virtual function.
458 (Output_segment_headers::do_print_to_mapfile): New function.
459 (Output_file_header::do_print_to_mapfile): New function.
460 (Output_data_const::do_print_to_mapfile): New function.
461 (class Output_data_const_buffer): Add map_name_ field. Update
462 constructor. Change all callers. Add do_print_to_mapfile
463 function.
464 (class Output_data_fixed_space): Likewise.
465 (class Output_data_space): Likewise.
466 (class Output_data_zero_fill): New class.
467 (Output_data_strtab::do_print_to_mapfile): New function.
468 (Output_data_reloc_base::do_print_to_mapfile): New function.
469 (Output_relocatable_relocs::do_print_to_mapfile): New function.
470 (Output_data_group::do_print_to_mapfile): New function.
471 (Output_data_got::do_print_to_mapfile): New function.
472 (Output_data_dynamic::do_print_to_mapfile): New function.
473 (Output_symtab_xindex::do_print_to_mapfile): New function.
474 (class Output_section): Declare do_print_to_mapflie. Declare
475 print_to_mapfile in Input_section.
476 (class Output_segment): Declare new functions.
477 * object.h (Sized_relobj::symbol_count): New function.
478 * script-sections.cc
479 (Output_section_element_dot_assignment::set_section_addresses):
480 Change Output_data_fixed_space to Output_data_zero_fill.
481 (Output_data_expression::do_print_to_mapfile): New function.
482 * script.cc (read_input_script): Add mapfile parameter. Change
483 all callers.
484 * script.h (read_input_script): Update declaration.
485 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
486 (Eh_frame::do_print_to_mapfile): New function.
487 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
488 (Output_merge_string::do_print_to_mapfile): New function.
489 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
490 function.
491 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
492 function.
493 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
494 function.
495 * Makefile.am (CCFILES): Add mapfile.cc.
496 (HFILES): Add mapfile.h.
497 * Makefile.in: Rebuild.
498
499 2008-05-19 Ian Lance Taylor <iant@google.com>
500
501 * options.h (class General_options): Add -z relro.
502 * layout.cc (Layout::Layout): Initialize relro_segment_.
503 (Layout::add_output_section_data): Return the output section.
504 (Layout::make_output_section): Rcognize relro sections and mark
505 them appropriately.
506 (Layout::attach_allocated_section_to_segment): Put relro sections
507 in a PT_GNU_RELRO segment.
508 (Layout::create_initial_dynamic_sections): Mark the .dynamic
509 section as relro.
510 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
511 PT_TLS segments.
512 (Layout::linkonce_mapping): Map d.rel.ro.local to
513 .data.rel.ro.local.
514 (Layout::output_section_name): Us .data.rel.ro.local for any
515 section which begins with that.
516 * layout.h (class Layout): Update add_output_section_data
517 declaration. Add relro_segment_ field.
518 * output.cc (Output_section::Output_section): Initialize is_relro_
519 and is_relro_local_ fields.
520 (Output_segment::add_output_section): Group relro sections.
521 (Output_segment::is_first_section_relro): New function.
522 (Output_segment::maximum_alignment): If there is a relro section,
523 align the segment to the common page size.
524 (Output_segment::set_section_addresses): Track whether we are
525 looking at relro sections. If the last section is a relro
526 section, align to the common page size.
527 (Output_segment::set_section_list_addresses): Add in_relro
528 parameter. Change all callers. Align to the page size when
529 moving from relro to non-relro section.
530 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
531 segment.
532 * output.h (class Output_section): Add is_relro_ and
533 is_relro_local_ fields.
534 (Output_section::is_relro): New function.
535 (Output_section::set_is_relro): New function.
536 (Output_section::is_relro_local): New function.
537 (Output_section::set_is_relro_local): New function.
538 (class Output_segment): Update declarations.
539 * i386.cc (Target_i386::got_section): Mark .got section as relro.
540 * sparc.cc (Target_sparc::got_section): Likewise.
541 * x86_64.cc (Target_x86_64::got_section): Likewise.
542 * testsuite/relro_test_main.cc: New file.
543 * testsuite/relro_test.cc: New file.
544 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
545 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
546 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
547 (relro_test.so, relro_test_pic.o): New targets.
548 * testsuite/Makefile.in: Rebuild.
549
550 2008-05-16 Ian Lance Taylor <iant@google.com>
551
552 * output.cc (Output_segment::add_output_section): Remove front
553 parameter.
554 * output.h (class Output_segment): Remove
555 add_initial_output_section and overloaded add_output_section.
556 Update declaration of remaining add_output_section.
557 * layout.cc (Layout::create_interp): Call add_output_section
558 rather than add_initial_output_section.
559 (Layout::finish_dynamic_section): Likewise.
560
561 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
562 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
563 know the dynamic type.
564 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
565 field. Initialize it in constructor.
566 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
567 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
568 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
569 reloc.
570
571 * output.cc (Output_reloc::get_address): Change return type to
572 Elf_Addr.
573 * output.h (class Output_reloc): Update get_address declaration.
574 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
575 for section addresses.
576
577 2008-05-09 Ian Lance Taylor <iant@google.com>
578
579 PR 6493
580 * gold.cc (gold_nomem): Use return value of write.
581
582 2008-05-08 Ian Lance Taylor <iant@google.com>
583
584 * symtab.c (Symbol::init_base_output_data): Add version
585 parameter. Change all callers.
586 (Symbol::init_base_output_segment): Likewise.
587 (Symbol::init_base_constant): Likewise.
588 (Symbol::init_base_undefined): Likewise.
589 (Sized_symbol::init_output_data): Likewise.
590 (Sized_symbol::init_output_segment): Likewise.
591 (Sized_symbol::init_constant): Likewise.
592 (Sized_symbol::init_undefined): Likewise.
593 (Symbol_table::do_define_in_output_data): If the new symbol has a
594 version, mark it as the default.
595 (Symbol_table::do_define_in_output_segment): Likewise.
596 (Symbol_table::do_define_as_constant): Likewise.
597 * symtab.h (class Symbol): Update declarations.
598 (class Sized_symbol): Likewise.
599 * resolve.cc (Symbol::override_version): New function.
600 (Symbol::override_base): Call override_version.
601 (Symbol::override_base_with_special): Likewise.
602 * testsuite/ver_script_8.script: New file.
603 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
604 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
605 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
606 (ver_test_8_1.so, ver_test_8_2.so): New targets.
607
608 2008-05-06 Ian Lance Taylor <iant@google.com>
609
610 PR 6049
611 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
612 functions.
613 (class General_options): Remove existing --undefined, and add
614 --no-undefined instead. Add new --undefined as synonym for -u.
615 * archive.cc (Archive::add_symbols): Check whether symbol was
616 named with -u.
617 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
618 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
619 all uses. Add IS_UNDEFINED. Update declarations to split
620 different versions of init_base. Declare init_base_undefined.
621 (Symbol::is_defined): Handle IS_UNDEFINED.
622 (Symbol::is_undefined): Likewise.
623 (Symbol::is_weak_undefined): Call is_undefined.
624 (Symbol::is_absolute): Handle IS_CONSTANT.
625 (class Sized_symbol): Update declarations to split different
626 versions of init. Declare init_undefined.
627 (class Symbol_table): Declare new functions.
628 * symtab.cc (Symbol::init_base_object): Rename from init_base.
629 Change all callers.
630 (Symbol::init_base_output_data): Likewise.
631 (Symbol::init_base_output_segment): Likewise.
632 (Symbol::init_base_constant): Likewise.
633 (Symbol::init_base_undefined): New function.
634 (Sized_symbol::init_object): Rename from init. Change all
635 callers.
636 (Sized_symbol::init_output_data): Likewise.
637 (Sized_symbol::init_output_segment): Likewise.
638 (Sized_symbol::init_constant): Likewise.
639 (Sized_symbol::init_undefined): New function.
640 (Symbol_table::add_undefined_symbols_from_command_line): New
641 function.
642 (Symbol_table::do_add_undefined_symbols_from_command_line): New
643 function.
644 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
645 (Symbol::output_section): Likewise.
646 (Symbol::set_output_section): Likewise.
647 (Symbol_table::sized_finalize_symbol): Likewise.
648 (Symbol_table::sized_write_globals): Likewise.
649 * resolve.cc (Symbol_table::should_override): Likewise.
650 (Symbol::override_base_with_special): Likewise.
651
652 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
653 symbol, change it to have default visibility.
654 * testsuite/protected_1.cc: New file.
655 * testsuite/protected_2.cc: New file.
656 * testsuite/protected_3.cc: New file.
657 * testsuite/protected_main_1.cc: New file.
658 * testsuite/protected_main_2.cc: New file.
659 * testsuite/protected_main_3.cc: New file.
660 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
661 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
662 (protected_1_LDFLAGS, protected_1_LDADD): Define.
663 (protected_1.so): New target.
664 (protected_1_pic.o, protected_2_pic.o): New targets.
665 (protected_3_pic.o): New target.
666 (check_PROGRAMS): Add protected_2.
667 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
668 (protected_2_LDFLAGS, protected_2_LDADD): Define.
669 * testsuite/Makefile.in: Rebuild.
670
671 * options.h (DEFINE_var): Add set_user_set_##varname__.
672 (DEFINE_bool_alias): New macro.
673 (class General_options): Define -Bstatic using DEFINE_bool_alias
674 rather than DEFINE_special. Add --undefined as an alias for -z
675 defs.
676 * options.cc (General_options::parse_Bstatic): Remove.
677
678 * options.h (class General_options): Add --fatal-warnings.
679 * main.cc (main): Implement --fatal-warnings.
680 * errors.h (Errors::warning_count): New function.
681
682 * options.h (class General_options): Add -Bsymbolic-functions.
683 * symtab.h (Symbol::is_preemptible): Check for
684 -Bsymbolic-functions.
685
686 2008-05-05 Ian Lance Taylor <iant@google.com>
687
688 * options.h (DEFINE_bool): For DASH_Z, create the negative option
689 as noVARNAME rather than no-VARNAME.
690 (class General_options): Add option -z combreloc.
691 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
692 get_address.
693 (Output_reloc::sort_before) [SHT_REL]: New function.
694 (Output_reloc::sort_before) [SHT_RELA]: New function.
695 (class Output_data_reloc_base): Add sort_relocs_ field. Define
696 Sort_relocs_comparison.
697 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
698 parameter. Change all callers.
699 (Output_data_reloc::Output_data_reloc) [both versions]: Add
700 sort_relocs parameter. Change all callers.
701 * output.cc (Output_reloc::get_address): New function, broken out
702 of write_rel.
703 (Output_reloc::write_rel): Call it.
704 (Output_reloc::compare): New function.
705 (Output_data_reloc_base::do_write): Optionally sort relocs.
706
707 * configure.ac: If targ_extra_obj is set, link it in.
708 * configure.tgt: Initialize all variables.
709 (x86_64*): Set targ_extra_obj and targ_extra_size.
710 * configure: Rebuild.
711
712 * object.cc (Sized_relobj::include_section_group): Adjust section
713 indexes read from group data. Build vector to pass to
714 layout_group.
715 * layout.cc (Layout::layout_group): Add flags and shndxes
716 parameters. Remove contents parameter. Change caller. Update
717 explicit instantiations.
718 * layout.h (class Layout): Update layout_group declaration.
719 * output.cc (Output_data_group::Output_data_group): Add flags and
720 input_shndxes parameters. Remove contents parameter. Change
721 caller.
722 (Output_data_group::do_write): Change input_sections_ to
723 input_shndxes_.
724 * output.h (class Output_data_group): Update constructor
725 declaration. Rename input_sections_ to input_shndxes_.
726 * testsuite/many_sections_test.cc: Add template.
727
728 2008-04-30 Cary Coutant <ccoutant@google.com>
729
730 * target-reloc.h (relocate_section): Fix dead-pointer bug.
731
732 * layout.cc (Layout::include_section): Refactored check for debug
733 info section.
734 (Layout::add_comdat): Add new parameters. Change type
735 of signature parameter. Add object and shndx to signatures table.
736 (Layout::find_kept_object): New function.
737 * layout.h: Include <cstring>.
738 (Layout::is_debug_info_section): New function.
739 (Layout::add_comdat): Add new parameters.
740 (Layout::find_kept_object): New function.
741 (Layout::Kept_section): New struct.
742 (Layout::Signatures): Change type of map range.
743 * object.cc (Relobj::output_section_address): New function.
744 (Sized_relobj::include_section_group): Add new parameters. Change
745 calls to Layout::add_comdat. Change to build table of kept comdat
746 groups and table mapping discarded sections to kept sections.
747 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
748 (Sized_relobj::do_layout): Change calls to include_section_group and
749 include_linkonce_section.
750 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
751 value to zero when section is discarded.
752 (Sized_relobj::map_to_kept_section): New function.
753 * object.h (Relobj::output_section_address): New function.
754 (Relobj::Comdat_group): New type.
755 (Relobj::find_comdat_group): New function.
756 (Relobj::Comdat_group_table): New type.
757 (Relobj::Kept_comdat_section): New type.
758 (Relobj::Kept_comdat_section_table): New type.
759 (Relobj::add_comdat_group): New function.
760 (Relobj::set_kept_comdat_section): New function.
761 (Relobj::get_kept_comdat_section): New function.
762 (Relobj::comdat_groups_): New field.
763 (Relobj::kept_comdat_sections_): New field.
764 (Symbol_value::input_value): Update comment.
765 (Sized_relobj::map_to_kept_section) New function.
766 (Sized_relobj::include_linkonce_section): Add new parameter.
767 * target-reloc.h (Comdat_behavior): New type.
768 (get_comdat_behavior): New function.
769 (relocate_section): Add code to map a discarded section to the
770 corresponding kept section when applying a relocation.
771
772 2008-04-30 Craig Silverstein <csilvers@google.com>
773
774 * dwarf_reader.cc (next_generation_count): New static var.
775 (Addr2line_cache_entry): New struct.
776 (addr2line_cache): New static var.
777 (Dwarf_line_info::one_addr2line): Added caching.
778 (Dwarf_line_info::clear_addr2line_cache): New function.
779 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
780 cache-size parameter.
781 (Dwarf_line_info::one_addr2line_cache): New function.
782 * symtab.cc (Symbol_table::detect_odr_violations): Pass
783 new cache-size argument to one_addr2line(), and clear cache.
784
785 2008-04-28 Cary Coutant <ccoutant@google.com>
786
787 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
788 R_386_PC8 relocations.
789
790 2008-04-23 Ian Lance Taylor <iant@google.com>
791
792 * object.cc (Sized_relobj::include_section_group): Check for
793 invalid section group.
794
795 * object.cc (make_elf_object): Correct test for 64-bit ELF file
796 header size.
797
798 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
799 than read for file header.
800 * archive.cc (Archive::include_member): Likewise.
801
802 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
803
804 * aclocal.m4: Regenerate.
805 * configure: Regenerate.
806
807 2008-04-19 Ian Lance Taylor <iant@google.com>
808
809 * version.cc (version_string): Bump to 1.6.
810
811 * testsuite/Makefile.am (many_sections_r_test): New target.
812 (many_sections_r_test_SOURCES): Remove.
813 (many_sections_r_test_DEPENDENCIES): Remove.
814 (many_sections_r_test_LDFLAGS): Remove.
815 (many_sections_r_test_LDADD): Remove.
816
817 * object.cc (Sized_relobj::do_add_symbols): Always pass
818 local_symbol_count_ to add_from_relobj.
819
820 * testsuite/Makefile.am (many_sections_check.h): Only check one in
821 every thousand variables.
822 * testsuite/Makefile.in: Rebuild.
823
824 * object.cc (Xindex::initialize_symtab_xindex): New function.
825 (Xindex::read_symtab_xindex): New function.
826 (Xindex::sym_xindex_to_shndx): New function.
827 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
828 available.
829 (Sized_relobj::do_initialize_xindex): New function.
830 (Sized_relobj::do_read_symbols): Adjust section links.
831 (Sized_relobj::symbol_section_and_value): Add is_ordinary
832 parameter. Change all callers.
833 (Sized_relobj::include_section_group): Adjust section links and
834 symbol section indexes.
835 (Sized_relobj::do_layout): Adjust section links.
836 (Sized_relobj::do_count_local_symbols): Adjust section links and
837 symbol section indexes.
838 (Sized_relobj::do_finalize_local_symbols): Distinguish between
839 ordinary and special symbols.
840 (Sized_relobj::write_local_symbols): Add symtab_xindex and
841 dynsym_xindex parameters. Change all callers. Adjust section
842 links. Use SHN_XINDEX when needed.
843 (Sized_relobj::get_symbol_location_info): Adjust section links.
844 Don't get fooled by special symbols.
845 * object.h (class Xindex): Define.
846 (class Object): Add xindex_ parameter. Declare virtual functoin
847 do_initialize_xindex.
848 (Object::adjust_sym_shndx): New function.
849 (Object::set_xindex): New protected function.
850 (class Symbol_value): Add is_ordinary_shndx_ field.
851 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
852 (Symbol_value::value): Assert ordinary section.
853 (Symbol_value::initialize_input_to_output_map): Likewise.
854 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
855 Change all callers.
856 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
857 all callers.
858 (class Sized_relobj): Update declarations.
859 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
860 parameter. Change all callers.
861 (Sized_relobj::adjust_shndx): New function.
862 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
863 field.
864 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
865 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
866 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
867 (Sized_dynobj::read_dynsym_section): Adjust section links.
868 (Sized_dynobj::read_dynamic): Likewise.
869 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
870 section links.
871 (Sized_dynobj::do_initialize_xindex): New function.
872 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
873 do_initialize_xindex.
874 (Sized_dynobj::adjust_shndx): New function.
875 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
876 dynsym_xindex_ fields.
877 (Layout::finalize): Add a call to set_section_indexes before
878 creating the symtab sections.
879 (Layout::set_section_indexes): Don't do anything if the section
880 already has a section index.
881 (Layout::create_symtab_sections): Add shnum parameter. Change
882 caller. Create .symtab_shndx section if needed.
883 (Layout::create_shdrs): Add shstrtab_section parameter. Change
884 caller.
885 (Layout::allocated_output_section_count): New function.
886 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
887 needed.
888 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
889 fields. Update declarations.
890 (Layout::symtab_xindex): New function.
891 (Layout::dynsym_xindex): New function.
892 (class Write_symbols_task): Add layout_ field.
893 (Write_symbols_task::Write_symbols_task): Add layout parameter.
894 Change caller.
895 * output.cc (Output_section_headers::Output_section_headers): Add
896 shstrtab_section parameter. Change all callers.
897 (Output_section_headers::do_sized_write): Store overflow values
898 for section count and section string table section index in
899 section header zero.
900 (Output_file_header::do_sized_write): Check for overflow of
901 section count and section string table section index.
902 (Output_symtab_xindex::do_write): New function.
903 (Output_symtab_xindex::endian_do_write): New function.
904 * output.h (class Output_section_headers): Add shstrtab_section_.
905 Update declarations.
906 (class Output_symtab_xindex): Define.
907 (Output_section::has_out_shndx): New function.
908 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
909 field.
910 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
911 Change all callers.
912 (Sized_symbol::init): Likewise.
913 (Symbol::output_section): Check for ordinary symbol.
914 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
915 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
916 callers.
917 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
918 Change all callers. Simplify handling of symbols from sections
919 not included in the link.
920 (Symbol_table::add_from_dynobj): Handle ordinary symbol
921 distinction.
922 (Weak_alias_sorter::operator()): Assert that symbols are
923 ordinary.
924 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
925 distinction.
926 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
927 parameters. Change all callers.
928 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
929 symbol distinction. Use SHN_XINDEX when needed.
930 (Symbol_table::write_section_symbol): Add symtab_xindex
931 parameter. Change all callers.
932 (Symbol_table::sized_write_section_symbol): Likewise. Use
933 SHN_XINDEX when needed.
934 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
935 declarations.
936 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
937 (Symbol::is_defined): Check is_ordinary.
938 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
939 (Symbol::is_absolute, Symbol::is_common): Likewise.
940 (class Sized_symbol): Update declarations.
941 (class Symbol_table): Update declarations.
942 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
943 parameters. Change all callers.
944 (Sized_symbol::override): Likewise.
945 (Symbol_table::override): Likewise.
946 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
947 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
948 is_ordinary, and orig_st_shndx parameters. Change all callers.
949 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
950 to be in an ordinary section.
951 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
952 object and is_ordinary parameters. Change all callers.
953 (Sized_dwarf_line_info::read_relocs): Add object parameter.
954 Change all callers. Don't add undefined or non-ordinary symbols
955 to reloc_map_.
956 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
957 Change all callers.
958 * dwarf_reader.h (class Sized_dwarf_line_info): Update
959 declarations.
960 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
961 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
962 (Sized_relobj::relocate_sections): Likewise.
963 * target-reloc.h (scan_relocs): Adjust section symbol index.
964 (scan_relocatable_relocs): Likewise.
965 * i386.cc (Scan::local): Check for ordinary symbols.
966 * sparc.cc (Scan::local): Likewise.
967 * x86_64.cc (Scan::local): Likewise.
968 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
969 to symbol_section_and_value.
970 * testsuite/many_sections_test.cc: New file.
971 * testsuite/Makefile.am (BUILT_SOURCES): Define.
972 (check_PROGRAMS): Add many_sections_test.
973 (many_sections_test_SOURCES): Define.
974 (many_sections_test_DEPENDENCIES): Define.
975 (many_sections_test_LDFLAGS): Define.
976 (BUILT_SOURCES): Add many_sections_define.h.
977 (many_sections_define.h): New target.
978 (BUILT_SOURCES): Add many_sections_check.h.
979 (many_sections_check.h): New target.
980 (check_PROGRAMS): Add many_sections_r_test.
981 (many_sections_r_test_SOURCES): Define.
982 (many_sections_r_test_DEPENDENCIES): Define.
983 (many_sections_r_test_LDFLAGS): Define.
984 (many_sections_r_test_LDADD): Define.
985 (many_sections_r_test.o): New target.
986 * testsuite/Makefile.in: Rebuild.
987
988 2008-04-17 Cary Coutant <ccoutant@google.com>
989
990 * errors.cc (Errors::info): New function.
991 (gold_info): New function.
992 * errors.h (Errors::info): New function.
993 * gold.h (gold_info): New function.
994 * object.cc (Input_objects::add_object): Print trace output.
995 * options.cc (options::parse_set): New function.
996 (General_options::parse_wrap): Deleted.
997 (General_options::General_options): Deleted initializer.
998 * options.h (options::String_set): New typedef.
999 (options::parse_set): New function.
1000 (DEFINE_set): New macro.
1001 (General_options::wrap): Changed to use DEFINE_set. Changed
1002 callers of any_wrap_symbols and is_wrap_symbol.
1003 (General_options::trace, General_options::trace_symbol):
1004 New options.
1005 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
1006 (General_options::wrap_symbols_): Deleted.
1007 * symtab.cc (Symbol_table::add_from_object): Print trace output.
1008
1009 2008-04-17 David S. Miller <davem@davemloft.net>
1010
1011 * options.cc (General_options::parse_V): New function.
1012 * options.h: Add entries for -V and -Qy.
1013
1014 2008-04-17 Ian Lance Taylor <iant@google.com>
1015
1016 * common.cc (Symbol_table::allocate_commons): Remove options
1017 parameter. Change caller.
1018 (Symbol_table::do_allocate_commons): Remove options parameter.
1019 Change caller. Just call do_allocate_commons_list twice.
1020 (Symbol_table::do_allocate_commons_list): New function, broken out
1021 of do_allocate_commons.
1022 * common.h (class Allocate_commons_task): Remove options_ field.
1023 Update constructor.
1024 * symtab.cc (Symbol_table::Symbol_table): Initialize
1025 tls_commons_.
1026 (Symbol_table::add_from_object): Put TLS common symbols on
1027 tls_commons_ list.
1028 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
1029 which are IN_OUTPUT_DATA.
1030 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
1031 allocate_commons and do_allocate_commons declarations. Declare
1032 do_allocate_commons_list.
1033 * gold.cc (queue_middle_tasks): Update creation of
1034 Allocate_commons_task to not pass options.
1035 * testsuite/Makefile.am (INCLUDES): Add -I.. .
1036 (TLS_TEST_C_FLAGS): New variable.
1037 (tls_test_c_pic.o): New target.
1038 (tls_test_shared.so): Link in tls_test_c_pic.o.
1039 (tls_test_c_pic_ie.o): New target.
1040 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
1041 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
1042 (tls_test_c.o): New target.
1043 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
1044 (tls_pic_test_LDADD): Likewise.
1045 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
1046 (tls_shared_gd_to_ie_test_LDADD): Likewise.
1047 (tls_test_c_gnu2.o): New target.
1048 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
1049 tls_test_c_gnu2.o.
1050 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
1051 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
1052 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
1053 * testsuite/tls_test.cc: Include "config.h".
1054 (t_last): Call t11_last.
1055 * testsuite/tls_test.h (t11, t11_last): Declare.
1056 * testsuite/tls_test_c.c: New file.
1057 * testsuite/tls_test_main.cc (thread_routine): Call t11.
1058 * configure.ac: Check for OpenMP support.
1059 * configure, config.in, Makefile.in: Rebuild.
1060 * testsuite/Makefile.in: Rebuild.
1061
1062 2008-04-16 Cary Coutant <ccoutant@google.com>
1063
1064 * i386.cc (Target_i386::define_tls_base_symbol): New function.
1065 (Target_i386::tls_base_symbol_defined_): New field.
1066 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1067 (Target_i386::Scan::global): Likewise.
1068 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
1069 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
1070 (Target_x86_64::tls_base_symbol_defined_): New field.
1071 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
1072 (Target_x86_64::Scan::global): Likewise.
1073
1074 2008-04-16 Cary Coutant <ccoutant@google.com>
1075
1076 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
1077 (Symbol::needs_plt_entry): Allow weak undefined symbols.
1078 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
1079 building shared libraries.
1080 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
1081 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
1082 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
1083 * testsuite/Makefile.in: Rebuild.
1084 * testsuite/weak_undef.h: New file.
1085 * testsuite/weak_undef_file1.cc: Add extra test cases.
1086 * testsuite/weak_undef_file2.cc: Likewise.
1087 * testsuite/weak_undef_test.cc: Likewise.
1088
1089 2008-04-16 David S. Miller <davem@davemloft.net>
1090
1091 * sparc.cc (Target_sparc::Scan): Change from struct to class.
1092 Add issued_non_pic_error_ field. Declare check_non_pic.
1093 (Target_sparc::Scan::check_non_pic): New function.
1094 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
1095 (Target_sparc::Scan::global): Likewise.
1096
1097 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
1098 * configure: Rebuild.
1099
1100 * options.h (DEFINE_enable): New macro.
1101 (new_dtags): New enable option.
1102 (initfirst, interpose, loadfltr, nodefaultlib,
1103 nodelete, nodlopen, nodump): New -z options.
1104 * layout.cc (Layout:finish_dynamic_section): If new
1105 dtags enabled, emit DT_RUNPATH. Also, emit a
1106 DT_FLAGS_1 containing any specified -z flags.
1107
1108 2008-04-16 Ian Lance Taylor <iant@google.com>
1109
1110 * copy-relocs.cc: New file.
1111 * copy-relocs.h: New file.
1112 * reloc.cc: Remove Copy_relocs code.
1113 * reloc.h: Likewise.
1114 * reloc-types.h (struct Reloc_types) [both versions]: Add
1115 get_reloc_addend_noerror.
1116 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
1117 variants of add_global which take an addend which must be zero.
1118 * i386.cc: Include "copy-relocs.h".
1119 (class Target_i386): Change type of copy_relocs_ to variable,
1120 update initializer.
1121 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
1122 Change all callers.
1123 (Target_i386::do_finalize_sections): Change handling of
1124 copy_relocs_.
1125 * sparc.cc: Include "copy-relocs.h".
1126 (class Target_sparc): Change type of copy_relocs_ to variable,
1127 update initializer.
1128 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
1129 Change all callers.
1130 (Target_sparc::do_finalize_sections): Change handling of
1131 copy_relocs_.
1132 * x86_64.cc: Include "copy-relocs.h".
1133 (class Target_x86_64): Change type of copy_relocs_ to variable,
1134 update initializer.
1135 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
1136 class. Change all callers.
1137 (Target_x86_64::do_finalize_sections): Change handling of
1138 copy_relocs_.
1139 * Makefile.am (CCFILES): Add copy-relocs.cc.
1140 (HFILES): Add copy-relocs.h.
1141
1142 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
1143
1144 * testsuite/script_test_4.sh: Permit leading zeroes.
1145
1146 2008-04-15 Ian Lance Taylor <iant@google.com>
1147
1148 * script-sections.cc (Script_sections::create_segments): Use
1149 header_size_adjustment even when there is enough room for the
1150 headers.
1151 * testsuite/script_test_4.sh: New file.
1152 * testsuite/script_test_4.t: New file.
1153 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
1154 (check_DATA): Add script_test_4.stdout.
1155 (MOSTLYCLEANFILES): Likewise.
1156 (script_test_4): New target.
1157 (script_test_4.stdout): New target.
1158 * testsuite/Makefile.in: Rebuild.
1159
1160 * sparc.cc: Add definitions for Output_data_plt_sparc class
1161 constants.
1162
1163 2008-04-14 David S. Miller <davem@davemloft.net>
1164
1165 * sparc.cc: New file.
1166 * Makefile.am (TARGETSOURCES): Add sparc.cc
1167 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
1168 * configure.tgt: Document targ_extra_size and
1169 targ_extra_big_endian. Add entries for sparc-* and
1170 sparc64-*.
1171 * configure.ac: Handle targ_extra_size and
1172 targ_extra_big_endian.
1173 * Makefile.in: Rebuild.
1174 * configure: Likewise.
1175 * po/POTFILES.in: Likewise.
1176 * po/gold.pot: Likewise.
1177
1178 2008-04-14 Ian Lance Taylor <iant@google.com>
1179
1180 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
1181 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
1182 in the name/type/flags to section mapping. Don't call
1183 allocate_output_section.
1184 (Layout::choose_output_section): Change parameter from adjust_name
1185 to is_input_section. Don't permit input sections after sections
1186 are attached to segments. Don't call allocate_output_section.
1187 (Layout::layout_eh_frame): Call update_flags_for_input_section,
1188 not write_enable_output_section.
1189 (Layout::make_output_section): Don't push to
1190 unattached_section_list_ nor call attach_to_segment. Call
1191 attach_section_to_segment if sections are attached.
1192 (Layout::attach_sections_to_segments): New function.
1193 (Layout::attach_section_to_segment): New function.
1194 (Layout::attach_allocated_section_to_segment): Rename from
1195 attach_to_segment. Remove flags parameter.
1196 (Layout::allocate_output_section): Remove function.
1197 (Layout::write_enable_output_section): Remove function.
1198 * layout.h (class Layout): Update for above changes. Add new
1199 field sections_are_attached_.
1200 * output.h (Output_section::update_flags_for_input_section): New
1201 function.
1202 * output.cc (Output_section::add_input_section): Call
1203 update_flags_for_input_section.
1204 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
1205
1206 2008-04-11 Cary Coutant <ccoutant@google.com>
1207
1208 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
1209 thought unnecessary.
1210 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
1211
1212 2008-04-11 Ian Lance Taylor <iant@google.com>
1213
1214 * output.h (class Output_section_data): Remove inline definition
1215 of set_addralign.
1216 * output.cc (Output_section_data::set_addralign): New function.
1217
1218 2008-04-11 Cary Coutant <ccoutant@google.com>
1219
1220 Add support for TLS descriptors for i386 and x86_64.
1221 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
1222 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
1223 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
1224 GOT_TYPE_TLS_DESC.
1225 (Target_i386::got_mod_index_entry): Remove unnecessary code.
1226 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
1227 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
1228 relocations.
1229 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
1230 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
1231 Fix problem with initial-exec relocations.
1232 (Target_i386::Relocate::relocate_tls): Likewise.
1233 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
1234 relaxation.
1235 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
1236 support for section-plus-offset dynamic table entries.
1237 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
1238 (Output_data_dynamic::Dynamic_entry): Add support for
1239 section-plus-offset dynamic table entries.
1240 (Output_data_dynamic::Classification): Likewise.
1241 (Output_data_dynamic::classification_): Renamed offset_.
1242 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
1243 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
1244 (Target_x86_64::make_plt_section): New function.
1245 (Target_x86_64::reserve_tlsdesc_entries): New function.
1246 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
1247 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
1248 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
1249 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
1250 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
1251 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
1252 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
1253 add extra PLT entry for TLS descriptors.
1254 (Output_data_plt_x86_64::got_): New field.
1255 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
1256 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
1257 fields.
1258 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
1259 descriptors.
1260 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
1261 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
1262 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
1263 R_386_TLS_DESC_CALL relocations.
1264 (Target_x86_64::Scan::global): Likewise.
1265 (Target_x86_64::do_finalize_sections): Add dynamic table entries
1266 for TLS descriptors.
1267 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
1268 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
1269 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
1270 GD-to-IE relaxation.
1271 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
1272 and TLS_DESCRIPTORS.
1273 * Makefile.in: Rebuild.
1274 * configure: Rebuild.
1275 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
1276 (tls_test_shared2.so): New target.
1277 (tls_shared_gd_to_ie_test_SOURCES): New variable.
1278 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
1279 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
1280 (tls_shared_gd_to_ie_test_LDADD): New variable.
1281 (tls_shared_gnu2_gd_to_ie_test): New target.
1282 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
1283 New targets.
1284 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
1285 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
1286 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
1287 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
1288 (tls_shared_gnu2_test): New target.
1289 (tls_test_gnu2_shared.so): New target.
1290 (tls_shared_gnu2_test_SOURCES): New variable.
1291 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
1292 (tls_shared_gnu2_test_LDFLAGS): New variable.
1293 (tls_shared_gnu2_test_LDADD): New variable.
1294 * testsuite/Makefile.in: Rebuild.
1295 * testsuite/Makefile.
1296
1297 2008-04-11 Ian Lance Taylor <iant@google.com>
1298
1299 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
1300 justsyms.t.
1301 * testsuite/Makefile.in: Rebuild.
1302
1303 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
1304 long.
1305 * testsuite/script_test_2.cc (main): Adjust test.
1306
1307 2008-04-11 David S. Miller <davem@davemloft.net>
1308 Ian Lance Taylor <iant@google.com>
1309
1310 * options.h (General_options): Add entries for '-Y' and
1311 '-relax'.
1312 * options.cc (General_options:finalize): If -Y was used, add those
1313 entries to the library path instead of the default "/lib" and
1314 "/usr/lib".
1315
1316 2008-04-11 David S. Miller <davem@davemloft.net>
1317
1318 * testsuite/justsyms.t: Start at 0x100.
1319 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
1320 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
1321 long.
1322 * testsuite/script_test_2.cc: Adjust string and section length
1323 checks.
1324
1325 2008-04-09 Ian Lance Taylor <iant@google.com>
1326
1327 PR gold/5996
1328 * script-sections.cc (Sections_element::allocate_to_segment): Add
1329 orphan parameter.
1330 (Output_section_definition::allocate_to_segment): Likewise.
1331 (Orphan_output_section::allocate_to_segment): Likewise.
1332 (Script_sections::attach_sections_using_phdrs_clause): Don't
1333 propagate non-PT_LOAD segments to orphan sections.
1334 * testsuite/Makefile.am (script_test_3.stdout): Generate using
1335 readelf rather than objdump.
1336 * testsuite/script_test_3.sh: Adjust accordingly. Test that
1337 .interp section and PT_INTERP segment are the same size.
1338 * testsuite/Makefile.in: Rebuild.
1339
1340 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
1341 aliases for symbols defined in the same object.
1342 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
1343 (weak_alias_test_SOURCES): New variable.
1344 (weak_alias_test_DEPENDENCIES): New variable.
1345 (weak_alias_test_LDFLAGS): New variable.
1346 (weak_alias_test_LDADD): New variable.
1347 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
1348 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
1349 (weak_alias_test_3.o): New target.
1350 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
1351 * testsuite/weak_alias_test_main.cc: New file.
1352 * testsuite/weak_alias_test_1.cc: New file.
1353 * testsuite/weak_alias_test_2.cc: New file.
1354 * testsuite/weak_alias_test_3.cc: New file.
1355
1356 2008-04-08 Ian Lance Taylor <iant@google.com>
1357
1358 * options.h (class General_options): Add --noinhibit-exec option.
1359 * main.cc (main): Check --noinhibit-exec.
1360
1361 * options.h (class General_options): Define --wrap as a special
1362 option. Add wrap_symbols_ field.
1363 (General_options::any_wrap_symbols): New function.
1364 (General_options::is_wrap_symbol): New function.
1365 * options.cc (General_options::parse_wrap): New function.
1366 (General_options::General_options): Initialize wrap_symbols_.
1367 * symtab.cc (Symbol_table::wrap_symbol): New function.
1368 (Symbol_table::add_from_object): Handle --wrap.
1369 * symtab.h (class Symbol_table): Declare wrap_symbol.
1370 * target.h (Target::wrap_char): New function.
1371 (Target::Target_info): Add wrap_char field.
1372 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
1373 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1374 * testsuite/testfile.cc (Target_test::test_target_info):
1375 Likewise.
1376
1377 * errors.cc (Errors::undefined_symbol): Mention symbol version if
1378 there is one.
1379
1380 * layout.h (class Layout): Add added_eh_frame_data_ field.
1381 * layout.cc (Layout::Layout): Initialize new field.
1382 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
1383 output section until we find a section we merged successfully.
1384 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
1385 that the size be non-zero.
1386
1387 * merge.cc (Object_merge_map::get_output_offset): Remove inline
1388 qualifier.
1389
1390 2008-04-08 Craig Silverstein <csilvers@google.com>
1391
1392 * configure.ac: Export new conditional variable HAVE_ZLIB.
1393 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
1394 on HAVE_ZLIB.
1395 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
1396 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1397
1398 2008-04-07 Ian Lance Taylor <iant@google.com>
1399
1400 * version.cc (version_string): Set to "1.5".
1401
1402 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
1403 Add issued_non_pic_error_ field. Declare check_non_pic.
1404 (Target_x86_64::Scan::check_non_pic): New function.
1405 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
1406 (Target_x86_64::Scan::global): Likewise.
1407
1408 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
1409 addend parameter. Change caller. Handle merge sections.
1410 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
1411 Address to Addend. Don't add in the result of
1412 local_section_offset, pass down the addend and use the returned
1413 value.
1414 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
1415 Update declarations of local_section_offset and symbol_value.
1416 * testsuite/two_file_test_1.cc (t18): New function.
1417 * testsuite/two_file_test_2.cc (f18): New function.
1418 * testsuite/two_file_test_main.cc (main): Call t18.
1419 * testsuite/two_file_test.h (t18, f18): Declare.
1420
1421 * configure.ac: Don't test for objdump, c++filt, or readelf.
1422 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
1423 conditionals.
1424 (TEST_READELF): New variable.
1425 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
1426 (check_PROGRAMS): Add two_file_strip_test.
1427 (two_file_strip_test): New target.
1428 (check_PROGRAMS): Add two_file_same_shared_strip_test.
1429 (two_file_same_shared_strip_test_SOURCES): New variable.
1430 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
1431 (two_file_same_shared_strip_test_LDFLAGS): New variable.
1432 (two_file_same_shared_strip_test_LDADD): New variable.
1433 (two_file_shared_strip.so): New target.
1434 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
1435 (ver_test_5.syms, ver_test_7.syms): Likewise.
1436 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
1437 (strip_test_3.stdout): Use TEST_OBJDUMP.
1438 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1439
1440 2008-04-04 Cary Coutant <ccoutant@google.com>
1441
1442 * symtab.h (Symbol::is_weak_undefined): New function.
1443 (Symbol::is_strong_undefined): New function.
1444 (Symbol::is_absolute): New function.
1445 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
1446 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
1447 absolute symbols.
1448 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
1449 (weak_undef_test): New target.
1450 * testsuite/Makefile.in: Rebuild.
1451 * testsuite/weak_undef_file1.cc: New file.
1452 * testsuite/weak_undef_file2.cc: New file.
1453 * testsuite/weak_undef_test.cc: New file.
1454
1455 2008-04-03 Craig Silverstein <csilvers@google.com>
1456
1457 * compressed_output.h (class Output_compressed_section): Use
1458 unsigned buffer.
1459 * compressed_output.cc (zlib_compress): Use unsigned buffers,
1460 add zlib header.
1461 (zlib_compressed_suffix): Removed.
1462 (Output_compressed_section::set_final_data_size): Use unsigned
1463 buffers.
1464 * testsuite/Makefile.am (flagstest_compress_debug_sections):
1465 Fix linker invocation.
1466 (flagstest_o_specialfile_and_compress_debug_sections):
1467 Likewise.
1468 * testsuite/Makefile.in: Regenerated.
1469
1470 2008-04-02 David S. Miller <davem@davemloft.net>
1471
1472 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
1473 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
1474
1475 2008-04-02 Craig Silverstein <csilvers@google.com>
1476
1477 * TODO: New file.
1478
1479 2008-04-02 Ian Lance Taylor <iant@google.com>
1480
1481 * fileread.cc (File_read::find_view): Add byteshift and vshifted
1482 parameters. Update for new key type to views_. Change all
1483 callers.
1484 (File_read::read): Adjust for byteshift in returned view.
1485 (File_read::add_view): New function, broken out of
1486 find_and_make_view.
1487 (File_read::make_view): New function, broken out of
1488 find_and_make_view.
1489 (File_read::find_or_make_view): Add offset and aligned
1490 parameters. Rewrite accordingly. Change all callers.
1491 (File_read::get_view): Add offset and aligned parameters. Adjust
1492 for byteshift in return value.
1493 (File_read::get_lasting_view): Likewise.
1494 * fileread.h (class File_read): Update declarations.
1495 (class File_read::View): Add byteshift_ field. Add byteshift to
1496 constructor. Add byteshift method.
1497 * archive.h (Archive::clear_uncached_views): New function.
1498 (Archive::get_view): Add aligned parameter. Change all callers.
1499 * object.h (Object::get_view): Add aligned parameter. Change all
1500 callers.
1501 (Object::get_lasting_view): Likewise.
1502
1503 * fileread.cc (File_read::release): Don't call clear_views if
1504 there are multiple objects.
1505 * fileread.h (File_read::clear_uncached_views): New function.
1506 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
1507 on the archive.
1508
1509 2008-03-31 Cary Coutant <ccoutant@google.com>
1510
1511 Add thin archive support.
1512 * archive.cc (Archive::armagt): New const.
1513 (Archive::setup): Remove task parameter and calls to unlock.
1514 (Archive::unlock_nested_archives): New function.
1515 (Archive::read_header): Add nested_off parameter. Change
1516 all callers.
1517 (Archive::interpret_header): Likewise.
1518 (Archive::include_all_members): Change to handle thin
1519 archives.
1520 (Archive::include_member): Likewise.
1521 * archive.h (Archive::Archive): Add new parameters and
1522 initializers.
1523 (Archive::armagt): New const.
1524 (Archive::setup): Remove task parameter.
1525 (Archive::unlock_nested_archives): New function.
1526 (Archive::read_header): Add nested_off parameter.
1527 (Archive::interpret_header): Likewise.
1528 (Archive::Nested_archive_table): New typedef.
1529 (Archive::is_thin_archive_): New field.
1530 (Archive::nested_archives_): New field.
1531 (Archive::options_): New field.
1532 (Archive::dirpath_): New field.
1533 (Archive::task_): New field.
1534 * readsyms.cc (Read_symbols::do_read_symbols): Add check
1535 for thin archives. Pass additional parameters to
1536 Archive::Archive. Unlock the archive file after calling
1537 Archive::setup.
1538
1539 2008-03-29 Ian Lance Taylor <iant@google.com>
1540
1541 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
1542 version symbol to be local.
1543 * testsuite/ver_test_4.sh: New file.
1544 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
1545 (check_DATA): Add ver_test_4.syms.
1546 (ver_test_4.syms): New target.
1547 * testsuite/Makefile.in: Rebuild.
1548
1549 * output.cc
1550 (Output_section::Input_section_sort_entry::has_priority): New
1551 function.
1552 (Output_section::Input_section_sort_entry::match_file_name): New
1553 function.
1554 (Output_section::Input_section_sort_entry::match_section_name):
1555 Remove.
1556 (Output_section::Input_section_sort_entry::match_section_name_prefix):
1557 Remove.
1558 (Output_section::Input_section_sort_entry::match_section_file):
1559 Remove.
1560 (Output_section::Input_section_sort_compare::operator()): Rewrite
1561 using new Input_section_sort_entry functions. Sort crtbegin and
1562 crtend first. Sort sections with no priority before sections with
1563 a priority.
1564 * testsuite/initpri1.c (d3): Check j != 4.
1565 (cd5): New constructor/destructor function.
1566 (main): Check j != 2.
1567
1568 * symtab.cc (Symbol_table::add_from_object): If we don't use the
1569 new symbol when resolving, don't call set_is_default.
1570 * testsuite/ver_test_7.cc: New file.
1571 * testsuite/ver_test_7.sh: New file.
1572 * testsuite/Makefile.am (ver_test_7.so): New target.
1573 (ver_test_7.o): New target.
1574 (check_SCRIPTS): Add ver_test_7.sh.
1575 (check_DATA): Add ver_test_7.syms.
1576 (ver_test_7.syms): New target.
1577
1578 2008-03-28 Ian Lance Taylor <iant@google.com>
1579
1580 * layout.cc (Layout::layout): If we see an input section with a
1581 name that needs sorting, set the must_sort flag for the output
1582 section.
1583 (Layout::make_output_section): If the name of the output section
1584 indicates that it might require sorting, set the may_sort flag.
1585 * output.h (Output_section::may_sort_attached_input_sections): New
1586 function.
1587 (Output_section::set_may_sort_attached_input_sections): New
1588 function.
1589 (Output_section::must_sort_attached_input_sections): New
1590 function.
1591 (Output_section::set_must_sort_attached_input_sections): New
1592 function.
1593 (class Output_section): Declare Input_section_sort_entry. Define
1594 Input_section_sort_compare. Declare
1595 sort_attached_input_sections. Add new fields:
1596 may_sort_attached_input_sections_,
1597 must_sort_attached_input_sections_,
1598 attached_input_sections_are_sorted_.
1599 * output.cc (Output_section::Output_section): Initialize new
1600 fields.
1601 (Output_section::add_input_section): Add an entry to
1602 input_sections_ if may_sort or must_sort are true.
1603 (Output_section::set_final_data_size): Call
1604 sort_attached_input_sections if necessary.
1605 (Output_section::Input_section_sort_entry): Define new class.
1606 (Output_section::Input_section_sort_compare::operator()): New
1607 function.
1608 (Output_section::sort_attached_input_sections): New function.
1609 * configure.ac: Check whether the compiler supports constructor
1610 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
1611 * testsuite/initpri1.c: New file.
1612 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
1613 CONSTRUCTOR_PRIORITY.
1614 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
1615 (initpri1_LDFLAGS): New variable.
1616 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
1617
1618 2008-03-27 Ian Lance Taylor <iant@google.com>
1619
1620 * common.cc (Sort_commons::operator): Correct sorting algorithm.
1621 * testsuite/common_test_1.c: New file.
1622 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
1623 (common_test_1_SOURCES): New variable.
1624 (common_test_1_DEPENDENCIES): New variable.
1625 (common_test_1_LDFLAGS): New variable.
1626
1627 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
1628 and commons_ correctly when NAME/VERSION does not override
1629 NAME/NULL.
1630 * testsuite/ver_test_6.c: New file.
1631 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
1632 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
1633 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
1634
1635 2008-03-26 Ian Lance Taylor <iant@google.com>
1636
1637 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
1638 of an undefined symbol from a version script.
1639 * testsuite/Makefile.am (ver_test_5.so): New target.
1640 (ver_test_5.o): New target.
1641 (check_SCRIPTS): Add ver_test_5.sh.
1642 (check_DATA): Add ver_test_5.syms.
1643 (ver_test_5.syms): New target.
1644 * testsuite/ver_test_5.cc: New file.
1645 * testsuite/ver_test_5.script: New file.
1646 * testsuite/ver_test_5.sh: New file.
1647 * Makefile.in, testsuite/Makefile.in: Rebuild.
1648
1649 PR gold/5986
1650 Fix problems building gold with gcc 4.3.0.
1651 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
1652 (gold_error_at_location, gold_warning_at_location): Use it.
1653 * configure.ac: Check whether we can compile and use a template
1654 function with a printf attribute.
1655 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
1656 when jumping over bytes.
1657 * object.cc: Instantiate Object::read_section_data.
1658 * debug.h: Include <cstring>
1659 * dwarf_reader.cc: Include <algorithm>
1660 * main.cc: Include <cstring>.
1661 * options.cc: Include <cstring>.
1662 * output.cc: Include <cstring>.
1663 * script.cc: Include <cstring>.
1664 * script.h: Include <string>.
1665 * symtab.cc: Include <cstring> and <algorithm>.
1666 * target-select.cc: Include <cstring>.
1667 * version.cc: Include <string>.
1668 * testsuite/testmain.cc: Include <cstdlib>.
1669 * configure, config.in: Rebuild.
1670
1671 2008-03-25 Ian Lance Taylor <iant@google.com>
1672
1673 * options.cc: Include "../bfd/bfdver.h".
1674 (options::help): Print bug reporting address.
1675
1676 * version.cc (print_version): Adjust output for current value of
1677 BFD_VERSION_STRING.
1678
1679 * NEWS: New file.
1680
1681 * options.cc (options::help): Print list of supported targets.
1682 * target-select.h: Include <vector>.
1683 (class Target_selector): Make machine_, size_, and is_big_endian_
1684 fields const. Add bfd_name_ and instantiated_target_ fields.
1685 (Target_selector::Target_selector): Add bfd_name parameter.
1686 (Target_selector::recognize): Make non-virtual, call
1687 do_recognize.
1688 (Target_selector::recognize_by_name): Make non-virtual, call
1689 do_recognize_by_name.
1690 (Target_selector::supported_names): New function.
1691 (Target_selector::bfd_name): New function.
1692 (Target_selector::do_instantiate_target): New pure virtual
1693 function.
1694 (Target_selector::do_recognize): New virtual function.
1695 (Target_selector::do_recognize_by_name): New virtual function.
1696 (Target_selector::instantiate_target): New private function.
1697 (supported_target_names): Declare.
1698 * target-select.cc (Target_selector::Target_selector): Update for
1699 new parameter and fields.
1700 (select_target_by_name): Check that the name matches before
1701 calling recognize_by_name.
1702 (supported_target_names): New function.
1703 * i386.cc (class Target_selector_i386): Update Target_selector
1704 constructor call. Remove recognize and recognize_by_name. Add
1705 do_instantiate_target.
1706 * x86_64.cc (class Target_selector_x86_64): Likewise.
1707 * testsuite/testfile.cc (class Target_selector_test): Update for
1708 changes to Target_selector.
1709
1710 * README: Rewrite, with some notes on unsupported features.
1711
1712 2008-03-24 Cary Coutant <ccoutant@google.com>
1713
1714 * i386.cc (Target_i386::Got_type): New enum declaration.
1715 (Target_i386::Scan::local): Updated callers of Output_data_got
1716 member functions.
1717 (Target_i386::Scan::global): Likewise.
1718 (Target_i386::Relocate::relocate): Likewise.
1719 (Target_i386::Relocate::relocate_tls): Likewise.
1720 * object.h (Got_offset_list): New class.
1721 (Sized_relobj::local_has_got_offset): Added got_type parameter.
1722 (Sized_relobj::local_got_offset): Likewise.
1723 (Sized_relobj::set_local_got_offset): Likewise.
1724 (Sized_relobj::local_has_tls_got_offset): Removed.
1725 (Sized_relobj::local_tls_got_offset): Removed.
1726 (Sized_relobj::set_local_tls_got_offset): Removed.
1727 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
1728 * output.cc (Output_data_got::add_global): Added got_type parameter.
1729 (Output_data_got::add_global_with_rel): Likewise.
1730 (Output_data_got::add_global_with_rela): Likewise.
1731 (Output_data_got::add_global_pair_with_rel): New function.
1732 (Output_data_got::add_global_pair_with_rela): New function.
1733 (Output_data_got::add_local): Added got_type parameter.
1734 (Output_data_got::add_local_with_rel): Likewise.
1735 (Output_data_got::add_local_with_rela): Likewise.
1736 (Output_data_got::add_local_pair_with_rel): New function.
1737 (Output_data_got::add_local_pair_with_rela): New function.
1738 (Output_data_got::add_global_tls): Removed.
1739 (Output_data_got::add_global_tls_with_rel): Removed.
1740 (Output_data_got::add_global_tls_with_rela): Removed.
1741 (Output_data_got::add_local_tls): Removed.
1742 (Output_data_got::add_local_tls_with_rel): Removed.
1743 (Output_data_got::add_local_tls_with_rela): Removed.
1744 * output.h (Output_data_got::add_global): Added got_type parameter.
1745 (Output_data_got::add_global_with_rel): Likewise.
1746 (Output_data_got::add_global_with_rela): Likewise.
1747 (Output_data_got::add_global_pair_with_rel): New function.
1748 (Output_data_got::add_global_pair_with_rela): New function.
1749 (Output_data_got::add_local): Added got_type parameter.
1750 (Output_data_got::add_local_with_rel): Likewise.
1751 (Output_data_got::add_local_with_rela): Likewise.
1752 (Output_data_got::add_local_pair_with_rel): New function.
1753 (Output_data_got::add_local_pair_with_rela): New function.
1754 (Output_data_got::add_global_tls): Removed.
1755 (Output_data_got::add_global_tls_with_rel): Removed.
1756 (Output_data_got::add_global_tls_with_rela): Removed.
1757 (Output_data_got::add_local_tls): Removed.
1758 (Output_data_got::add_local_tls_with_rel): Removed.
1759 (Output_data_got::add_local_tls_with_rela): Removed.
1760 * resolve.cc (Symbol::override_base_with_special): Removed
1761 reference to has_got_offset_ field.
1762 * symtab.cc (Symbol::init_fields): Replaced initialization
1763 of got_offset_ with got_offsets_. Removed initialization
1764 of has_got_offset_
1765 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
1766 (Symbol::got_offset): Likewise.
1767 (Symbol::set_got_offset): Likewise.
1768 (Symbol::has_tls_got_offset): Removed.
1769 (Symbol::tls_got_offset): Removed.
1770 (Symbol::set_tls_got_offset): Removed.
1771 (Symbol::got_offset_): Removed.
1772 (Symbol::tls_mod_got_offset_): Removed.
1773 (Symbol::tls_pair_got_offset_): Removed.
1774 (Symbol::got_offsets_): New field.
1775 (Symbol::has_got_offset): Removed.
1776 (Symbol::has_tls_mod_got_offset): Removed.
1777 (Symbol::has_tls_pair_got_offset): Removed.
1778 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
1779 (Target_x86_64::Scan::local): Updated callers of Output_data_got
1780 member functions.
1781 (Target_x86_64::Scan::global): Likewise.
1782 (Target_x86_64::Relocate::relocate): Likewise.
1783 (Target_x86_64::Relocate::relocate_tls): Likewise.
1784
1785 2008-03-25 Ben Elliston <bje@au.ibm.com>
1786
1787 * yyscript.y: Fix spelling error in comment.
1788
1789 2008-03-24 Ian Lance Taylor <iant@google.com>
1790
1791 * options.h (class General_options): Define build_id option.
1792 * layout.h (class Layout): Declare write_build_id, create_note,
1793 create_build_id. Add build_id_note_ member.
1794 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
1795 "libiberty.h", "md5.h", "sha1.h".
1796 (Layout::Layout): Initialize eh_frame_data_,
1797 eh_frame_hdr_section_, and build_id_note_.
1798 (Layout::finalize): Call create_build_id.
1799 (Layout::create_note): New function, broken out of
1800 Layout::create_gold_note.
1801 (Layout::create_gold_note): Call create_note.
1802 (Layout::create_build_id): New function.
1803 (Layout::write_build_id): New function.
1804 (Close_task_runner::run): Call write_build_id.
1805
1806 * x86_64.cc: Correct license to GPLv3.
1807
1808 2008-03-23 Ian Lance Taylor <iant@google.com>
1809
1810 * options.cc: Include "demangle.h".
1811 (parse_optional_string): New function.
1812 (parse_long_option): Handle takes_optional_argument.
1813 (parse_short_option): Update dash_z initializer. Handle
1814 takes_optional_argument.
1815 (General_options::General_options): Initialize do_demangle_.
1816 (General_options::finalize): Set do_demangle_. Handle demangling
1817 style.
1818 * options.h (parse_optional_string): Declare.
1819 (struct One_option): Add optional_arg field. Update constructor.
1820 Update call constructor calls. Add takes_optional_argument
1821 function.
1822 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
1823 (DEFINE_optional_string): Define.
1824 (General_options::demangle): Change from DEFINE_bool to
1825 DEFINE_optional_string.
1826 (General_options::no_demangle): New function.
1827 (General_options::do_demangle): New function.
1828 (General_options::set_do_demangle): New function.
1829 (General_options::execstack_status_): Move definition to end of
1830 class definition.
1831 (General_options::static_): Likewise.
1832 (General_options::do_demangle_): New field.
1833 * object.cc (big_endian>::get_symbol_location_info): Call
1834 Options::do_demangle, not Options::demangle.
1835 * symtab.cc (demangle): Likewise.
1836
1837 2008-03-22 Ian Lance Taylor <iant@google.com>
1838
1839 * gold.h: Include <cstddef> and <sys/types.h>
1840 * options.h: Include <cstring>.
1841
1842 2008-03-21 Ian Lance Taylor <iant@google.com>
1843
1844 * Added source code to GNU binutils.
1845