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