* testsuite/initpri1.c: Don't try to use constructor priorities if
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2009-09-26 Ian Lance Taylor <iant@google.com>
2
3 * testsuite/initpri1.c: Don't try to use constructor priorities if
4 compiling with gcc before 4.3.
5
6 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7
8 * testsuite/retain_symbols_file_test.sh (check_present): Change
9 output file name to retain_symbols_file_test.stdout.
10 (check_absent): Likewise.
11
12 2009-09-18 Craig Silverstein <csilvers@google.com>
13
14 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
15 * options.cc: Include <cerrno> and <fstream>.
16 (General_options::finalize): Parse -retain-symbols-file tag.
17 * options.h: New flag.
18 (General_options): New method should_retain_symbol, new
19 variable symbols_to_retain.
20 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
21 should_retain_symbol map.
22 * testsuite/Makefile.am (retain_symbols_file_test): New test.
23 * testsuite/Makefile.in: Regenerate.
24 * testsuite/retain_symbols_file_test.sh: New file.
25
26 2009-09-18 Nick Clifton <nickc@redhat.com>
27
28 * po/es.po: Updated Spanish translation.
29
30 2009-09-17 Doug Kwan <dougkwan@google.com>
31
32 * debug.h (DEBUG_RELAXATION): New constant.
33 (DEBUG_ALL): Add DEBUG_RELAXATION.
34 (debug_string_to_enum): Add relaxation debug option.
35 * layout.cc
36 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
37 Layout::Relaxation_debug_check::read_sections,
38 Layout::Relaxation_debug_check::read_sections): New method definitions.
39 (Layout::Layout): Initialize data members
40 record_output_section_data_from_scrips_,
41 script_output_section_data_list_ and relaxation_debug_check_.
42 (Layout::save_segments, Layout::restore_segments,
43 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
44 Layout::relaxation_loop_body): New method definitions.
45 (Layout::finalize): Support relaxation. Move section layout code to
46 Layout::relaxation_loop_body.
47 (Layout::set_asection_address_from_script): Move code for orphan
48 section placement out.
49 (Layout::place_orphan_sections_in_script): New method definition.
50 * layout.h (Output_segment_headers, Output_file_header):
51 New forward class declarations.
52 (Layout::~Layout): Define.
53 (Layout::new_output_section_data_from_script): New method definition.
54 (Layout::place_orphan_sections_in_script): New method declaration.
55 (Layout::Segment_states): New type declaration.
56 (Layout::save_segments, Layout::restore_segments,
57 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
58 Layout::relaxation_loop_body): New method declarations.
59 (Layout::Output_section_data_list): New type declaration.
60 (Layout::Relaxation_debug_check): New class definition.
61 (Layout::record_output_section_data_from_script_,
62 Layout::script_output_section_data_list_, Layout::segment_states_,
63 Layout::relaxation_debug_check_): New data members.
64 * output.cc: (Output_section_headers::do_size): New method definition.
65 (Output_section_headers::Output_section_headers): Move size
66 computation to Output_section_headers::do_size.
67 (Output_segment_headers::do_size): New method definition.
68 (Output_file_header::Output_file_header): Move size computation to
69 Output_file_header::do_size and call it.
70 (Output_file_header::do_size): New method definition.
71 (Output_data_group::Output_data_group): Adjust call to
72 Output_section_data.
73 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
74 (Output_symtab_xindex::do_write): Add array bound check.
75 (Output_section::Input_section::print_to_mapfile): Handle
76 RELAXED_INPUT_SECTION_CODE.
77 (Output_section::Output_section): Initialize data member checkpoint_.
78 (Output_section::~Output_section): Delete checkpoint object pointed
79 by checkpoint_.
80 (Output_section::add_input_section): Always add an Input_section if
81 relaxing.
82 (Output_section::add_merge_input_section): Add assert.
83 (Output_section::relax_input_section): New method definition.
84 (Output_section::set_final_data_size): Set load address to zero for
85 an unallocated section.
86 (Output_section::do_address_and_file_offset_have_reset_values):
87 New method definition.
88 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
89 Handle relaxed input section.
90 (Output_section::sort_attached_input_sections): Checkpoint input
91 section list lazily.
92 (Output_section::get_input_sections): Change type of input_sections to
93 list of Simple_input_section pointers. Checkpoint input section list
94 lazily. Also handle relaxed input sections.
95 (Output_section::add_input_section_for_script): Take a reference to
96 a Simple_input_section object instead of Relobj pointer and section
97 index as parameter. Handle relaxed input sections.
98 (Output_section::save_states, Output_section::restore_states): New
99 method definitions.
100 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
101 (Output_data::is_data_size_fixed): New method definition.
102 (Output_data::reset_addresss_and_file_offset): Do not reset data size
103 if it is fixed.
104 (Output_data::address_and_file_offset_have_reset_values): New method
105 definition.
106 (Output_data::do_address_and_file_offset_have_reset_values): New method
107 definition.
108 (Output_data::set_data_size): Check that data size is not fixed.
109 (Output_data::fix_data_size): New method definition.
110 (Output_data::is_data_size_fixed_): New data member.
111 (Output_section_headers::set_final_data_size): New method definition.
112 (Output_section_headers::do_size): New method declaration.
113 (Output_segment_headers::set_final_data_size): New method definition.
114 (Output_segment_headers::do_size): New method declaration.
115 (Output_file_header::set_final_data_size)::New method definition.
116 (Output_file_header::do_size)::New method declaration.
117 (Output_section_data::Output_section_data): Add new parameter
118 is_data_size_fixed and use it to fix data size.
119 (Output_data_const::Output_data_const): Adjust call to base class
120 constructor and fix data size.
121 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
122 base class constructor and fix data size.
123 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
124 base class constructor and fix data size.
125 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
126 class constructor and fix data size.
127 (Output_data_group::set_final_data_size): New method definition.
128 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
129 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
130 class constructor and fix data size.
131 (Output_relaxed_input_section): New class definition.
132 (Output_section::Simple_input_section): New class definition.
133 (Output_section::get_input_sections): Adjust parameter list.
134 (Output_section::add_input_section_for_script): Same.
135 (Output_section::save_states, Output_section::restore_states,
136 Output_section::do_address_and_file_offset_have_reset_values,
137 (Output_section::Input_section::Input_section): Handle
138 RELAXED_INPUT_SECTION_CODE. Add new overload for
139 Output_relaxed_input_section.
140 (Output_section::Input_section::is_input_section,
141 Output_section::Input_section::set_output_section): Handle relaxed
142 input section.
143 (Output_section::Input_section::is_relaxed_input_section,
144 Output_section::Input_section::output_section_data,
145 Output_section::Input_section::relaxed_input_section): New method
146 definitions.
147 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
148 value.
149 (Output_section::Input_section::u1_): Update comments.
150 (Output_section::Input_section::u2_): Add new union member poris.
151 (Output_section::Checkpoint_output_section): New classs definition.
152 (Output_section::relax_input_section): New method declaration.
153 (Output_section::checkpoint_): New data member.
154 (Output_segment): Update comments.
155 (Output_segment::Output_segment): Un-privatize copy constructor.
156 (Output_segment::operator=): Un-privatize.
157 * script-sections.cc (Output_section_element::Input_section_list):
158 Change element type to Output_section::Simple_input_section.
159 (Output_section_element_dot_assignment::set_section_addresses):
160 Register output section data for relaxation clean up.
161 (Output_data_exression::Output_data_expression): Adjust call to base
162 constructor to fix data size.
163 (Output_section_element_data::set_section_addresses): Register
164 Output_data_expression object for relaxation clean up.
165 (struct Input_section_info): Replace Relobj pointer and section index
166 pair with Output_section::Simple_input_section and Convert struct to a
167 class.
168 (Input_section_sorter::operator()): Adjust access to
169 Input_section_info data member to use accessors.
170 (Output_section_element_input::set_section_addresses): Use layout
171 parameter. Adjust code to use Output_section::Simple_input_section
172 and Input_secction_info classes. Register filler for relaxation
173 clean up.
174 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
175 and section index pair with Output_section::Simple_input_section
176 class. Adjust code accordingly.
177 (Phdrs_element::release_segment): New method definition.
178 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
179 segment list.
180 (Script_sections::release_segments): New method definition.
181 * gold/script-sections.h (Script_sections::release_segments): New
182 method declaration.
183 * gold/target.h (Target::may_relax, Target::relax,
184 Target::do_may_relax, Target::do_relax): New method definitions.
185
186 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
187
188 * arm.cc (has_signed_unsigned_overflow): New function.
189 (Arm_relocate_functions::abs8): New function.
190 (Target_arm::Scan::local): Handle R_ARM_ABS8.
191 (Target_arm::Scan::global): Likewise.
192 (Target_arm::relocate::relocate): Likewise.
193 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
194 Likewise.
195
196 2009-09-16 Cary Coutant <ccoutant@google.com>
197
198 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
199 * testsuite/Makefile.in: Regenerate.
200
201 2009-09-11 Nick Clifton <nickc@redhat.com>
202
203 * po/gold.pot: Updated by the Translation project.
204
205 2009-09-08 Cary Coutant <ccoutant@google.com>
206
207 * output.cc (Output_file::open): Add execute permission to empty file.
208 * testsuite/Makefile.am (permission_test): New test.
209 * testsuite/Makefile.in: Regenerate.
210
211 2009-09-02 Ian Lance Taylor <iant@google.com>
212
213 * output.cc (Output_file::resize): Call map_no_anonymous rather
214 than map.
215
216 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
217
218 * gold.cc: Include "incremental.h".
219 (queue_initial_tasks): Call Incremental_checker methods.
220 * incremental.cc: Include "output.h".
221 (Incremental_checker::can_incrementally_link_output_file): New
222 method.
223 * incremental.h (Incremental_checker): New class.
224
225 * output.cc (Output_file::open_for_modification): New method.
226 (Output_file::map_anonymous): Changed return type to bool. Record
227 map in base_ field.
228 (Output_file::map_no_anonymous): New method, broken out of map.
229 (Output_file::map): Use map_no_anonymous and map_anonymous.
230 * output.h (class Output_file): Update declarations.
231
232 2009-08-24 Cary Coutant <ccoutant@google.com>
233
234 * options.h (Command_line::Pre_options): New class.
235 (Command_line::pre_options): New member.
236 * options.cc (gold::options::ready_to_register): New variable.
237 (One_option::register_option): Do nothing if not registering options.
238 Assert if same short option registered twice.
239 (General_options::General_options): Turn off option registration when
240 done constructing.
241 (Command_line::Pre_options::Pre_options): New constructor.
242
243 2009-08-24 Cary Coutant <ccoutant@google.com>
244
245 * options.h (General_options::no_keep_memory): Remove incorrect
246 short option.
247
248 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
249
250 * Makefile.am (am__skiplex, am__skipyacc): New.
251 * Makefile.in: Regenerate.
252
253 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
254
255 * Makefile.am (AM_CPPFLAGS): Renamed from ...
256 (INCLUDES): ... this.
257 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
258 (AM_CPPFLAGS): Renamed from ...
259 (INCLUDE): ... this.
260 * Makefile.in, testsuite/Makefile.in: Regenerate.
261
262 * Makefile.in: Regenerate.
263 * aclocal.m4: Likewise.
264 * config.in: Likewise.
265 * configure: Likewise.
266 * testsuite/Makefile.in: Likewise.
267
268 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
269 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
270 * Makefile.in: Regenerate.
271 * testsuite/Makefile.in: Regenerate.
272
273 2009-08-19 Cary Coutant <ccoutant@google.com>
274
275 * resolve.cc (Symbol_table::resolve): Don't complain about defined
276 symbols in shared libraries overridden by hidden or internal symbols
277 in the main program.
278
279 2009-08-19 Chris Demetriou <cgd@google.com>
280
281 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
282 checking source file names in error messages.
283
284 2009-08-18 Doug Kwan <dougkwan@google.com>
285
286 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
287 an elcpp::Ehdr as parameter. Adjust call to set_target.
288 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
289 an elfcpp::Ehdr as parameter.
290 * object.cc (Object::set_target): Remove the version that looks up
291 a target and sets it.
292 (Sized_relobj::setup): Take a Target object instead of
293 an elfcpp::Ehdr as parameter. Adjust call to set_target.
294 (make_elf_sized_object): Find target and ask target to
295 make an ELF object.
296 * object.h: (Object::set_target): Remove the version that looks up
297 a target and sets it.
298 (Sized_relobj::setup): Take a Target object instead of
299 an elfcpp:Ehdr as parameter.
300 * target.cc: Include dynobj.h.
301 (Target::do_make_elf_object_implementation): New.
302 (Target::do_make_elf_object): New.
303 * target.h (Target::make_elf_object): New template declaration.
304 (Target::do_make_elf_object): New method declarations.
305 (Target::do_make_elf_object_implementation): New template declaration.
306
307 2009-08-14 Ian Lance Taylor <iant@google.com>
308
309 * gold.h (FUNCTION_NAME): Define.
310 (gold_unreachable): Use FUNCTION_NAME.
311
312 2009-08-12 Sriraman Tallam <tmsriram@google.com>
313
314 * icf.cc (Icf::find_identical_sections): Issue a warning when a
315 symbol in the --keep-unique list is not found.
316
317 2009-08-12 Sriraman Tallam <tmsriram@google.com>
318
319 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
320 been maked as --keep-unique.
321 (Icf::unfold_section): New function.
322 * icf.h (Icf::unfold_section): New function.
323 * options.h (General_options::keep_unique): New option.
324 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
325 * testsuite/Makefile.in: Regenerate.
326 * testsuite/icf_keep_unique_test.sh: New file.
327 * testsuite/icf_keep_unique_test.cc: New file.
328
329 2009-08-12 Cary Coutant <ccoutant@google.com>
330
331 PR 10471
332 * resolve.cc (Symbol_table::resolve): Check for references from
333 dynamic objects to hidden and internal symbols.
334 * testsuite/Makefile.am (hidden_test.sh): New test.
335 * testsuite/Makefile.in: Regenerate.
336 * testsuite/hidden_test.sh: New script.
337 * testsuite/hidden_test_1.c: New test source.
338 * testsuite/hidden_test_main.c: New test source.
339
340 2009-08-11 Doug Kwan <dougkwan@google.com>
341
342 * arm.cc: Update comments.
343 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
344 segment to locate the .ARM.exidx section if present.
345
346 2009-08-09 Doug Kwan <dougkwan@google.com>
347
348 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
349 patch.
350
351 2009-08-07 Sriraman Tallam <tmsriram@google.com>
352 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
353 compiler warnings.
354
355 2009-08-06 Sriraman Tallam <tmsriram@google.com>
356
357 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
358 valid tls_segment only for non-debug-section relocations.
359 * testsuite/Makefile.am: Add gc_tls_test.
360 * testsuite/Makefile.in: Regenerate.
361 * testsuite/gc_tls_test.cc: New file.
362 * testsuite/gc_tls_test.sh: New file.
363
364 2009-08-05 Sriraman Tallam <tmsriram@google.com>
365
366 * icf.cc: New file.
367 * icf.h: New file.
368 * Makefile.am (CCFILES): Add icf.cc.
369 (HFILES): Add icf.h
370 * Makefile.in: Regenerate.
371 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
372 * gc.h (gc_process_relocs): Populate lists used by icf to contain
373 section, symbol and addend information for the relocs.
374 * gold.cc (queue_middle_tasks): Call identical code folding.
375 * gold.h: Add defines for multimap.
376 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
377 to the call of finalize_local_symbols.
378 * main.cc (main): Create object of class Icf.
379 * object.cc (Sized_relobj::do_layout): Allow this function to be
380 called twice during icf.
381 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
382 to sections marked as identical by icf.
383 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
384 when available.
385 (Sized_relobj::do_section_entsize): New function.
386 * object.h (Object::section_entsize): New function.
387 (Object::do_section_entsize): New pure virtual function.
388 (Relobj::finalize_local_symbols): Add new parameter.
389 (Relobj::do_section_entsize): New function.
390 * options.h (General_options::icf): New option.
391 (General_options::icf_iterations): New option.
392 (General_options::print_icf_sections): New option.
393 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
394 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
395 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
396 icf.
397 * symtab.cc (Symbol_table::is_section_folded): New function.
398 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
399 to sections marked as identical by icf.
400 * symtab.h (Symbol_table::set_icf): New function.
401 (Symbol_table::icf): New function.
402 (Symbol_table::is_section_folded): New function.
403 (Symbol_table::icf_): New data member.
404 * target-reloc.h (relocate_section): Ignore sections folded by icf.
405 * testsuite/Makefile.am: Add commands to build icf_test.
406 * testsuite/Makefile.in: Regenerate.
407 * testsuite/icf_test.sh: New file.
408 * testsuite/icf_test.cc: New file.
409
410 2009-07-24 Chris Demetriou <cgd@google.com>
411
412 * layout.cc (is_compressible_debug_section): Fix incorrect
413 comment about compressed section names.
414
415 2009-07-20 Ian Lance Taylor <ian@airs.com>
416
417 PR 10419
418 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
419
420 2009-07-16 Ian Lance Taylor <iant@google.com>
421
422 PR 10400
423 * layout.h: #include <map>.
424 (class Kept_section): Change from struct to class. Add accessors
425 and setters. Add section size to Comdat_group mapping. Change
426 Comdat_group to std::map. Add is_comdat_ field. Add
427 linkonce_size field in union.
428 (class Layout): Update declaration of find_or_add_kept_section.
429 Don't declare find_kept_object.
430 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
431 parameter. Add object, shndx, is_comdat, and is_group_name
432 parameters. Change all callers. Adjust for new Kept_section.
433 (Layout::find_kept_object): Remove.
434 * object.cc (Sized_relobj::include_section_group): Update use of
435 Kept_section. Rename secnum to shndx. Only record
436 Kept_comdat_section if sections are the same size.
437 (Sized_relobj::include_linkonce_section): Update use of
438 Kept_section. Only record Kept_comdat_section if sections are the
439 same size. Set size of linkonce section.
440 (Sized_relobj::map_to_kept_section): Update call to
441 get_kept_comdat_section.
442 * object.h (class Sized_relobj): Rename fields in
443 Kept_comdat_section to drop trailing underscores; change object
444 field to Relobj*. Change Kept_comdat_section_table to store
445 struct rather than pointer.
446 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
447 Add kept_object and kept_shndx parameters. Change all callers.
448 (Sized_relobj::get_kept_comdat_section): Change return type to
449 bool. Add kept_object and kept_shndx parameters. Change all
450 callers.
451 * plugin.cc (Pluginobj::include_comdat_group): Update call to
452 Layout::find_or_add_kept_section.
453
454 2009-07-09 Ian Lance Taylor <iant@google.com>
455
456 * merge.cc (Object_merge_map::initialize_input_to_output_map):
457 Reserve space in the hash table.
458
459 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
460
461 * fileread.cc (File_read::get_mtime): New method.
462 * fileread.h (Timespec): New structure.
463 (File_read::get_mtime): New method.
464 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
465 Renamed from timestamp_nsec.
466 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
467 Elf_Xword.
468 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
469 timestamp_nsec.
470 (Incremental_inputs::report_archive): Save mtime; style fix.
471 (Incremental_inputs::report_obejct): Save mtime; style fix.
472 (Incremental_inputs::report_script): Save mtime; style fix.
473 (Incremental_inputs::finalize_inputs): Style fix.
474 (Incremental_inputs::finalize): Style fix.
475 (Incremental_inputs::create_input_section_data): Store inputs
476 mtime.
477 * incremental.h (Incremental_inputs::report_script): Add mtime
478 argument.
479 (Incremental_inputs::Input_info::Input_info): Intialize only one
480 union member.
481 (Incremental_inputs::Input_info::archive): Move to nameless
482 union.
483 (Incremental_inputs::Input_info::obejct): Move to nameless union.
484 (Incremental_inputs::Input_info::script): Move to nameless union.
485 (Incremental_inputs::mtime): New field.
486 * script.cc (read_input_script): Pass file mtime to
487 Incremental_input.
488 * script.h (Script_info::inputs): Style fix.
489
490 2009-07-01 Ian Lance Taylor <ian@airs.com>
491
492 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
493 instead of 32.
494
495 2009-06-24 Ian Lance Taylor <iant@google.com>
496
497 PR 10156
498 * layout.cc (Layout::choose_output_section): If we find an
499 existing section, update the flags.
500 (Layout::create_notes): New function, broken out of
501 Layout::finalize.
502 (Layout::finalize): Don't create note sections.
503 (Layout::create_note): Don't crash if linker script discards
504 section.
505 (Layout::create_gold_note): Likewise.
506 (Layout::create_build_id): Likewise. Don't set
507 after_input_sections on the section.
508 (Layout::create_executable_stack_info): Remove target parameter.
509 Change caller.
510 * layout.h (class Layout): Declare create_notes. Update
511 declaration of create_executable_stack_info.
512 * gold.cc (queue_middle_tasks): Call create_notes.
513 * output.cc (Output_section::update_flags_for_input_section): Move
514 here from output.h. If SHF_ALLOC flag is newly set, mark address
515 invalid.
516 * output.h (Output_data::mark_address_invalid): New function.
517 (class Output_section): Only declare, not define,
518 update_flags_for_input_section. Remove set_flags.
519
520 2009-06-24 Ian Lance Taylor <iant@google.com>
521
522 * script-sections.cc (Output_section_definition::
523 set_section_addresses): Rename shadowing local load_address to
524 laddr.
525
526 2009-06-24 Ian Lance Taylor <iant@google.com>
527
528 PR 10244
529 * reloc.cc (relocate_sections): Skip empty relocation sections.
530
531 2009-06-23 Ian Lance Taylor <iant@google.com>
532
533 PR 10156
534 * layout.cc (Layout::create_note): Use choose_output_section
535 rather than make_output_section.
536
537 2009-06-23 Ian Lance Taylor <iant@google.com>
538
539 PR 10237
540 * options.cc (General_options::parse_V): Set printed_version_.
541 (General_options::General_options): Initialize printed_version_.
542 * options.h (class General_options): Add printed_version_ field.
543 * gold.cc (queue_initial_tasks): If there are no input files,
544 don't give a fatal error if we printed the version information.
545 (queue_middle_tasks): If using -r with a shared object, give a
546 fatal error rather than an ordinary error.
547
548 2009-06-23 Ian Lance Taylor <iant@google.com>
549
550 PR 10219
551 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
552 (Layout::make_output_section): Set have_stabstr_section_ if we see
553 a .stab*str section.
554 (Layout::finalize): Call link_stabs_sections.
555 (Layout::link_stabs_sections): New file.
556 * layout.h (class Layout): Add have_stabstr_section_ field.
557 Declare link_stabs_sections.
558
559 2009-06-23 Doug Kwan <dougkwan@google.com>
560
561 * Makefile.am (libgold_a_LIBADD): New.
562 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
563 * Makefile.in: Regenerate.
564 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
565 * configure: Regenerate.
566 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
567 * fileread.cc: Include sys/state.h
568 * gold.h: Declare memmem and strndup if found missing.
569 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
570
571 2009-06-23 Ian Lance Taylor <iant@google.com>
572
573 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
574 * configure: Rebuild.
575
576 2009-06-23 Ian Lance Taylor <iant@google.com>
577
578 PR 10147
579 * object.cc (Object::section_contents): Don't try to get a view if
580 the section has length zero.
581 (Object::handle_gnu_warning_section): If the section is empty, use
582 the name of the section as the warning.
583
584 2009-06-23 Ian Lance Taylor <iant@google.com>
585
586 PR 10133
587 * stringpool.h (class Stringpool_template): Add optimize_ field.
588 (Stringpool_template::set_optimize): New function.
589 * stringpool.cc (Stringpool_template::Stringpool_template):
590 Initialize optimize_ field.
591 (Stringpool_template::set_string_offsets): Test local optimize
592 fild rather than parameter.
593 * layout.cc (Layout::Layout): Call set_optimize on the section
594 name stringpool.
595
596 2009-06-22 Ian Lance Taylor <iant@google.com>
597
598 PR 10030
599 * yyscript.y: Parse TARGET.
600 * script.cc (script_set_target): New function.
601 * script-c.h (script_set_target): Declare.
602 * options.cc (General_options::string_to_object_format): Rename
603 from string_to_object_format in anonymous namespace. Change
604 callers.
605 * options.h (class General_options): Declare
606 string_to_object_format.
607
608 2009-06-22 Ian Lance Taylor <iant@google.com>
609
610 * script-sections.cc (Script_sections::create_segments): Don't put
611 program headers in a PT_LOAD segment if -n or -N.
612
613 2009-06-22 Ian Lance Taylor <iant@google.com>
614
615 PR 10141
616 * options.h (class General_options): Add -z lazy and -z now. Sort
617 -z options into alphabetical order.
618 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
619
620 2009-06-21 Ian Lance Taylor <iant@google.com>
621
622 * layout.cc (Layout::make_output_section): Call
623 Target::new_output_section.
624 (Layout::attach_allocated_section_to_segment): Put large section
625 sections in a separate load segment with the large segment flag
626 set.
627 (Layout::segment_precedes): Sort large data segments after other
628 load segments.
629 (align_file_offset): New static function.
630 (Layout::set_segment_offsets): Use align_file_offset.
631 * output.h (class Output_section): Add is_small_section_ and
632 is_large_section_ fields.
633 (Output_section::is_small_section): New function.
634 (Output_section::set_is_small_section): New function.
635 (Output_section::is_large_section): New function.
636 (Output_section::set_is_large_section): New function.
637 (Output_section::is_large_data_section): New function.
638 (class Output_segment): Add is_large_data_segment_ field.
639 (Output_segment::is_large_data_segment): New function.
640 (Output_segment::set_is_large_data_segment): New function.
641 * output.cc (Output_section::Output_section): Initialize new
642 fields.
643 (Output_segment::Output_segment): Likewise.
644 (Output_segment::add_output_section): Add assertion that large
645 data sections always go in large data segments. Force small data
646 sections to the end of the list of data sections. Force small BSS
647 sections to the start of the list of BSS sections. For large BSS
648 sections to the end of the list of BSS sections.
649 * symtab.h (class Symbol): Declare is_common_shndx.
650 (Symbol::is_defined): Check Symbol::is_common_shndx.
651 (Symbol::is_common): Likewise.
652 (class Symbol_table): Define enum Commons_section_type. Update
653 declarations. Add small_commons_ and large_commons_ fields.
654 * symtab.cc (Symbol::is_common_shndx): New function.
655 (Symbol_table::Symbol_table): Initialize new fields.
656 (Symbol_table::add_from_object): Put small and large common
657 symbols in the right list.
658 (Symbol_table::sized_finalized_symbol): Check
659 Symbol::is_common_shndx.
660 (Symbol_table::sized_write_globals): Likewise.
661 * common.cc (Symbol_table::do_allocate_commons): Allocate new
662 common symbol lists. Don't call do_allocate_commons_list if the
663 list is empty.
664 (Symbol_table::do_allocate_commons_list): Remove is_tls
665 parameter. Add comons_section_type parameter. Change all
666 callers. Handle small and large common symbols.
667 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
668 Symbol::is_common_shndx.
669 * resolve.cc (symbol_to_bits): Likewise.
670 * target.h (Target::small_common_shndx): New function.
671 (Target::small_common_section_flags): New function.
672 (Target::large_common_shndx): New function.
673 (Target::large_common_section_flags): New function.
674 (Target::new_output_section): New function.
675 (Target::Target_info): Add small_common_shndx, large_common_shndx,
676 small_common_section_flags, and large_common_section_flags
677 fields.
678 (Target::do_new_output_section): New virtual function.
679 * arm.cc (Target_arm::arm_info): Initialize new fields.
680 * i386.cc (Target_i386::i386_info): Likewise.
681 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
682 Likewise.
683 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
684 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
685 (Target_x86_64::do_new_output_section): New function.
686 * configure.ac: Define conditional MCMODEL_MEDIUM.
687 * testsuite/Makefile.am (check_PROGRAMS): Add large.
688 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
689 (large_LDFLAGS): Define.
690 * testsuite/large.c: New file.
691 * testsuite/testfile.cc (Target_test::test_target_info):
692 Initialize new fields.
693 * configure, testsuite/Makefile.in: Rebuild.
694
695 2009-06-05 Doug Kwan <dougkwan@google.com>
696
697 * Makefile.am (CCFILES): Add target.cc.
698 * Makefile.in: Regenerate.
699 * i386.cc (class Target_i386): Define new virtual method to
700 override do_is_local_label_name in parent.
701 * object.cc (Sized_relobj::do_count_local_symbols): Discard
702 local symbols if --discard-locals or -X is given.
703 * options.h (class General_options): Declare new options
704 '--discard-locals' and '-X' for discarding locals.
705 * target.h (class Target): Define new methods is_local_label_name.
706 Declare new virtual method do_is_local_label_name.
707 * target.cc: New file.
708 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
709 (check_SCRIPTS): Add discard_locals_test.sh.
710 (check_DATA): Add discard_local_tests.syms.
711 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
712 (discard_local_tests.syms, discard_locals_test.o): New make rules.
713 * testsuite/Makefile.in: Regenerate.
714 * testsuite/discard_locals_test.c: New file.
715 * testsuite/discard_locals_test.sh: Same.
716
717 2009-06-05 Doug Kwan <dougkwan@google.com>
718
719 * object.cc (Sized_relobj::Sized_relobj): Initialize
720 discarded_eh_frame_shndx_ to -1U.
721 (Sized_relobj::do_layout): Record index of a discard .eh_frame
722 section.
723 (Sized_relobj::do_count_local_symbols): Skip local symbols in
724 a discarded .eh_frame section.
725 (Sized_relobj::do_finalize_local_symbols): Ditto.
726 * object.h (class Sized_relobj): Declare new member
727 discarded_eh_frame_shndx_.
728 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
729 (local_labels_test.o, local_labels_test): New rules.
730 * testsuite/Makefile.in: Regenerate.
731
732 2009-06-04 Doug Kwan <dougkwan@google.com>
733
734 * layout.cc (Layout::section_name_mapping): Add mapping for
735 special ARM sections.
736
737 2009-06-03 Doug Kwan <dougkwan@google.com>
738
739 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
740 (utils::has_overflow): Same.
741
742 2009-06-03 Ian Lance Taylor <iant@google.com>
743
744 * layout.cc (Layout::section_name_mapping): New array, replacing
745 Layout::linkonce_mapping.
746 (Layout::section_name_mapping_count): New variable, replacing
747 Layout::linkonce_mapping_count.
748 (Layout::linkonce_output_name): Remove.
749 (Layout::output_section_name): Rewrite.
750 * layout.h (class Layout): Rename Linkonce_mapping to
751 Section_name_mapping, linkonce_mapping to section_name_mapping,
752 linkonce_mapping_count to section_name_mapping_count. Don't
753 declare linkonce_output_name.
754
755 2009-06-03 Doug Kwan <dougkwan@google.com>
756
757 * gold/arm.cc (namespace utils): New.
758 (Target_arm::reloc_is_non_pic): Define new method.
759 (class Arm_relocate_functions): New.
760 (Target_arm::Relocate::relocate): Handle relocation types used by
761 Android.
762
763 2009-06-03 Ian Lance Taylor <iant@google.com>
764
765 * arm.cc (Target_arm::scan::global): Use || instead of |.
766
767 2009-06-02 Doug Kwan <dougkwan@google.com>
768
769 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
770 issued_non_pic_error_.
771 (class Target_arm::Scan): Declare new method check_non_pic.
772 Define new method symbol_needs_plt_entry.
773 Declare new data member issued_non_pic_error_.
774 (class Target_arm::Relocate): Declare new method
775 should_apply_static_reloc.
776 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
777 (Target_arm::Scan::check_non_pic): Define new method.
778 (Target_arm::Scan::local): Handle a small subset of reloc types used
779 by Android.
780 (Target_arm::Scan::local): Same.
781 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
782
783 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
784
785 * incremental.cc (Incremental_inputs::report_command_line): Filter
786 out --incremental-* options.
787
788 2009-05-29 Doug Kwan <dougkwan@google.com>
789
790 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
791 template class.
792 (class Target_arm): Update comment.
793 (Target_arm::Target_arm): Initialize new data members GOT_,
794 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
795 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
796 and Target_arm::rel_dyn_section.
797 Declare new_enum Target_arm::Got_type.
798 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
799 and DYNBSS_.
800 Update commments for member do_dynsym_value.
801 (Target_arm::got_size, Target_arm::plt_section,
802 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
803 new methods inside class defintion.
804 (Target_arm::got_section): Define new method.
805 (Target_arm::rel_dyn_section): Same.
806 (Output_data_plt_arm): New template class.
807 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
808 (Output_data_plt_arm:do_adjust_output_section): Define new method.
809 (Output_data_plt_arm::add_entry): Same.
810 (Output_data_plt_arm::first_plt_entry): Define new
811 static data member for PLT instruction template.
812 (Output_data_plt_arm::plt_entry): Same.
813 (Output_data_plt_arm::do_write): Define new method.
814 (Target_arm::make_plt_entry): Same.
815 (Target_arm::do_finalize_sections): Same.
816 (Target_arm::do_dynsym_value): Same.
817
818 2009-05-28 Doug Kwan <dougkwan@google.com>
819
820 * Makefile.am (TARGETSOURCES): Add arm.cc.
821 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
822 * Makefile.in: Regenerate.
823 * arm.cc: New file.
824 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
825
826 2009-05-26 Doug Kwan <dougkwan@google.com>
827
828 * options.cc (General_options::parse_exclude_libs). Fix a comment.
829 (General_options::check_excluded_libs): Strip off directories in
830 archive name before matching like GNU ld does.
831 * testsuite/Makefile.am (MOSTLYCLEANFILES,
832 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
833 (exclude_libs_test_LDFLAGS): Add linker option
834 -Wl,--exclude-libs,libexclude_libs_test_3
835 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
836 an explicit archive without using -l.
837 (alt/libexclude_libs_test_3.a): New make rule.
838 * testsuite/Makefile.in: Regenerate.
839 * testsuite/exclude_libs_test.c : Declare lib3_default().
840 (main): Call it.
841 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
842 * exclude_libs_test_3.c: New file.
843
844 2009-05-26 Nick Clifton <nickc@redhat.com>
845
846 * po/id.po: New Indonesian translation.
847 * po/gold.pot: Updated template file.
848
849 2009-05-22 Sriraman Tallam <tmsriram@google.com>
850
851 * testsuite/Makefile.am: Add -ffunction-sections to compile
852 gc_comdat_test files. Add -Wl,--gc-sections to build
853 gc_comdat_test.
854 * testsuite/Makefile.in: Regenerate.
855 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
856
857 2009-05-21 Sriraman Tallam <tmsriram@google.com>
858
859 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
860 kept comdat section was garbage collected.
861 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
862 * testsuite/Makefile.in: Regenerate.
863 * testsuite/gc_comdat_test.sh: New file.
864 * testsuite/gc_comdat_test_1.cc: New file.
865 * testsuite/gc_comdat_test_2.cc: New file.
866
867 2009-05-19 Doug Kwan <dougkwan@google.com>
868
869 * archive.cc (Archive::Archive): Move constructor from archive.h
870 to here. Initialize no_export_.
871 (Archive::get_elf_object_for_member): Set no_export flag of object.
872 * archive.h (Archive::Archive): Move constructor body to
873 archive.cc.
874 (Archive::no_export): New method.
875 (Archive::no_export_): New field.
876 * object.h (Object::Object): Initialize no_export_ to false.
877 (Object::no_export, Object::set_no_export): New methods.
878 (Object::no_export_): New field.
879 * options.cc (General_options::parse_exclude_libs): New method.
880 (General_options::check_excluded_libs) Same.
881 * options.h (exclude_libs): New option.
882 (General_options::check_excluded_libs): New method declaration.
883 (General_options::excluded_libs_): New field.
884 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
885 default or protected visibility if an object has no-export flag set.
886 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
887 (check_SCRIPTS): Add exclude_libs_test.sh.
888 (check_DATA): Add exclude_libs_test.syms.
889 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
890 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
891 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
892 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
893 (exclude_libs_test.syms, libexclude_libs_test_1.a,
894 libexclude_libs_test_2.a): New rules.
895 * testsuite/Makefile.in: Regenerate.
896 * testsuite/exclude_libs_test.c: New file.
897 * testsuite/exclude_libs_test.sh: Ditto.
898 * testsuite/exclude_libs_test_1.c: Ditto.
899 * testsuite/exclude_libs_test_2.c: Ditto.
900
901 2009-05-15 Ian Lance Taylor <iant@google.com>
902
903 * configure.ac: Check for declarations for cases where libiberty.h
904 checks HAVE_DECL_xxx.
905 * configure, config.in: Rebuild.
906
907 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
908
909 * gold.h (Incremental_argument_list): Remove (invalid) forward
910 declaration.
911 * incremental.cc (Incremental_inputs::report_achive): New method.
912 (Incremental_inputs::report_object): New method.
913 (Incremental_inputs::report_script): New method.
914 (Incremental_inputs::finalize_inputs): New method.
915 (Incremental_inputs::finalize): Call finalize_inputs().
916 (Incremental_inputs::sized_create_incremental_inputs_section_data):
917 Create inputs entries.
918 * incremental.h (Incremental_input_type): New enum.
919 (Incremental_inputs::Incremental_input): Initialize new fields.
920 (Incremental_inputs::report_inputs): New method.
921 (Incremental_inputs::report_achive): New method.
922 (Incremental_inputs::report_object): New method.
923 (Incremental_inputs::report_script): New method.
924 (Incremental_inputs::finalize_inputs): New method.
925 (Incremental_inputs::Input_info): New struct.
926 (Incremental_inputs::Input_info_map): New typedef.
927 (Incremental_inputs::lock_): New field.
928 (Incremental_inputs::Inputs_): New field.
929 (Incremental_inputs::Inputs_map): New field.
930 * main.cc (main): Call Incremental_input::report_inputs.
931 * options.h (Input_argument_list): Typedef moved from
932 Input_arguments.
933 (Input_file_group::Files): Remove, use ::Input_argument_list.
934 (Input_file_group::Input_argument_list): Remove, use
935 ::Input_argument_list.
936 * plugin.cc (Plugin_manager::add_input_file): Add error in
937 incremental build.
938 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
939 functions.
940 * script.cc (read_input_script): Call
941 Incremental_input::report_script.
942 * script.h (Script_info): New class.
943
944 2009-04-27 Ian Lance Taylor <iant@google.com>
945
946 * x86_64.cc (do_adjust_output_section): Set entsize to
947 plt_entry_size.
948
949 2009-04-23 Elliott Hughes <enh@google.com>
950
951 * output.cc (Output_file::close): After short writes, continue
952 writing from the correct offset in the buffer being written.
953
954 2009-04-23 Chris Demetriou <cgd@google.com>
955
956 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
957 * configure: Regenerate.
958 * config.in: Regenerate.
959 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
960 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
961
962 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
963
964 * incremental.cc (Incremental_inputs_header_data): Renamed from
965 Incremental_input_header_data.
966 (Incremental_inputs_header_data::data_size): New field.
967 (Incremental_inputs_header_data::put_input_file_count): Renamed
968 from input_file_count.
969 (Incremental_inputs_header_data::put_command_line_offset): Renamed
970 from command_line_offset.
971 (Incremental_inputs_header_data::put_reserved): Renamed from
972 put_reserved.
973 (Incremental_inputs_entry_data): Renamed from
974 Incremental_input_entry_data.
975 (Incremental_inputs_entry_data::data_size): New field.
976 (Incremental_inputs::report_command_line): New method.
977 (Incremental_inputs::finalize): New method.
978 (Incremental_inputs::create_incremental_inputs_data): New method.
979 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
980 * incremental.h: New file.
981 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
982 (Layout::finalize): Create incremental inputs section in
983 incremental builds.
984 (Layout::create_incremental_info_sections): New method.
985 * layout.h (Layout::incremental_inputs): New method.
986 (Layout::create_incremental_info_sections): New method.
987 (Layout::incremental_inputs_): New field.
988 * main.cc (main): Notify Incremental_input of the command line.
989
990 2009-04-01 Ian Lance Taylor <iant@google.com>
991 Mikolaj Zalewski <mikolajz@google.com>
992
993 * gold.h (reserve_unordered_map): Define, three versions, one for
994 each version of Unordered_map.
995 * layout.cc (Layout::Layout): Remove options parameter. Add
996 number_of_input_files parameter. Don't initialize options_.
997 Initialize number_of_input_files_ and resized_signatures_. Move
998 sections_are_attached_.
999 (Layout::layout_group): Reserve space for group_signatures_.
1000 (Layout::find_or_add_kept_section): Change name parameter to be a
1001 reference. Resize signatures_ map when it gets large enough.
1002 (Layout::layout_eh_frame): Use parameters->options() instead of
1003 this->options_.
1004 (Layout::make_output_section): Likewise.
1005 (Layout::attach_allocated_section_to_segment): Likewise.
1006 (Layout::finalize, Layout::create_executable_stack): Likewise.
1007 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
1008 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
1009 * layout.h (class Layout): Update declarations. Remove options_
1010 field. Add number_of_input_files_ and resized_signatures_
1011 fields. Move sections_are_attached_ field.
1012 * main.cc (main): Pass number of input files to Layout
1013 constructor. Don't pass options.
1014
1015 2009-03-30 Ian Lance Taylor <iant@google.com>
1016
1017 * ffsll.c (ffsll): Correct implementation.
1018
1019 2009-03-27 Ian Lance Taylor <iant@google.com>
1020
1021 * ffsll.c: New file.
1022 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
1023 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
1024 * ftruncate.c (ftruncate): Declare before definition.
1025 * mremap.c (mremap): Likewise.
1026 * pread.c (pread): Likewise.
1027 * configure, Makefile.in, config.in: Rebuild.
1028
1029 * mremap.c: New file.
1030 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
1031 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
1032 (mremap): Declare if HAVE_MREMAP is not defined.
1033 * configure, Makefile.in, config.in: Rebuild.
1034
1035 2009-03-27 Cary Coutant <ccoutant@google.com>
1036
1037 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
1038 position independent.
1039 * sparc.cc (Target_sparc::check_non_pic): Likewise.
1040 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
1041
1042 2009-03-24 Cary Coutant <ccoutant@google.com>
1043
1044 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
1045 an executable.
1046 (needs_dynamic_reloc): Likewise.
1047
1048 2009-03-24 Ian Lance Taylor <iant@google.com>
1049
1050 * yyscript.y (file_cmd): Recognize EXTERN.
1051 (extern_name_list, extern_name_list_body): New nonterminals.
1052 * script.cc (script_add_extern): Define.
1053 * script-c.h (script_add_extern): Declare.
1054
1055 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
1056
1057 * object.cc (is_elf_object): Define.
1058 * object.h (is_elf_object): Declare.
1059 * archive.cc (Archive::get_elf_object_for_member): Call
1060 is_elf_object.
1061 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
1062
1063 2009-03-24 Elliott Hughes <enh@google.com>
1064
1065 * output.cc (Output_file::map_anonymous): Define.
1066 (Output_file::map): Use map_anonymous. If the regular mmap fails,
1067 try an anonymous one. Report the size if the mmap fails.
1068 * output.h (class Output_file): Declare map_anonymous.
1069
1070 2009-03-24 Ian Lance Taylor <iant@google.com>
1071
1072 * target-select.cc (instantiate_target): Don't acquire the lock if
1073 the instantiated_target_ field has already been set.
1074
1075 2009-03-23 Ian Lance Taylor <iant@google.com>
1076
1077 * gold-threads.h (class Initialize_lock): Define.
1078 * gold-threads.cc (class Initialize_lock_once): Define.
1079 (initialize_lock_control): New static variable.
1080 (initialize_lock_pointer): New static variable.
1081 (initialize_lock_once): New static function.
1082 (Initialize_lock::Initialize_lock): Define.
1083 (Initialize_lock::initialize): Define.
1084 * target-select.h: Include "gold-threads.h".
1085 (class Target_selector): Add lock_ and initialize_lock_ fields.
1086 Don't define instantiate_target, just declare it.
1087 * target-select.cc (Target_selector::Target_selector): Initialize
1088 new fields.
1089 (Target_selector::instantiate_target): Define.
1090 * descriptors.h: Include "gold-threads.h".
1091 (class Descriptors): Add initialize_lock_ field.
1092 * descriptors.cc (Descriptors::Descriptors): Initialize new
1093 field.
1094 (Descriptors::open): Use initialize_lock_ field
1095 * errors.h (class Errors): Add initialize_lock_ field.
1096 * errors.cc (Errors::Errors): Initialize new field.
1097 (Errors::initialize_lock): Use initialize_lock_ field.
1098 * powerpc.cc (class Target_selector_powerpc): Remove
1099 instantiated_target_ field. In do_recognize call
1100 instantiate_target rather than do_instantiate_target. In
1101 do_instantiate_target just allocate a new target.
1102 * sparc.cc (class Target_selector_sparc): Likewise.
1103
1104 * freebsd.h: New file.
1105 * i386.cc: Include "freebsd.h".
1106 (Target_i386): Derive from Target_freebsd rather than
1107 Sized_target.
1108 (Target_selector_i386): Derive from Target_selector_freebsd rather
1109 than Target_selector.
1110 * x86_64.cc: Include "freebsd.h".
1111 (Target_x86_64): Derive from Target_freebsd rather than
1112 Sized_target.
1113 (Target_selector_x86_64): Derive from Target_selector_freebsd
1114 rather than Target_selector.
1115 * target.h (class Target): Add adjust_elf_header and
1116 do_adjust_elf_header.
1117 * output.cc (Output_file_header:: do_sized_write): Call target
1118 adjust_elf_header routine.
1119 * configure.tgt: Set targ_osabi.
1120 * configure.ac: Define GOLD_DEFAULT_OSABI.
1121 * parameters.cc (Parameters::default_target): Pass
1122 GOLD_DEFAULT_OSABI to select_target.
1123 * target-select.h (class Target_selector): Make instantiate_target
1124 protected rather than private.
1125 * Makefile.am (HFILES): Add freebsd.h.
1126 * configure, Makefile.in, config.in: Rebuild.
1127
1128 * merge.cc (do_add_input_section): Correct pend value. Change
1129 message about last entry not being null terminated from error to
1130 warning.
1131
1132 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
1133
1134 * incremental.cc: New file.
1135 * Makefile.am (CCFILES): Add incremental.cc.
1136 * Makefile.in: Rebuild.
1137
1138 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
1139
1140 * layout.cc (Layout::output_section_name): Preserve names
1141 of '.note.' sections.
1142
1143 2009-03-19 Ian Lance Taylor <iant@google.com>
1144
1145 * descriptors.cc (Descriptors::open): Check that the options are
1146 valid before using them.
1147
1148 2009-03-18 Ian Lance Taylor <iant@google.com>
1149
1150 * script-sections.h: Include <list>.
1151 (class Script_sections): Change Sections_elements from std::vector
1152 to std::list. Typedef public Elements_iterator. Add
1153 orphan_section_placement_, data_segment_align_start_, and
1154 saw_data_segment_align_ fields. Remove data_segment_align_index_
1155 field.
1156 * script-sections.cc (class Orphan_section_placement): New class.
1157 (class Sections_element): Add virtual functions is_relro and
1158 orphan_section_init. Remove virtual function place_orphan_here.
1159 (class Output_section_definition): Add is_relro and
1160 orphan_section_init. Remove place_orphan_here.
1161 (class Orphan_output_section): Likewise.
1162 (Script_sections::Script_sections): Update for field changes.
1163 (Script_sections::data_segment_align): Set saw_data_segment_align_
1164 and data_segment_align_start_, not data_segment_align_index.
1165 (Script_sections::data_segment_relro_end): Check
1166 saw_data_segment_align_. Use data_segment_align_start_ rather
1167 than data_segment_align_index_.
1168 (Script_sections::place_orphan): Rewrite to use
1169 Orphan_section_placement.
1170
1171 2009-03-17 Ian Lance Taylor <iant@google.com>
1172
1173 * archive.cc (Archive::add_symbols): Check for a version attached
1174 to the symbol name in the archive map.
1175 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
1176 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
1177 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
1178 (ver_test_11.a): New target.
1179 * testsuite/Makefile.in: Rebuild.
1180
1181 * configure.ac: Check for chsize and posix_fallocate. Replace
1182 ftruncate.
1183 * ftruncate.c: New file, from gnulib.
1184 * output.cc (posix_fallocate): Define dummy version if not
1185 HAVE_POSIX_FALLOCATE.
1186 (Output_file::map): Call posix_fallocate rather than lseek and
1187 write.
1188 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
1189 * configure, Makefile.in, config.in: Rebuild.
1190
1191 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
1192
1193 * layout.h (Layout::create_note): Add section_name parameter.
1194 * layout.cc (Layout::create_note): Likewise.
1195 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
1196
1197 2009-03-17 Ian Lance Taylor <iant@google.com>
1198
1199 * descriptors.cc: Include "options.h".
1200 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
1201 (Descriptors::open): Always use O_CLOEXEC when opening a new
1202 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
1203 then set FD_CLOEXEC.
1204
1205 * sparc.cc (class Target_sparc): Add has_got_section.
1206 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
1207 make sure we have a GOT section.
1208
1209 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
1210 (Target_sparc::Scan::local): Likewise.
1211 (Target_sparc::Scan::global): Likewise.
1212 (Target_sparc::Relocate::relocate): Likewise.
1213 (Target_sparc::Relocate::relocate_tls): Likewise.
1214
1215 * symtab.cc (Symbol_table::define_default_version): New function,
1216 broken out of add_from_object.
1217 (Symbol_table::add_from_object): Call define_default_version.
1218 (Symbol_table::define_special_symbol): Add resolve_oldsym
1219 parameter. Change all callers. If the version for a symbol comes
1220 from a version script, resolve it with the symbol with the same
1221 name with no version. Also add the symbol without a version if
1222 appropriate.
1223 (do_define_in_output_data): If resolving with oldsym, don't delete
1224 sym.
1225 (do_define_in_output_segment): Likewise.
1226 (do_define_as_constant): Likewise.
1227 * symtab.h (class Symbol_table): Update declarations.
1228
1229 2009-03-13 Ian Lance Taylor <iant@google.com>
1230
1231 * readsyms.cc (Read_symbols::incompatible_warning): New function.
1232 (Read_symbols::requeue): New function.
1233 (Read_symbols::do_read_symbols): If make_elf_object fails because
1234 the target type is not configured, and the file was searched for,
1235 issue a warning and retry with the next directory.
1236 (Add_symbols::run): If the file has an incompatible format, and
1237 it was searched for, requeue the Read_symbols task. On error,
1238 release the object.
1239 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
1240 dirindex parameter to constructor. Change all callers. Declare
1241 incompatible_warning and requeue.
1242 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
1243 input_argument_ and input_group_ fields. Add them to
1244 constructor. Change all callers.
1245 (class Read_script): Add dirindex_ field. Add it to constructor.
1246 Change all callers.
1247 * archive.cc (Archive::setup): Remove input_objects parameter.
1248 Change all callers.
1249 (Archive::get_file_and_offset): Likewise.
1250 (Archive::read_all_symbols): Likewise.
1251 (Archive::read_symbols): Likewise.
1252 (Archive::get_elf_object_for_member): Remove input_objects
1253 parameter. Add punconfigured parameter. Change all callers.
1254 (Archive::add_symbols): Change return type to bool. Check return
1255 value of include_member.
1256 (Archive::include_all_members): Likewise.
1257 (Archive::include_member): Change return type to bool. Return
1258 false if first included object has incompatible target. Set
1259 included_member_ field.
1260 (Add_archive_symbols::run): If add_symbols returns false, requeue
1261 Read_symbols task.
1262 * archive.h (class Archive): Add included_member_ field.
1263 Initialize it in constructor. Add input_file and searched_for
1264 methods. Update declarations.
1265 (class Add_archive_symbols): Add dirpath_, dirindex_, and
1266 input_argument_ fields. Add them to constructor. Change all
1267 callers.
1268 * script.cc: Include "target-select.h".
1269 (class Parser_closure): Add skip_on_incompatible_target_ and
1270 found_incompatible_target_ fields. Add
1271 skip_on_incompatible_target parameter to constructor. Change all
1272 callers. Add methods skip_on_incompatible_target,
1273 clear_skip_on_incompatible_target, found_incompatible_target, and
1274 set_found_incompatible_target.
1275 (read_input_script): Add dirindex parameter. Change all callers.
1276 If parser finds an incompatible target, requeue Read_symbols
1277 task.
1278 (script_set_symbol): Clear skip_on_incompatible_target in
1279 closure.
1280 (script_add_assertion, script_parse_option): Likewise.
1281 (script_start_sections, script_add_phdr): Likewise.
1282 (script_check_output_format): New function.
1283 * script.h (read_input_script): Update declaration.
1284 * script-c.h (script_check_output_format): Declare.
1285 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
1286 (ignore_cmd): Remove OUTPUT_FORMAT.
1287 * fileread.cc (Input_file::Input_file): Add explicit this.
1288 (Input_file::will_search_for): New function.
1289 (Input_file::open): Add pindex parameter. Change all callers.
1290 * fileread.h (class Input_file): Add input_file_argument method.
1291 Declare will_search_for. Update declarations.
1292 * object.cc (make_elf_object): Add punconfigured parameter.
1293 Change all callers.
1294 * object.h (class Object): Make input_file public. Add
1295 searched_for method.
1296 (make_elf_object): Update declaration.
1297 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
1298 restart search.
1299 * dirsearch.h (class Dirsearch): Update declaration.
1300 * options.h (class General_options): Add --warn-search-mismatch.
1301 * parameters.cc (Parameters::is_compatible_target): New function.
1302 * parameters.h (class Parameters): Declare is_compatible_target.
1303 * workqueue.cc (Workqueue::add_blocker): New function.
1304 * workqueue.h (class Workqueue): Declare add_blocker.
1305
1306 * fileread.cc (Input_file::open): Remove options parameter.
1307 Change all callers.
1308 (Input_file::open_binary): Likewise.
1309 * script.cc (read_input_script): Likewise.
1310 * readsyms.h (class Read_symbols): Remove options_ field. Remove
1311 options parameter from constructor. Change all callers.
1312 (class Read_script): Likewise.
1313 * fileread.h (class Input_file): Update declarations.
1314 * script.h (read_input_script): Update declaration.
1315
1316 2009-03-10 Nick Clifton <nickc@redhat.com>
1317
1318 * po/es.po: New Spanish translation.
1319
1320 2009-03-06 Cary Coutant <ccoutant@google.com>
1321
1322 * options.cc (parse_short_option): Keep dash_z from registering itself.
1323
1324 2009-03-03 Ian Lance Taylor <iant@google.com>
1325
1326 PR 9918
1327 * target-reloc.h (relocate_section): Pass output_section to
1328 relocate.
1329 * i386.cc (Target_i386::should_apply_static_reloc): Add
1330 output_section parameter. Change all callers.
1331 (Target_i386::Relocate::relocate): Add output_section parameter.
1332 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1333 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1334 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1335 * testsuite/two_file_shared.sh: New script.
1336 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
1337 (check_DATA): Add two_file_shared.dbg.
1338 (two_file_shared.dbg): New target.
1339 * testsuite/Makefile.in: Rebuild.
1340
1341 2009-03-01 Ian Lance Taylor <iant@google.com>
1342
1343 * configure.ac: Check for byteswap.h.
1344 * configure: Rebuild.
1345 * config.in: Rebuild.
1346
1347 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
1348
1349 * layout.cc (Layout::find_or_add_kept_section): New function.
1350 (Layout::add_comdat): Removed.
1351 * layout.h (struct Kept_section): Move out of class Layout.
1352 Remove trailing underscores from field names. Add group_sections
1353 field. Rename group_ field to is_group. Change all uses.
1354 (class Layout): Declare find_or_add_kept_section, not add_comdat.
1355 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
1356 comdat_groups_ field.
1357 (Sized_relobj::include_section_group): Use
1358 find_or_add_kept_section and Kept_section::group_sections.
1359 (Sized_relobj::include_linkonce_section): Likewise.
1360 * object.cc (class Sized_relobj): Don't define Comdat_group or
1361 Comdat_group_table. Remove find_comdat_group and
1362 add_comdat_group. Remove comdat_groups_ field.
1363 * plugin.cc (include_comdat_group): Use
1364 Layout::find_or_add_kept_section.
1365
1366 2009-02-28 Ian Lance Taylor <iant@google.com>
1367
1368 * README: --gc-sections and map files are now supported. Document
1369 some build requirements.
1370
1371 PR 6992
1372 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
1373 relocatable link set the value of the section symbol to zero.
1374 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
1375 relocatable link don't include the section address in the local
1376 symbol value.
1377
1378 2009-02-27 Ian Lance Taylor <iant@google.com>
1379
1380 PR 6811
1381 * options.h (class Search_directory): Add is_system_directory.
1382 (class General_options): Declare is_in_system_directory.
1383 * options.cc (get_relative_sysroot): Make static.
1384 (get_default_sysroot): Make static.
1385 (General_optoins::is_in_system_directory): New function.
1386 * fileread.cc (Input_file::is_in_system_directory): New function.
1387 * fileread.h (class Input_file): Declare is_in_system_directory.
1388 * object.h (class Object): Add is_in_system_directory.
1389 (class Input_objects): Remove system_library_directory_ field.
1390 * object.cc (Input_objects::add_object): Don't set
1391 system_library_directory_.
1392 (input_objects::found_in_system_library_directory): Remove.
1393 * symtab.cc (Symbol_table::write_globals): Remove input_objects
1394 parameter. Change all callers.
1395 (Symbol_table::sized_write_globals): Likewise.
1396 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
1397 Call Object::is_in_system_directory.
1398 * symtab.h (class Symbol_table): Update declarations.
1399
1400 PR 5990
1401 * descriptors.h (Open_descriptor): Add is_on_stack field.
1402 * descriptors.cc (Descriptors::open): If the descriptor is on the
1403 top of the stack, remove it. Initialize is_on_stack field.
1404 (Descriptors::release): Only add pod to stack if it is not on the
1405 stack already.
1406 (Descriptors::close_some_descriptor): Clear stack_next and
1407 is_on_stack fields.
1408
1409 PR 7091
1410 * output.cc (Output_section::find_starting_output_address): Rename
1411 from starting_output_address; add PADDR parameter; change return
1412 type.
1413 * output.h (class Output_section): Declare
1414 find_starting_output_address instead of starting_output_address.
1415 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
1416 section symbol for which we can't find a merge section.
1417
1418 PR 9836
1419 * symtab.cc (Symbol_table::add_from_object): If the visibility is
1420 hidden or internal, force the symbol to be local.
1421 * resolve.cc (Symbol::override_visibility): Define.
1422 (Symbol::override_base): Use override_visibility.
1423 (Symbol_table::resolve): Likewise.
1424 (Symbol::override_base_with_special): Likewise.
1425 (Symbol_table::override_with_special): If the visibility is hidden
1426 or internal, force the symbol to be local.
1427 * symtab.h (class Symbol): Add set_visibility and
1428 override_visibility.
1429 * testsuite/ver_test_1.sh: New file.
1430 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
1431 (check_DATA): Add ver_test_1.syms.
1432 (ver_test_1.syms): New target.
1433 * testsuite/Makefile.in: Rebuild.
1434
1435 2009-02-25 Cary Coutant <ccoutant@google.com>
1436
1437 * layout.cc (Layout::choose_output_section): Don't rename sections
1438 when using a linker script that has a SECTIONS clause.
1439 * Makefile.in: Regenerate.
1440
1441 * testsuite/Makefile.am (script_test_5.sh): New test case.
1442 * testsuite/Makefile.in: Regenerate.
1443 * testsuite/script_test_5.cc: New file.
1444 * testsuite/script_test_5.sh: New file.
1445 * testsuite/script_test_5.t: New file.
1446
1447 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
1448
1449 * archive.cc (Archive::include_member): Update calls to add_symbols.
1450 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
1451 the Layout argument.
1452 * dynobj.h (do_add_symbols): Add the Layout argument.
1453 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
1454 Layout argument.
1455 * object.h (Object::add_symbols): Add the Layout argument.
1456 (Object::do_add_symbols): Add the Layout argument.
1457 (Sized_relobj::do_add_symbols): Add the Layout argument.
1458 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
1459 Unify the two versions.
1460 (Add_plugin_symbols): Remove.
1461 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
1462 (Sized_pluginobj::do_add_symbols): Unify the two versions.
1463 (Add_plugin_symbols): Remove.
1464 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
1465 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
1466 (Add_symbols::run): Make it work with Pulginobj.
1467
1468 2009-02-06 Ian Lance Taylor <iant@google.com>
1469
1470 * object.cc (Sized_relobj::do_layout): Make info message start
1471 with lower case letter.
1472
1473 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
1474
1475 * binary.cc: Fix file comment.
1476
1477 * options.h (enum Incremental_disposition): Define.
1478 (class General_options): Add new options: --incremental,
1479 --incremental_changed, --incremental_unchanged,
1480 --incremental_unknown. Add incremental_disposition_ and
1481 implicit_incremental_ fields.
1482 (General_options::incremental_disposition): New function.
1483 (class Position_dependent_options): Add incremental_disposition
1484 option.
1485 (Position_dependent_options::copy_from_options): Set incremental
1486 dispositions.
1487 * options.cc (General_options::parse_incremental_changed): New
1488 function.
1489 (General_options::parse_incremental_unchanged): New function.
1490 (General_options::parse_incremental_unknown): New function.
1491 (General_options::General_options): Initialize new fields
1492 incremental_disposition_ and implicit_incremental_.
1493 (General_options::finalize): Check for uasge of --incremental-*
1494 without --incremental.
1495
1496 2009-02-06 Chris Demetriou <cgd@google.com>
1497
1498 * gold.h (gold_undefined_symbol): Change to take only a Symbol
1499 pointer and to report location as the file name associated with
1500 the symbol.
1501 (gold_undefined_symbol_at_location): New function to replace the
1502 old gold_undefined_symbol functionality.
1503 * target-reloc.h (relocate_section): Update to use
1504 gold_undefined_symbol_at_location.
1505 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
1506 Call gold_undefined_symbol function rather than gold_error.
1507 * errors.h (Errors::undefined_symbol): Take location as a
1508 string, rather than calculating it from a relocation.
1509 * errors.cc (Errors::fatal): Print "fatal error:" before the
1510 formatted message.
1511 (Errors::error, Errors::error_at_location): Print "error: "
1512 before the formatted message.
1513 (Errors::undefined_symbol): Take location as a string, rather
1514 than calculating it from a relocation.
1515 (gold_undefined_symbol_at_location): New function akin to
1516 old gold_undefined_symbol, calculates location from relocation.
1517 (gold_undefined_symbol): Change to take only a Symbol pointer
1518 and to report location as the file name associated with the symbol.
1519 * testsuite/debug_msg.sh: Update for changed error messages.
1520 * testsuite/undef_symbol.sh: Likewise.
1521
1522 2009-02-04 Duncan Sands <baldrick@free.fr>
1523
1524 PR 9812
1525 * reduced_debug_output.h
1526 (Output_reduced_debug_abbrev_section::failed): Use format for
1527 gold_warning.
1528 (Output_reduced_debug_info_section::faild): Likewise.
1529
1530 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
1531
1532 * script.cc (Lazy_demangler): New class.
1533 (Version_script_info::get_symbol_version_helper): Demangle a
1534 symbol only once.
1535
1536 2009-01-29 Cary Coutant <ccoutant@google.com>
1537
1538 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
1539 to __tls_get_addr.
1540 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1541
1542 2009-01-28 Ian Lance Taylor <iant@google.com>
1543
1544 * version.cc (version_string): Bump to 1.9.
1545
1546 * gold.h: Include <cstring> and <stdint.h>.
1547 * version.cc: Include <cstdio>.
1548 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
1549 warning.
1550 * reduced_debug_output.cc (insert_into_vector): Rename from
1551 Insert_into_vector; change all callers. Use Swap_unaligned to
1552 avoid aliasing issue; remove union since it is unnecessary.
1553
1554 2009-01-27 Sriraman Tallam <tmsriram@google.com>
1555
1556 * Makefile.am (CCFILES): Add gc.cc.
1557 (HFILES): Add gc.h.
1558 * Makefile.in: Regenerate.
1559 * gold.cc (Gc_runner): New class.
1560 (queue_initial_tasks): Call garbage collection related tasks
1561 when corresponding options are invoked.
1562 (queue_middle_gc_tasks): New function.
1563 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
1564 processed early before laying out sections during garbage collection.
1565 * gold.h (queue_middle_gc_tasks): New function.
1566 (is_prefix_of): Move from "layout.cc".
1567 * i386.cc (Target_i386::gc_process_relocs): New function.
1568 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
1569 * main.cc (main): Create object of class "Garbage_collection".
1570 * object.cc (Relobj::copy_symbols_data): New function.
1571 (Relobj::is_section_name_included): New function.
1572 (Sized_relobj::do_layout): Allow this function to be called twice
1573 during garbage collection and defer layout of section during the
1574 first call.
1575 * object.h (Relobj::get_symbols_data): New function.
1576 (Relobj::is_section_name_included): New function.
1577 (Relobj::copy_symbols_data): New function.
1578 (Relobj::set_symbols_data): New function.
1579 (Relobj::get_relocs_data): New function.
1580 (Relobj::set_relocs_data): New function.
1581 (Relobj::is_output_section_offset_invalid): New pure virtual function.
1582 (Relobj::gc_process_relocs): New function.
1583 (Relobj::do_gc_process_relocs): New pure virtual function.
1584 (Relobj::sd_): New data member.
1585 (Sized_relobj::is_output_section_offset_invalid): New function.
1586 (Sized_relobj::do_gc_process_relocs): New function.
1587 * options.h (General_options::gc_sections): Modify to not be a no-op.
1588 (General_options::print_gc_sections): New option.
1589 * plugin.cc (Plugin_finish::run): Remove function call to
1590 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
1591 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
1592 * reloc.cc (Read_relocs::run): Add task to process relocs and
1593 determine unreferenced sections when doing garbage collection.
1594 (Gc_process_relocs): New class.
1595 (Sized_relobj::do_gc_process_relocs): New function.
1596 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
1597 sections that are garbage collected.
1598 * reloc.h (Gc_process_relocs): New class.
1599 * sparc.cc (Target_sparc::gc_process_relocs): New function.
1600 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
1601 symbols whose corresponding sections are garbage collected.
1602 (Symbol_table::Symbol_table): Add new parameter for the garbage
1603 collection object.
1604 (Symbol_table::gc_mark_undef_symbols): New function.
1605 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1606 (Symbol_table::gc_mark_dyn_syms): New function.
1607 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
1608 as garbage.
1609 (Symbol_table::add_from_object): Likewise.
1610 (Symbol_table::add_from_relobj): When building shared objects, do not
1611 treat externally visible symbols as garbage.
1612 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
1613 table information for static and relocatable links.
1614 * symtab.h (Symbol_table::set_gc): New function.
1615 (Symbol_table::gc): New function.
1616 (Symbol_table::gc_mark_undef_symbols): New function.
1617 (Symbol_table::gc_mark_symbol_for_shlib): New function.
1618 (Symbol_table::gc_mark_dyn_syms): New function.
1619 (Symbol_table::gc_): New data member.
1620 * target.h (Sized_target::gc_process_relocs): New pure virtual
1621 function.
1622 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
1623 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
1624
1625 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
1626
1627 * options.h (General_options::gc_sections): Define as a no-op for now.
1628 (General_options::no_keep_memory): Ditto.
1629 (General_options::Bshareable): Define.
1630 * options.cc (General_options::finalize): Honor -Bshareable.
1631
1632 2009-01-20 Andreas Schwab <schwab@suse.de>
1633
1634 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
1635 read the value in the contents, since we don't use it. Use the
1636 template endianness when writing.
1637 (Relocate::relocate): Use it for R_PPC_REL16_HA.
1638
1639 2009-01-19 Andreas Schwab <schwab@suse.de>
1640
1641 * configure.tgt (powerpc64-*): Fix targ_obj.
1642
1643 2009-01-15 Ian Lance Taylor <iant@google.com>
1644
1645 * object.cc (Sized_relobj::write_local_symbols): Don't write out
1646 local symbols when stripping all symbols.
1647
1648 2009-01-14 Cary Coutant <ccoutant@google.com>
1649
1650 * output.cc (Output_reloc): Add explicit instantiations.
1651
1652 2009-01-14 Cary Coutant <ccoutant@google.com>
1653
1654 * archive.cc (Archive::get_elf_object_for_member): Remove call
1655 to File_read::claim_for_plugin.
1656 * descriptors.cc (Descriptors::open): Remove reference to
1657 is_claimed.
1658 (Descriptors::claim_for_plugin): Remove.
1659 * descriptors.h (Descriptors::claim_for_plugin): Remove.
1660 (Descriptors::is_claimed): Remove.
1661 (claim_descriptor_for_plugin): Remove.
1662 * fileread.cc (File_read::claim_for_plugin): Remove.
1663 * fileread.h (File_read::claim_for_plugin): Remove.
1664 (File_read::descriptor): Reopen descriptor if necessary.
1665 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
1666 (Plugin_manager::all_symbols_read): Add task parameter. Change
1667 all callers.
1668 (Plugin_manager::get_input_file): New function.
1669 (Plugin_manager::release_input_file): New function.
1670 (Pluginobj::Pluginobj): Add filesize parameter and initialize
1671 corresponding data member.
1672 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
1673 and pass to base constructor. Change all callers.
1674 (get_input_file, release_input_file): New functions.
1675 (make_sized_plugin_object): Add filesize parameter. Change all callers.
1676 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
1677 (Plugin_manager::all_symbols_read): Add task parameter.
1678 (Plugin_manager::get_input_file): New function.
1679 (Plugin_manager::release_input_file): New function.
1680 (Plugin_manager::task_): New data member.
1681 (Pluginobj::Pluginobj): Add filesize parameter.
1682 (Pluginobj::filename): New function.
1683 (Pluginobj::descriptor): New function.
1684 (Pluginobj::filesize): New function.
1685 (Pluginobj::filesize_): New data member.
1686 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
1687 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
1688 File_read::claim_for_plugin; use Object::unlock to unlock the file.
1689
1690 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
1691 with archive libraries.
1692 * testsuite/Makefile.in: Regenerate.
1693 * testsuite/plugin_test.c (struct sym_info): New type.
1694 (get_input_file, release_input_file): New static variables.
1695 (onload): Capture new transfer vector entries.
1696 (claim_file_hook): Stop reading at end of file according to filesize.
1697 Factor out parsing of readelf output into separate function.
1698 (all_symbols_read_hook): Exercise get_input_file and release_input_file
1699 APIs and get the source file name from the symbol table. Convert
1700 source file name to corresponding object file name. Print info
1701 message when adding new input files.
1702 (parse_readelf_line): New function.
1703 * testsuite/plugin_test_1.sh: Add checks for new info messages.
1704 * testsuite/plugin_test_2.sh: Likewise.
1705 * testsuite/plugin_test_3.sh: Likewise.
1706 * testsuite/plugin_test_4.sh: New test case.
1707
1708 2009-01-07 Ian Lance Taylor <iant@google.com>
1709
1710 * version.cc (version_string): Bump to 1.8.
1711
1712 2008-12-23 Cary Coutant <ccoutant@google.com>
1713
1714 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
1715 * plugin.cc (Plugin_manager::finish): Rename as
1716 layout_deferred_objects. Move cleanup to separate function.
1717 (Plugin_manager::cleanup): New function.
1718 (Plugin_finish::run): Call layout_deferred_objects and cleanup
1719 separately.
1720 * plugin.h (Plugin_manager::finish): Rename as
1721 layout_deferred_objects.
1722 (Plugin_manager::cleanup): New function.
1723 (Plugin_manager::cleanup_done): New field.
1724
1725 2008-12-23 Cary Coutant <ccoutant@google.com>
1726
1727 * plugin.cc (is_visible_from_outside): New function.
1728 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
1729 so we don't return "IR only" status for exported symbols or -r links.
1730
1731 * testsuite/Makefile.am (plugin_test_3): New test case.
1732 * testsuite/Makefile.in: Regenerate.
1733 * testsuite/plugin_test_3.sh: New file.
1734
1735 2008-12-22 Cary Coutant <ccoutant@google.com>
1736
1737 * object.cc (Sized_relobj::layout_section): New function.
1738 (Sized_relobj::do_layout): Defer layout of input sections until after
1739 plugin has provided replacement files.
1740 (Sized_relobj::do_layout_deferred_sections): New function.
1741 * object.h (Relobj::set_section_offset): Remove virtual keyword.
1742 (Relobj::layout_deferred_sections): New function.
1743 (Relobj::do_layout_deferred_sections): New function.
1744 (Sized_relobj::do_layout_deferred_sections): New function.
1745 (Sized_relobj::layout_section): New function.
1746 (Sized_relobj::Deferred_layout): New structure.
1747 (Sized_relobj::deferred_layout_): New field.
1748 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
1749 Change all callers. Layout deferred sections.
1750 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
1751 references.
1752 (Plugin_hook::run): Move code from do_plugin_hook inline.
1753 (Plugin_hook::do_plugin_hook): Remove.
1754 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
1755 (Plugin_manager::finish): Renamed, was cleanup.
1756 (Plugin_manager::should_defer_layout): New function.
1757 (Plugin_manager::add_deferred_layout_object): New function.
1758 (Plugin_manager::Deferred_layout_list): New type.
1759 (Plugin_manager::deferred_layout_objects_): New field.
1760 (Plugin_hook::do_plugin_hook): Remove.
1761
1762 2008-12-17 Ian Lance Taylor <iant@google.com>
1763
1764 * options.h (class General_options): Add --no case for
1765 --export-dynamic.
1766
1767 2008-12-16 Cary Coutant <ccoutant@google.com>
1768
1769 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
1770 vector.
1771 (Plugin_manager::claim_file): Create plugin object even if
1772 plugin did not call the add_symbols callback.
1773 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
1774 asking for more symbols than were added.
1775 * testsuite/Makefile.am (plugin_test_1): Add test case with
1776 no global symbols.
1777 (empty.syms): New target.
1778 * testsuite/Makefile.in: Regenerate.
1779 * testsuite/plugin_test.c (claim_file_hook): Add new debug
1780 message. Don't call add_symbols if no globals.
1781 (all_symbols_read_hook): Don't provide replacement for empty
1782 claimed file.
1783
1784 2008-12-12 Ian Lance Taylor <iant@google.com>
1785
1786 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
1787 r_type == 0 for a local symbol with r_sym == 0.
1788 (scan_relocatable_relocs): Pass r_sym to
1789 local_non_section_strategy.
1790 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
1791 r_sym parameter.
1792
1793 * configure.ac: Update test for TLS descriptors: they are
1794 supported as of glibc 2.9.
1795 * configure: Rebuild.
1796
1797 2008-12-11 Ian Lance Taylor <iant@google.com>
1798
1799 PR 7091
1800 * target-reloc.h (Default_scan_relocatable_relocs): For each
1801 function, map r_type == 0 to RELOC_DISCARD.
1802
1803 2008-12-10 Cary Coutant <ccoutant@google.com>
1804
1805 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
1806 object to override a kept COMDAT group from a plugin object.
1807
1808 2008-12-09 Ian Lance Taylor <iant@google.com>
1809
1810 PR 7088
1811 * yyscript.y (file_cmd): Handle INPUT.
1812
1813 * testsuite/initpri1.c: Change all declarations to be full
1814 prototypes by adding void, to avoid compiler warnings.
1815
1816 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
1817
1818 * options.cc (General_options::parse_plugin_opt): New.
1819 (General_options::add_plugin): The argument now is just the filename.
1820 (General_options::add_plugin_option): New.
1821 * options.h (plugin_opt): New.
1822 (add_plugin): Change argument name.
1823 (add_plugin_option): New.
1824 * plugin.cc (Plugin::load): Don't parse the plugin option.
1825 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
1826 (Plugin::add_option): New.
1827 (Plugin::args_): Change type.
1828 (Plugin::filename_): New.
1829 (Plugin_manager::add_plugin_option): New.
1830 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
1831 * testsuite/Makefile.in: Regenerate.
1832
1833 2008-12-05 Cary Coutant <ccoutant@google.com>
1834
1835 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
1836 Handle --strip-lto-sections option.
1837 * options.h (strip_lto_sections): New option.
1838
1839 2008-12-01 Cary Coutant <ccoutant@google.com>
1840
1841 * plugin.cc (ld_plugin_message): Change format parameter to const.
1842 Fix mismatch between new[] and delete.
1843
1844 2008-11-14 Cary Coutant <ccoutant@google.com>
1845
1846 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
1847 instead of -1U.
1848
1849 2008-11-05 Craig Silverstein <csilvers@google.com>
1850
1851 * options.cc (General_options::parse_dynamic_list): New function.
1852 * options.h (General_options): New flags dynamic_list,
1853 dynamic_list_data, dynamic_list_cpp_new, and
1854 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
1855 (General_options::in_dynamic_list): New function.
1856 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
1857 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
1858 (Lex::can_continue_name): Likewise.
1859 (yylex): Likewise.
1860 (read_script_file): New parameter script_options.
1861 (read_dynamic_list): New function.
1862 (Script_options::define_dynamic_list): New function.
1863 (dynamic_list_keyword_parsecodes): New variable.
1864 (dynamic_list_keywords): New variable.
1865 * script.h (Script_options::define_dynamic_list): New function
1866 prototype.
1867 (read_dynamic_list): New function prototype.
1868 * symtab.cc (strprefix): New macro.
1869 (Symbol::should_add_dynsym_entry): Support dynamic_list,
1870 dynamic_list_data, dynamic_list_cpp_new, and
1871 dynamic_list_cpp_typeinfo.
1872 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
1873 (dynamic_list_expr): New rule.
1874 (dynamic_list_nodes): Likewise.
1875 (dynamic_list_node): Likewise.
1876 * testsuite/Makefile.am (dynamic_list): New test.
1877 * testsuite/Makefile.in: Regenerated.
1878 * testsuite/dynamic_list.t: New file.
1879 * testsuite/dynamic_list.sh: New file.
1880
1881 2008-11-05 Craig Silverstein <csilvers@google.com>
1882
1883 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
1884 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
1885 (t11_last): Likewise.
1886 * testsuite/ver_test_6.c (main): Likewise.
1887
1888 2008-10-07 Cary Coutant <ccoutant@google.com>
1889
1890 * options.c (General_options::finalize): Add check for -static and
1891 -shared.
1892 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
1893 is not empty.
1894
1895 2008-10-02 Cary Coutant <ccoutant@google.com>
1896
1897 * plugin.cc (make_sized_plugin_object): Fix conditional
1898 compilation to work when not all targets are enabled.
1899
1900 2008-09-29 Cary Coutant <ccoutant@google.com>
1901
1902 * archive.cc (Archive::get_file_and_offset): Use filename instead
1903 of name to get library path.
1904 (Archive::include_member): Unlock external member of a thin archive.
1905
1906 * testsuite/Makefile.am (TEST_AR): New variable.
1907 (thin_archive_test_1): New test.
1908 (thin_archive_test_2): New test.
1909 * testsuite/Makefile.in: Regenerate.
1910 * testsuite/thin_archive_main.cc: New file.
1911 * testsuite/thin_archive_test_1.cc: New file.
1912 * testsuite/thin_archive_test_2.cc: New file.
1913 * testsuite/thin_archive_test_3.cc: New file.
1914 * testsuite/thin_archive_test_4.cc: New file.
1915
1916 2008-09-29 Cary Coutant <ccoutant@google.com>
1917
1918 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
1919 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
1920 instead of -1U.
1921 (Sized_relobj::do_finalize_local_symbols): Likewise.
1922 (Sized_relobj::map_to_kept_section): Likewise.
1923 * object.h (Sized_relobj::invalid_address): New constant.
1924 (Sized_relobj::do_output_section_offset): Check for invalid_address
1925 and return -1ULL.
1926 * output.cc (Output_reloc::local_section_offset): Use constant
1927 invalid_address instead of -1U.
1928 (Output_reloc::get_address): Likewise.
1929 (Output_section::output_address): Change -1U to -1ULL.
1930 * output.h (Output_reloc::invalid_address): New constant.
1931 * reloc.cc (Sized_relobj::write_sections): Use constant
1932 invalid_address instead of -1U.
1933 (Sized_relobj::relocate_sections): Likewise.
1934 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
1935 values for merge sections.
1936 * target-reloc.h (relocate_for_relocatable): Use constant
1937 invalid_address instead of -1U.
1938
1939 2008-09-19 Cary Coutant <ccoutant@google.com>
1940
1941 Add plugin functionality for link-time optimization (LTO).
1942 * configure.ac (plugins): Add --enable-plugins option.
1943 * configure: Regenerate.
1944 * config.in: Regenerate.
1945 * Makefile.am (LIBDL): New variable.
1946 (CCFILES): Add plugin.cc.
1947 (HFILES): Add plugin.h.
1948 (ldadd_var): Add LIBDL.
1949 * Makefile.in: Regenerate.
1950
1951 * archive.cc: Include "plugin.h".
1952 (Archive::setup): Don't preread archive symbols when using a plugin.
1953 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
1954 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
1955 files.
1956 (Archive::include_member): Add symbols from plugin objects.
1957 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
1958 * descriptors.cc (Descriptors::open): Check for file descriptors
1959 abandoned by plugins.
1960 (Descriptors::claim_for_plugin): New function.
1961 * descriptors.h (Descriptors::claim_for_plugin): New function.
1962 (Open_descriptor::is_claimed): New field.
1963 (claim_descriptor_for_plugin): New function.
1964 * fileread.cc (File_read::claim_for_plugin): New function.
1965 * fileread.h (File_read::claim_for_plugin): New function.
1966 (File_read::descriptor): New function.
1967 * gold.cc: Include "plugin.h".
1968 (queue_initial_tasks): Add task to call plugin hooks for generating
1969 new object files.
1970 * main.cc: Include "plugin.h".
1971 (main): Load plugin libraries.
1972 * object.h (Pluginobj): Declare.
1973 (Object::pluginobj): New function.
1974 (Object::do_pluginobj): New function.
1975 (Object::set_target): New function.
1976 * options.cc: Include "plugin.h".
1977 (General_options::parse_plugin): New function.
1978 (General_options::General_options): Initialize plugins_ field.
1979 (General_options::add_plugin): New function.
1980 * options.h (Plugin_manager): Declare.
1981 (General_options): Add --plugin option.
1982 (General_options::has_plugins): New function.
1983 (General_options::plugins): New function.
1984 (General_options::add_plugin): New function.
1985 (General_options::plugins_): New field.
1986 * plugin.cc: New file.
1987 * plugin.h: New file.
1988 * readsyms.cc: Include "plugin.h".
1989 (Read_symbols::do_read_symbols): Check for archive before checking
1990 for ELF file. Call plugin hooks to claim files.
1991 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
1992 from a real object file; force override when processing replacement
1993 files.
1994 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
1995 (Symbol::init_base_object): Likewise.
1996 (Symbol::init_base_output_data): Likewise.
1997 (Symbol::init_base_output_segment): Likewise.
1998 (Symbol::init_base_constant): Likewise.
1999 (Symbol::init_base_undefined): Likewise.
2000 (Symbol::output_section): Assert that object is not a plugin.
2001 (Symbol_table::add_from_pluginobj): New function.
2002 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
2003 undefined.
2004 (Symbol_table::sized_write_globals): Likewise.
2005 (Symbol_table::add_from_pluginobj): Instantiate template.
2006 * symtab.h (Sized_pluginobj): Declare.
2007 (Symbol::in_real_elf): New function.
2008 (Symbol::set_in_real_elf): New function.
2009 (Symbol::in_real_elf_): New field.
2010 (Symbol_table::add_from_pluginobj): New function.
2011
2012 * testsuite/Makefile.am (AM_CFLAGS): New variable.
2013 (LIBDL): New variable.
2014 (LDADD): Add LIBDL.
2015 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
2016 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
2017 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
2018 (MOSTLYCLEANFILES): Likewise.
2019 * testsuite/Makefile.in: Regenerate.
2020 * testsuite/plugin_test.c: New file.
2021 * testsuite/plugin_test_1.sh: New file.
2022 * testsuite/plugin_test_2.sh: New file.
2023
2024 2008-09-16 Ian Lance Taylor <iant@google.com>
2025
2026 * target-reloc.h (relocate_section): Check whether a symbol is
2027 defined by the ABI before reporting an undefined symbol error.
2028 * target.h (Target::is_defined_by_abi): Make parameter const.
2029 (Target::do_is_defined_by_abi): Likewise.
2030 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
2031 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
2032 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
2033 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
2034 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
2035 * testsuite/Makefile.in: Rebuild.
2036
2037 * fileread.cc (make_view): Add casts to avoid warning.
2038
2039 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2040
2041 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
2042 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2043
2044 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2045
2046 * options.h (General_options::output_is_executable): New.
2047 (General_options::output_is_pie): New.
2048 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
2049 for shared libraries.
2050 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2051
2052 2008-09-11 Chris Demetriou <cgd@google.com>
2053
2054 * options.h (origin): New -z option.
2055 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
2056 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
2057 in DT_FLAGS_1.
2058
2059 2008-09-05 Cary Coutant <ccoutant@google.com>
2060
2061 * fileread.cc (File_read::make_view): Add check for attempt to map
2062 beyond end of file.
2063
2064 2008-09-05 Cary Coutant <ccoutant@google.com>
2065
2066 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
2067 explicit instantiations.
2068
2069 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
2070
2071 PR gold/6858
2072 * options.cc (General_options::finalize): Allow undefined symbols
2073 in shlibs if linking -shared.
2074
2075 PR gold/6859
2076 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
2077 symbols as not needing a dynsym entry.
2078
2079 2008-08-20 Craig Silverstein <csilvers@google.com>
2080
2081 * fileread.cc (File_read::open): Do not lock the file unless it
2082 was successfully opened.
2083
2084 2008-08-14 Cary Coutant <ccoutant@google.com>
2085
2086 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
2087 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
2088 * testsuite/tls_test.cc (struct int128): 128-bit struct
2089 for testing TLS relocs with non-zero addend.
2090 (v12): New TLS variable.
2091 (t12): New test.
2092 (t_last): Add check for v12.
2093 * testsuite/tls_test.h (t12): New function.
2094 * testsuite/tls_test_main.cc (thread_routine): Call new test.
2095
2096 2008-08-13 Ian Lance Taylor <iant@google.com>
2097
2098 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
2099 set tls_segment_ or relro_segment_.
2100 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
2101 when appropriate.
2102 * output.h (Output_section::clear_is_relro): New function.
2103 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
2104 sections specially even when output_data_ is empty.
2105 (Output_segment::maximum_alignment): When first section is relro,
2106 only force alignment for PT_LOAD segments.
2107 * script.cc (script_data_segment_align): New function.
2108 (script_data_segment_relro_end): New function.
2109 * script-c.h (script_data_segment_align): Declare.
2110 (script_data_segment_relro_end): Declare.
2111 * script-sections.h (class Script_sections): Declare
2112 data_segment_align and data_segment_relro_end. Add fields
2113 segment_align_index_ and saw_relro_end_.
2114 * script-sections.cc (class Sections_element): Add set_is_relro
2115 virtual function. Add new bool* parameter to place_orphan_here.
2116 Add get_output_section virtual function.
2117 (class Output_section_definition): Add set_is_relro. Add new
2118 bool* parameter to place_orphan_here. Add get_output_section.
2119 Add is_relro_ field.
2120 (Output_section_definition::Output_section_definition): Initialize
2121 evaluated_address_, evaluated_load_address, evaluated_addralign_,
2122 and is_relro_ fields.
2123 (Output_section_definition::place_orphan_here): Add is_relro
2124 parameter.
2125 (Output_section_definition::set_section_addresses): Set relro for
2126 output section.
2127 (Output_section_definition::alternate_constraint): Likewise.
2128 (class Orphan_output_section): Add new bool* parameter to
2129 place_orphan_here. Add get_output_section.
2130 (Orphan_output_section::place_orphan_here): Add is_relro
2131 parameter.
2132 (Script_sections::Script_sections): Initialize
2133 data_segment_align_index_ and saw_relro_end_.
2134 (Script_sections::data_segment_align): New function.
2135 (Script_sections::data_segment_relro_end): New function.
2136 (Script_sections::place_orphan): Set or clear is_relro.
2137 (Script_sections::set_section_addresses): Force alignment of first
2138 TLS section.
2139 * yyscript.y (exp): Call script_data_segment_align and
2140 script_data_segment_relro_end.
2141 * testsuite/relro_script_test.t: New file.
2142 * testsuite/relro_test.cc (using_script): Declare.
2143 (t1, t2): Test using_script.
2144 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
2145 (relro_script_test_SOURCES): Define.
2146 (relro_script_test_DEPENDENCIES): Define.
2147 (relro_script_test_LDFLAGS): Define.
2148 (relro_script_test_LDADD): Define.
2149 (relro_script_test.so): New target.
2150 * testsuite/Makefile.in: Rebuild.
2151
2152 2008-08-06 Cary Coutant <ccoutant@google.com>
2153
2154 * archive.cc (Archive::total_archives, Archive::total_members)
2155 (Archive::total_members_loaded): New variables.
2156 (Archive::setup): Add parameter. Add option to preread
2157 archive symbols.
2158 (Archive::read_armap): Add counter.
2159 (Archive::get_file_and_offset): New function.
2160 (Archive::get_elf_object_for_member): New function.
2161 (Archive::read_all_symbols): New function.
2162 (Archive::read_symbols): New function.
2163 (Archive::add_symbols): Add counters.
2164 (Archive::include_all_members): Use armap to find members if it's
2165 already built.
2166 (Archive::include_member): Skip reading symbols if already read.
2167 Factored code into Archive::get_file_and_offset and
2168 Archive::get_elf_object_for_member. Changed call to
2169 Mapfile::report_include_archive_member.
2170 (Archive::print_stats): New function.
2171 * archive.h: Declare Object and Read_symbols_data classes.
2172 (Archive::Archive): Add initializers for new members.
2173 (Archive::setup): Add parameter.
2174 (Archive::print_stats): New function.
2175 (Archive::total_archives, Archive::total_members)
2176 (Archive::total_members_loaded): New variables.
2177 (Archive::get_file_and_offset): New function.
2178 (Archive::get_elf_object_for_member): New function.
2179 (Archive::read_all_symbols): New function.
2180 (Archive::read_symbols): New function.
2181 (Archive::Archive_member): New class.
2182 (Archive::members_): New member.
2183 (Archive::num_members_): New member.
2184 * main.cc: Include archive.h.
2185 (main): Call Archive::print_stats.
2186 * mapfile.cc (Mapfile::report_include_archive_member): Delete
2187 archive parameter; member_name is now the fully-decorated name.
2188 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
2189 * options.h: (General_options): Add --preread-archive-symbols option.
2190 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
2191 Archive::setup.
2192
2193 2008-08-04 Ian Lance Taylor <iant@google.com>
2194
2195 * symtab.h (Symbol::use_plt_offset): New function.
2196 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
2197 * powerpc.cc (Relocate::relocate): Likewise.
2198 * sparc.cc (Relocate::relocate): Likewise.
2199 * x86_64.cc (Relocate::relocate): Likewise.
2200 * testsuite/weak_plt.sh: New test.
2201 * testsuite/weak_plt_main.cc: New test.
2202 * testsuite/weak_plt_shared.cc: New test.
2203 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
2204 (check_PROGRAMS): Add weak_plt.
2205 (check_DATA): Add weak_plt_shared.so.
2206 (weak_plt_main_pic.o, weak_plt): New targets.
2207 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
2208 * testsuite/Makefile.in: Rebuild.
2209
2210 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
2211 gcctestdir/ld.
2212 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
2213 * testsuite/Makefile.in: Rebuild.
2214
2215 2008-08-04 Alan Modra <amodra@bigpond.net.au>
2216
2217 * Makefile.am (POTFILES.in): Set LC_ALL=C.
2218 * Makefile.in: Regenerate.
2219 * po/POTFILES.in: Regenerate.
2220
2221 2008-07-29 Ian Lance Taylor <iant@google.com>
2222
2223 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
2224 symbols before other symbols.
2225 * testsuite/script_test_2.cc (test_addr): Declare.
2226 (test_addr_alias): Declare.
2227 (main): Check that test_addr and test_addr_alias have the right
2228 values.
2229 * testsuite/script_test_2.t: Define test_addr_alias and
2230 test_addr.
2231
2232 2008-07-24 Ian Lance Taylor <iant@google.com>
2233
2234 PR 5990
2235 * descriptors.cc: New file.
2236 * descriptors.h: New file.
2237 * gold-threads.h (class Hold_optional_lock): New class.
2238 * fileread.cc: Include "descriptors.h".
2239 (File_read::~File_read): Release descriptor rather than closing
2240 it.
2241 (File_read::open) [file]: Call open_descriptor rather than open.
2242 Set is_descriptor_opened_.
2243 (File_read::open) [memory]: Assert that descriptor is not open.
2244 (File_read::reopen_descriptor): New function.
2245 (File_read::release): Release descriptor.
2246 (File_read::do_read): Make non-const. Reopen descriptor.
2247 (File_read::read): Make non-const.
2248 (File_read::make_view): Reopen descriptor.
2249 (File_read::do_readv): Likewise.
2250 * fileread.h (class File_read): Add is_descriptor_opened_ field.
2251 Update declarations.
2252 * layout.cc: Include "descriptors.h".
2253 (Layout::create_build_id): Use open_descriptor rather than open.
2254 * output.cc: Include "descriptors.h".
2255 (Output_file::open): Use open_descriptor rather than open.
2256 * archive.cc (Archive::const_iterator): Change Archive to be
2257 non-const.
2258 (Archive::begin, Archive::end): Make non-const.
2259 (Archive::count_members): Likewise.
2260 * archive.h (class Archive): Update declarations.
2261 * object.h (Object::read): Make non-const.
2262 * Makefile.am (CCFILES): Add descriptors.cc.
2263 (HFILES): Add descriptors.h.
2264 * Makefile.in: Rebuild.
2265
2266 PR 6716
2267 * gold.h: Always include <clocale>. Add Solaris workarounds
2268 following code in binutils/sysdep.h.
2269
2270 PR 6048
2271 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
2272 this->eh_frame_hdr_ is NULL before using it.
2273
2274 * dynobj.cc (Versions::Versions): Update comment.
2275
2276 * dynobj.cc (Versions::Versions): If there is an soname, use it as
2277 the base version name.
2278
2279 * stringpool.cc (Stringpool_template::add_with_length): Set key to
2280 array size plus one.
2281 (Stringpool_template::set_string_offsets): Subtract one from key
2282 before using it as an array index.
2283 (Stringpool_template::get_offset_with_length): Likewise.
2284 (Stringpool_template::write_to_buffer): Likewise.
2285 * stringpool.h (Stringpool_template::get_offset_from_key):
2286 Likewise.
2287
2288 2008-07-23 Ian Lance Taylor <iant@google.com>
2289
2290 PR 6658
2291 * object.h (Merged_symbol_value::value): Do our best to handle a
2292 negative addend.
2293
2294 PR 6647
2295 * script.cc (Version_script_info::get_versions): Don't add empty
2296 version tag to return value.
2297 (Version_script_info::get_symbol_version_helper): Change return
2298 type to bool. Add pversion parameter. Change all callers.
2299 (script_register_vers_node): Don't require a non-NULL tag.
2300 * script.h (class Version_script_info): Update declarations.
2301 (Version_script_info::get_symbol_version): Change return type to
2302 bool. Add version parameter. Change all callers.
2303 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
2304 handling. Handle an empty version from a version script.
2305 (Symbol_table::define_special_symbol): Likewise.
2306 * testsuite/ver_test_10.script: New file.
2307 * testsuite/ver_test_10.sh: New file.
2308 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
2309 (check_DATA): Add ver_test_10.syms.
2310 (ver_test_10.syms, ver_test_10.so): New target.
2311 * testsuite/Makefile.in: Rebuild.
2312
2313 2008-07-23 Simon Baldwin <simonb@google.com>
2314
2315 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
2316 to zero for undefined symbols from dynamic libraries.
2317
2318 2008-07-23 Ian Lance Taylor <iant@google.com>
2319
2320 * symtab.cc (Symbol_table::resolve): Remove version parameter.
2321 Change all callers.
2322 * symtab.h (class Symbol_table): Update declaration.
2323 * testsuite/ver_test_9.cc: New file.
2324 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
2325 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
2326 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
2327 (ver_test_9.so, ver_test_9.o): New targets.
2328 * testsuite/Makefile.in: Rebuild.
2329
2330 2008-07-22 Ian Lance Taylor <iant@google.com>
2331
2332 * options.h (class General_options): Define --check-sections.
2333 * layout.cc (Layout::set_segment_offsets): Handle
2334 --check-sections.
2335
2336 * options.h (class General_options): Define -n/--nmagic and
2337 -N/--omagic.
2338 * options.cc (General_options::finalize): For -n/--nmagic or
2339 -N/--omagic, set -static.
2340 * layout.cc (Layout::attach_allocated_section_to_segment): If
2341 -N/--omagic, don't put read-only and read-write sections in
2342 different segments.
2343 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
2344 finding a read-only segment.
2345 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
2346 don't set the minimum segment alignment to the common page size,
2347 and don't set the file offset to the address modulo the page size.
2348 * script-sections.cc (Script_sections::create_segments): If
2349 -n/--omagic, don't put read-only and read-write sections in
2350 different segments.
2351
2352 * cref.cc: New file.
2353 * cref.h: New file.
2354 * options.h (class General_options): Add --print-symbol-counts.
2355 * main.cc (main): Issue defined symbol report if requested.
2356 * archive.cc (Archive::interpret_header): Make into a const member
2357 function.
2358 (Archive::add_symbols): Call Input_objects::archive_start and
2359 archive_stop.
2360 (Archive::const_iterator): Define new class.
2361 (Archive::begin, Archive::end): New functions.
2362 (Archive::include_all_members): Rewrite to use iterator.
2363 (Archive::count_members): New function.
2364 * archive.h (class Archive): Update declarations.
2365 (Archive::filename): New function.
2366 * object.cc: Include "cref.h".
2367 (Sized_relobj::Sized_relobj): Initialize defined_count_.
2368 (Sized_relobj::do_get_global_symbol_counts): New function.
2369 (Input_objects::add_object): Add object to cross-referencer.
2370 (Input_objects::archive_start): New function.
2371 (Input_objects::archive_stop): New function.
2372 (Input_objects::print_symbol_counts): New function.
2373 * object.h: Declare Cref and Archive.
2374 (Object::get_global_symbol_counts): New function.
2375 (Object::do_get_global_symbol_counts): New pure virtual function.
2376 (class Sized_relobj): Add defined_count_ field. Update
2377 declarations.
2378 (class Input_objects): Add cref_ field. Update constructor.
2379 Update declarations.
2380 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
2381 defined_count_.
2382 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
2383 symbol counts.
2384 (Sized_dynobj::do_get_global_symbol_counts): New function.
2385 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
2386 defined_count_. Update declarations. Define Symbols typedef.
2387 * symtab.cc (Symbol_table::add_from_relobj): Add defined
2388 parameter. Change all callers.
2389 (Symbol_table::add_from_dynobj): Add sympointers and defined
2390 parameters. Change all callers.
2391 * symtab.h (class Symbol_table): Update declarations.
2392 * Makefile.am (CCFILES): Add cref.cc.
2393 (HFILES): Add cref.h.
2394 * Makefile.in: Rebuild.
2395
2396 2008-07-22 Simon Baldwin <simonb@google.com>
2397
2398 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
2399 to zero when writing undefined symbols.
2400
2401 2008-07-22 Ian Lance Taylor <iant@google.com>
2402
2403 * output.cc (Output_section::add_input_section): Don't try to
2404 merge empty merge sections.
2405
2406 2008-07-21 Craig Silverstein <csilvers@google.com>
2407
2408 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2409 Include symbol version in error message.
2410
2411 2008-07-20 Chris Demetriou <cgd@google.com>
2412
2413 * configure.ac (gold_cv_c_random_seed): New configured variable.
2414 (RANDOM_SEED_CFLAGS): New substituted variable.
2415 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
2416 * configure: Rebuild.
2417 * Makefile.in: Likewise.
2418 * testsuite/Makefile.in: Likewise.
2419
2420 2008-07-18 Ian Lance Taylor <iant@google.com>
2421
2422 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
2423 where we see NAME/NULL and NAME/VERSION as separate symbols.
2424 * testsuite/ver_test_main.cc (main): Call t4.
2425 (t4, t4_2a): Define.
2426 * testsuite/ver_test_2.cc (t4_2): Define.
2427 * testsuite/ver_test_2.script: Put t4_2a in VER2.
2428 * testsuite/ver_test_4.cc (t4_2a): Define.
2429 * testsuite/ver_test_4.script: Put t4_2a in VER2.
2430 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
2431
2432 2008-07-17 Ian Lance Taylor <iant@google.com>
2433
2434 * dynobj.cc (Versions::add_def): If we give an error about a
2435 missing version, go ahead and create the version anyhow.
2436
2437 2008-07-10 Ian Lance Taylor <iant@google.com>
2438
2439 Handle output sections with more than 0x7fffffff bytes.
2440 * object.h (class Relobj): Change map_to_output_ to
2441 output_sections_, and just keep a section pointer. Change all
2442 uses. Move comdat group support to Sized_relobj.
2443 (Relobj::is_section_specially_mapped): Remove.
2444 (Relobj::output_section): Remove poff parameter. Change all
2445 callers.
2446 (Relobj::output_section_offset): New function.
2447 (Relobj::set_section_offset): Rewrite.
2448 (Relobj::map_to_output): Remove.
2449 (Relobj::output_sections): New function.
2450 (Relobj::do_output_section_offset): New pure virtual function.
2451 (Relobj::do_set_section_offset): Likewise.
2452 (class Sized_relobj): Add section_offsets_ field. Add comdat
2453 group support from Relobj. Update declarations.
2454 (Sized_relobj::get_output_section_offset): New function.
2455 (Sized_relobj::do_output_section_offset): New function.
2456 (Sized_relobj::do_set_section_offset): New function.
2457 * object.cc (Relobj::output_section_address): Remove.
2458 (Sized_relobj::Sized_relobj): Initialize new fields.
2459 (Sized_relobj::include_section_group): Cast find_kept_object to
2460 Sized_relobj.
2461 (Sized_relobj::include_linkonce_section): Likewise.
2462 (Sized_relobj::do_layout): Use separate arrays for output section
2463 and output offset.
2464 (Sized_relobj::do_count_local_symbols): Change map_to_output to
2465 output_sections.
2466 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
2467 output_sections and section_offsets.
2468 (Sized_relobj::write_local_symbols): Likewise.
2469 (map_to_kept_section): Compute output address directly.
2470 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
2471 output_sections and section_offsets.
2472 (Sized_relobj::write_sections): Likewise.
2473 (Sized_relobj::relocate_sections): Likewise.
2474 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
2475 * output.h (class Output_reloc): Update declarations. Change
2476 u2_.relobj to Sized_relobj*.
2477 (class Output_data_reloc): Change add functions to use
2478 Sized_relobj*.
2479 * output.cc (Output_reloc::Output_reloc): Change relobj to
2480 Sized_relobj*.
2481 (Output_reloc::local_section_offset): Change return type to
2482 Elf_Addr. Use get_output_section_offset.
2483 (Output_reloc::get_address): Likewise.
2484 (Output_section::is_input_address_mapped): Don't call
2485 is_section_specially_mapped.
2486 (Output_section::output_offset): Likewise.
2487 (Output_section::output_address): Likewise.
2488 (Output_section::starting_output_address): Likewise.
2489 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
2490 parameter to Sized_relobj*.
2491 (Copy_relocs::need_copy_reloc): Likewise.
2492 (Copy_relocs::save): Likewise.
2493 * copy-relocs.h (class Copy_relocs): Update declarations.
2494 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
2495 Sized_relobj*. Change relobj_ field to Sized_relobj*.
2496 * target-reloc.h (relocate_for_relocatable): Change
2497 offset_in_output_section type to Elf_Addr. Change code that uses
2498 it as well.
2499 * layout.cc (Layout::layout): Always set *off.
2500 * mapfile.cc (Mapfile::print_input_section): Use
2501 output_section_offset.
2502 * i386.cc (Target_i386::copy_reloc): Change object parameter to
2503 Sized_relobj*.
2504 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
2505 * sparc.cc (Target_sparc::copy_reloc): Likewise.
2506 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
2507
2508 2008-07-03 Ian Lance Taylor <iant@google.com>
2509
2510 * layout.cc (Layout::include_section): Do not discard unrecognized
2511 SHT_STRTAB sections.
2512
2513 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
2514
2515 * script.cc (Lex::can_continue_name): Make '?' allowable in
2516 version-script names.
2517 * testsuite/version_script.map: Change glob pattern to use '?'
2518
2519 2008-06-30 Manish Singh <yosh@gimp.org>
2520
2521 PR 6585
2522 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
2523 Correct typo.
2524
2525 2008-06-30 Ian Lance Taylor <iant@google.com>
2526
2527 PR 6660
2528 PR 6682
2529 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
2530 versions]: Don't try to read the value in the contents, since we
2531 don't use it. Use the template endianness when writing.
2532
2533 2008-06-25 Cary Coutant <ccoutant@google.com>
2534
2535 * fileread.cc (File_read::make_view): Assert on zero-length view.
2536 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
2537 symbol table when there are no symbols to read.
2538
2539 2008-06-23 Craig Silverstein <csilvers@google.com>
2540
2541 * version.cc (version_string): Bump to 1.7
2542
2543 2008-06-18 Craig Silverstein <csilvers@google.com>
2544
2545 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
2546 constant 0xFFFF to type Valtype.
2547 (Powerpc_relocate_functions::rel16_ha): Likewise.
2548
2549 2008-06-17 Ian Lance Taylor <iant@google.com>
2550
2551 * output.h (Output_section::Input_section): Initialize p2align_ to
2552 zero for Output_section_data constructors.
2553 (Output_section::Input_section::addralign): If not an input
2554 section, return the alignment of the Output_section_data.
2555 * testsuite/copy_test.cc: New file.
2556 * testsuite/copy_test_1.cc: New file.
2557 * testsuite/copy_test_2.cc: New file.
2558 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
2559 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
2560 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
2561 (copy_test_1_pic.o, copy_test_1.so): New targets.
2562 (copy_test_2_pic.o, copy_test_2.so): New targets.
2563 * testsuite/Makefile.in: Rebuild.
2564
2565 * script-sections.cc (Script_sections::place_orphan): Initialize
2566 local variable exact.
2567
2568 2008-06-13 David Edelsohn <edelsohn@gnu.org>
2569
2570 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
2571
2572 2008-06-12 David Edelsohn <edelsohn@gnu.org>
2573 David S. Miller <davem@davemloft.net>
2574
2575 * powerpc.cc: New file.
2576 * Makefile.am (TARGETSOURCES): Add powerpc.cc
2577 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
2578 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
2579 * Makefile.in: Rebuild.
2580
2581 2008-06-09 Ian Lance Taylor <iant@google.com>
2582
2583 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
2584 <exception>.
2585 (throwing, orig_terminate): New static variables.
2586 (terminate_handler): New static function.
2587 (t2): Set terminate handler.
2588
2589 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
2590
2591 PR 6584
2592 * binary.cc (Binary_to_elf::sized_convert): Fix .data
2593 alignment.
2594
2595 2008-05-30 Cary Coutant <ccoutant@google.com>
2596
2597 * archive.cc (Archive::include_all_members) Correct to step
2598 over symbol table and extended name table in thin archives.
2599
2600 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
2601
2602 PR 6407
2603 * target-reloc.h (relocate_for_relocatable): Fix new_offset
2604 calculation.
2605
2606 2008-05-28 Caleb Howe <cshowe@google.com>
2607
2608 * reduced_debug_output.cc: New file.
2609 * reduced_debug_output.h: New file.
2610 * options.h (class General_options): Add --strip-debug-non-line.
2611 * options.cc (General_options::finalize): Add strip_debug_non_line
2612 to the strip heirarchy.
2613 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
2614 fields.
2615 * layout.cc: Include "reduced_debug_output.h".
2616 (Layout::Layout): Initialize new fields.
2617 (line_only_debug_sections): New static array.
2618 (is_lines_only_debug_sections): New static inline function.
2619 (Layout::include_section): Handle --strip-debug-non-line.
2620 (Layout::make_output_section): If --strip-debug-non-line, build
2621 new output sections for .debug_abbrev and .debug_info.
2622 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
2623 gold. Warn about possible overflow.
2624 (read_signed_LEB_128): Likewise.
2625 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
2626 (read_signed_LEB_128): Declare.
2627 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
2628 (HFILES): Add reduced_debug_output.h.
2629 * Makefile.in: Rebuild.
2630
2631 2008-05-21 Ian Lance Taylor <iant@google.com>
2632
2633 * mapfile.cc: New file.
2634 * mapfile.h: New file.
2635 * options.h (class General_options): Add -M/--print-map and -Map.
2636 * options.cc (General_options::finalize): Make -M equivalent to
2637 -Map -.
2638 * main.cc: Include <cstdio> and "mapfile.h".
2639 (main): Open mapfile if requested.
2640 * gold.cc (class Middle_runner): Add mapfile_ field. Update
2641 constructor. Change caller.
2642 (queue_initial_tasks): Add mapfile parameter. Change caller.
2643 (queue_middle_tasks): Likewise.
2644 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
2645 declarations.
2646 * archive.cc: Include "mapfile.h".
2647 (Archive::add_symbols): Add mapfile parameter. Change all
2648 callers. Pass mapfile, symbol, and reason to include_member.
2649 (Archive::include_all_members): Add mapfile parameter. Change all
2650 callers.
2651 (Archive::include_member): Add mapfile, sym, and why parameters.
2652 Change all callers. Report inclusion to map file.
2653 * archive.h: Include "fileread.h".
2654 (class Archive): Update declarations.
2655 (Archive::file): New const method.
2656 (class Add_archive_symbols): Add mapfile_ field. Update
2657 constructor. Change all callers.
2658 * readsyms.h (class Read_symbols): Likewise.
2659 (class Finish_group): Likewise.
2660 (class Read_script): Likewise.
2661 * common.cc: Include "mapfile.h".
2662 (Symbol_table::allocate_commons): Add mapfile parameter. Change
2663 all callers.
2664 (Symbol_table::do_allocate_commons): Likewise.
2665 (Symbol_table::do_allocate_commons_list): Likewise. Report common
2666 symbol allocation to mapfile.
2667 * common.h (class Allocate_commons_task): Add mapfile_ field.
2668 Update constructor. Change all callers.
2669 * symtab.h (class Symbol_table): Update declarations.
2670 * layout.cc: Include "mapfile.h".
2671 (Layout_task_runner::run): Print information to mapfile.
2672 (Layout::create_gold_note): Change Output_data_fixed_space to
2673 Output_data_zero_fill.
2674 (Layout::create_build_id): Likewise.
2675 (Layout::print_to_mapfile): New function.
2676 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
2677 constructor. Change caller.
2678 (class Layout): Declare print_to_mapfile.
2679 * output.cc (Output_section::Input_section::print_to_mapfile): New
2680 function.
2681 (Output_section::add_input_section): If producing a map, always
2682 add to input_sections_ list.
2683 (Output_section::do_print_to_mapfile): New function.
2684 (Output_segment::print_sections_to_mapfile): New function.
2685 (Output_segment::print_section_list_to_mapfile): New function.
2686 * output.h: Include "mapfile.h".
2687 (Output_data::print_to_mapfile): New function.
2688 (Output_data::do_print_to_mapfile): New virtual function.
2689 (Output_segment_headers::do_print_to_mapfile): New function.
2690 (Output_file_header::do_print_to_mapfile): New function.
2691 (Output_data_const::do_print_to_mapfile): New function.
2692 (class Output_data_const_buffer): Add map_name_ field. Update
2693 constructor. Change all callers. Add do_print_to_mapfile
2694 function.
2695 (class Output_data_fixed_space): Likewise.
2696 (class Output_data_space): Likewise.
2697 (class Output_data_zero_fill): New class.
2698 (Output_data_strtab::do_print_to_mapfile): New function.
2699 (Output_data_reloc_base::do_print_to_mapfile): New function.
2700 (Output_relocatable_relocs::do_print_to_mapfile): New function.
2701 (Output_data_group::do_print_to_mapfile): New function.
2702 (Output_data_got::do_print_to_mapfile): New function.
2703 (Output_data_dynamic::do_print_to_mapfile): New function.
2704 (Output_symtab_xindex::do_print_to_mapfile): New function.
2705 (class Output_section): Declare do_print_to_mapflie. Declare
2706 print_to_mapfile in Input_section.
2707 (class Output_segment): Declare new functions.
2708 * object.h (Sized_relobj::symbol_count): New function.
2709 * script-sections.cc
2710 (Output_section_element_dot_assignment::set_section_addresses):
2711 Change Output_data_fixed_space to Output_data_zero_fill.
2712 (Output_data_expression::do_print_to_mapfile): New function.
2713 * script.cc (read_input_script): Add mapfile parameter. Change
2714 all callers.
2715 * script.h (read_input_script): Update declaration.
2716 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
2717 (Eh_frame::do_print_to_mapfile): New function.
2718 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
2719 (Output_merge_string::do_print_to_mapfile): New function.
2720 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
2721 function.
2722 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
2723 function.
2724 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
2725 function.
2726 * Makefile.am (CCFILES): Add mapfile.cc.
2727 (HFILES): Add mapfile.h.
2728 * Makefile.in: Rebuild.
2729
2730 2008-05-19 Ian Lance Taylor <iant@google.com>
2731
2732 * options.h (class General_options): Add -z relro.
2733 * layout.cc (Layout::Layout): Initialize relro_segment_.
2734 (Layout::add_output_section_data): Return the output section.
2735 (Layout::make_output_section): Rcognize relro sections and mark
2736 them appropriately.
2737 (Layout::attach_allocated_section_to_segment): Put relro sections
2738 in a PT_GNU_RELRO segment.
2739 (Layout::create_initial_dynamic_sections): Mark the .dynamic
2740 section as relro.
2741 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
2742 PT_TLS segments.
2743 (Layout::linkonce_mapping): Map d.rel.ro.local to
2744 .data.rel.ro.local.
2745 (Layout::output_section_name): Us .data.rel.ro.local for any
2746 section which begins with that.
2747 * layout.h (class Layout): Update add_output_section_data
2748 declaration. Add relro_segment_ field.
2749 * output.cc (Output_section::Output_section): Initialize is_relro_
2750 and is_relro_local_ fields.
2751 (Output_segment::add_output_section): Group relro sections.
2752 (Output_segment::is_first_section_relro): New function.
2753 (Output_segment::maximum_alignment): If there is a relro section,
2754 align the segment to the common page size.
2755 (Output_segment::set_section_addresses): Track whether we are
2756 looking at relro sections. If the last section is a relro
2757 section, align to the common page size.
2758 (Output_segment::set_section_list_addresses): Add in_relro
2759 parameter. Change all callers. Align to the page size when
2760 moving from relro to non-relro section.
2761 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
2762 segment.
2763 * output.h (class Output_section): Add is_relro_ and
2764 is_relro_local_ fields.
2765 (Output_section::is_relro): New function.
2766 (Output_section::set_is_relro): New function.
2767 (Output_section::is_relro_local): New function.
2768 (Output_section::set_is_relro_local): New function.
2769 (class Output_segment): Update declarations.
2770 * i386.cc (Target_i386::got_section): Mark .got section as relro.
2771 * sparc.cc (Target_sparc::got_section): Likewise.
2772 * x86_64.cc (Target_x86_64::got_section): Likewise.
2773 * testsuite/relro_test_main.cc: New file.
2774 * testsuite/relro_test.cc: New file.
2775 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
2776 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
2777 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
2778 (relro_test.so, relro_test_pic.o): New targets.
2779 * testsuite/Makefile.in: Rebuild.
2780
2781 2008-05-16 Ian Lance Taylor <iant@google.com>
2782
2783 * output.cc (Output_segment::add_output_section): Remove front
2784 parameter.
2785 * output.h (class Output_segment): Remove
2786 add_initial_output_section and overloaded add_output_section.
2787 Update declaration of remaining add_output_section.
2788 * layout.cc (Layout::create_interp): Call add_output_section
2789 rather than add_initial_output_section.
2790 (Layout::finish_dynamic_section): Likewise.
2791
2792 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
2793 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
2794 know the dynamic type.
2795 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
2796 field. Initialize it in constructor.
2797 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
2798 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
2799 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
2800 reloc.
2801
2802 * output.cc (Output_reloc::get_address): Change return type to
2803 Elf_Addr.
2804 * output.h (class Output_reloc): Update get_address declaration.
2805 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
2806 for section addresses.
2807
2808 2008-05-09 Ian Lance Taylor <iant@google.com>
2809
2810 PR 6493
2811 * gold.cc (gold_nomem): Use return value of write.
2812
2813 2008-05-08 Ian Lance Taylor <iant@google.com>
2814
2815 * symtab.c (Symbol::init_base_output_data): Add version
2816 parameter. Change all callers.
2817 (Symbol::init_base_output_segment): Likewise.
2818 (Symbol::init_base_constant): Likewise.
2819 (Symbol::init_base_undefined): Likewise.
2820 (Sized_symbol::init_output_data): Likewise.
2821 (Sized_symbol::init_output_segment): Likewise.
2822 (Sized_symbol::init_constant): Likewise.
2823 (Sized_symbol::init_undefined): Likewise.
2824 (Symbol_table::do_define_in_output_data): If the new symbol has a
2825 version, mark it as the default.
2826 (Symbol_table::do_define_in_output_segment): Likewise.
2827 (Symbol_table::do_define_as_constant): Likewise.
2828 * symtab.h (class Symbol): Update declarations.
2829 (class Sized_symbol): Likewise.
2830 * resolve.cc (Symbol::override_version): New function.
2831 (Symbol::override_base): Call override_version.
2832 (Symbol::override_base_with_special): Likewise.
2833 * testsuite/ver_script_8.script: New file.
2834 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
2835 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
2836 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
2837 (ver_test_8_1.so, ver_test_8_2.so): New targets.
2838
2839 2008-05-06 Ian Lance Taylor <iant@google.com>
2840
2841 PR 6049
2842 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
2843 functions.
2844 (class General_options): Remove existing --undefined, and add
2845 --no-undefined instead. Add new --undefined as synonym for -u.
2846 * archive.cc (Archive::add_symbols): Check whether symbol was
2847 named with -u.
2848 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
2849 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
2850 all uses. Add IS_UNDEFINED. Update declarations to split
2851 different versions of init_base. Declare init_base_undefined.
2852 (Symbol::is_defined): Handle IS_UNDEFINED.
2853 (Symbol::is_undefined): Likewise.
2854 (Symbol::is_weak_undefined): Call is_undefined.
2855 (Symbol::is_absolute): Handle IS_CONSTANT.
2856 (class Sized_symbol): Update declarations to split different
2857 versions of init. Declare init_undefined.
2858 (class Symbol_table): Declare new functions.
2859 * symtab.cc (Symbol::init_base_object): Rename from init_base.
2860 Change all callers.
2861 (Symbol::init_base_output_data): Likewise.
2862 (Symbol::init_base_output_segment): Likewise.
2863 (Symbol::init_base_constant): Likewise.
2864 (Symbol::init_base_undefined): New function.
2865 (Sized_symbol::init_object): Rename from init. Change all
2866 callers.
2867 (Sized_symbol::init_output_data): Likewise.
2868 (Sized_symbol::init_output_segment): Likewise.
2869 (Sized_symbol::init_constant): Likewise.
2870 (Sized_symbol::init_undefined): New function.
2871 (Symbol_table::add_undefined_symbols_from_command_line): New
2872 function.
2873 (Symbol_table::do_add_undefined_symbols_from_command_line): New
2874 function.
2875 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
2876 (Symbol::output_section): Likewise.
2877 (Symbol::set_output_section): Likewise.
2878 (Symbol_table::sized_finalize_symbol): Likewise.
2879 (Symbol_table::sized_write_globals): Likewise.
2880 * resolve.cc (Symbol_table::should_override): Likewise.
2881 (Symbol::override_base_with_special): Likewise.
2882
2883 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
2884 symbol, change it to have default visibility.
2885 * testsuite/protected_1.cc: New file.
2886 * testsuite/protected_2.cc: New file.
2887 * testsuite/protected_3.cc: New file.
2888 * testsuite/protected_main_1.cc: New file.
2889 * testsuite/protected_main_2.cc: New file.
2890 * testsuite/protected_main_3.cc: New file.
2891 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
2892 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
2893 (protected_1_LDFLAGS, protected_1_LDADD): Define.
2894 (protected_1.so): New target.
2895 (protected_1_pic.o, protected_2_pic.o): New targets.
2896 (protected_3_pic.o): New target.
2897 (check_PROGRAMS): Add protected_2.
2898 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
2899 (protected_2_LDFLAGS, protected_2_LDADD): Define.
2900 * testsuite/Makefile.in: Rebuild.
2901
2902 * options.h (DEFINE_var): Add set_user_set_##varname__.
2903 (DEFINE_bool_alias): New macro.
2904 (class General_options): Define -Bstatic using DEFINE_bool_alias
2905 rather than DEFINE_special. Add --undefined as an alias for -z
2906 defs.
2907 * options.cc (General_options::parse_Bstatic): Remove.
2908
2909 * options.h (class General_options): Add --fatal-warnings.
2910 * main.cc (main): Implement --fatal-warnings.
2911 * errors.h (Errors::warning_count): New function.
2912
2913 * options.h (class General_options): Add -Bsymbolic-functions.
2914 * symtab.h (Symbol::is_preemptible): Check for
2915 -Bsymbolic-functions.
2916
2917 2008-05-05 Ian Lance Taylor <iant@google.com>
2918
2919 * options.h (DEFINE_bool): For DASH_Z, create the negative option
2920 as noVARNAME rather than no-VARNAME.
2921 (class General_options): Add option -z combreloc.
2922 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
2923 get_address.
2924 (Output_reloc::sort_before) [SHT_REL]: New function.
2925 (Output_reloc::sort_before) [SHT_RELA]: New function.
2926 (class Output_data_reloc_base): Add sort_relocs_ field. Define
2927 Sort_relocs_comparison.
2928 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
2929 parameter. Change all callers.
2930 (Output_data_reloc::Output_data_reloc) [both versions]: Add
2931 sort_relocs parameter. Change all callers.
2932 * output.cc (Output_reloc::get_address): New function, broken out
2933 of write_rel.
2934 (Output_reloc::write_rel): Call it.
2935 (Output_reloc::compare): New function.
2936 (Output_data_reloc_base::do_write): Optionally sort relocs.
2937
2938 * configure.ac: If targ_extra_obj is set, link it in.
2939 * configure.tgt: Initialize all variables.
2940 (x86_64*): Set targ_extra_obj and targ_extra_size.
2941 * configure: Rebuild.
2942
2943 * object.cc (Sized_relobj::include_section_group): Adjust section
2944 indexes read from group data. Build vector to pass to
2945 layout_group.
2946 * layout.cc (Layout::layout_group): Add flags and shndxes
2947 parameters. Remove contents parameter. Change caller. Update
2948 explicit instantiations.
2949 * layout.h (class Layout): Update layout_group declaration.
2950 * output.cc (Output_data_group::Output_data_group): Add flags and
2951 input_shndxes parameters. Remove contents parameter. Change
2952 caller.
2953 (Output_data_group::do_write): Change input_sections_ to
2954 input_shndxes_.
2955 * output.h (class Output_data_group): Update constructor
2956 declaration. Rename input_sections_ to input_shndxes_.
2957 * testsuite/many_sections_test.cc: Add template.
2958
2959 2008-04-30 Cary Coutant <ccoutant@google.com>
2960
2961 * target-reloc.h (relocate_section): Fix dead-pointer bug.
2962
2963 * layout.cc (Layout::include_section): Refactored check for debug
2964 info section.
2965 (Layout::add_comdat): Add new parameters. Change type
2966 of signature parameter. Add object and shndx to signatures table.
2967 (Layout::find_kept_object): New function.
2968 * layout.h: Include <cstring>.
2969 (Layout::is_debug_info_section): New function.
2970 (Layout::add_comdat): Add new parameters.
2971 (Layout::find_kept_object): New function.
2972 (Layout::Kept_section): New struct.
2973 (Layout::Signatures): Change type of map range.
2974 * object.cc (Relobj::output_section_address): New function.
2975 (Sized_relobj::include_section_group): Add new parameters. Change
2976 calls to Layout::add_comdat. Change to build table of kept comdat
2977 groups and table mapping discarded sections to kept sections.
2978 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
2979 (Sized_relobj::do_layout): Change calls to include_section_group and
2980 include_linkonce_section.
2981 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
2982 value to zero when section is discarded.
2983 (Sized_relobj::map_to_kept_section): New function.
2984 * object.h (Relobj::output_section_address): New function.
2985 (Relobj::Comdat_group): New type.
2986 (Relobj::find_comdat_group): New function.
2987 (Relobj::Comdat_group_table): New type.
2988 (Relobj::Kept_comdat_section): New type.
2989 (Relobj::Kept_comdat_section_table): New type.
2990 (Relobj::add_comdat_group): New function.
2991 (Relobj::set_kept_comdat_section): New function.
2992 (Relobj::get_kept_comdat_section): New function.
2993 (Relobj::comdat_groups_): New field.
2994 (Relobj::kept_comdat_sections_): New field.
2995 (Symbol_value::input_value): Update comment.
2996 (Sized_relobj::map_to_kept_section) New function.
2997 (Sized_relobj::include_linkonce_section): Add new parameter.
2998 * target-reloc.h (Comdat_behavior): New type.
2999 (get_comdat_behavior): New function.
3000 (relocate_section): Add code to map a discarded section to the
3001 corresponding kept section when applying a relocation.
3002
3003 2008-04-30 Craig Silverstein <csilvers@google.com>
3004
3005 * dwarf_reader.cc (next_generation_count): New static var.
3006 (Addr2line_cache_entry): New struct.
3007 (addr2line_cache): New static var.
3008 (Dwarf_line_info::one_addr2line): Added caching.
3009 (Dwarf_line_info::clear_addr2line_cache): New function.
3010 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
3011 cache-size parameter.
3012 (Dwarf_line_info::one_addr2line_cache): New function.
3013 * symtab.cc (Symbol_table::detect_odr_violations): Pass
3014 new cache-size argument to one_addr2line(), and clear cache.
3015
3016 2008-04-28 Cary Coutant <ccoutant@google.com>
3017
3018 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
3019 R_386_PC8 relocations.
3020
3021 2008-04-23 Ian Lance Taylor <iant@google.com>
3022
3023 * object.cc (Sized_relobj::include_section_group): Check for
3024 invalid section group.
3025
3026 * object.cc (make_elf_object): Correct test for 64-bit ELF file
3027 header size.
3028
3029 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
3030 than read for file header.
3031 * archive.cc (Archive::include_member): Likewise.
3032
3033 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
3034
3035 * aclocal.m4: Regenerate.
3036 * configure: Regenerate.
3037
3038 2008-04-19 Ian Lance Taylor <iant@google.com>
3039
3040 * version.cc (version_string): Bump to 1.6.
3041
3042 * testsuite/Makefile.am (many_sections_r_test): New target.
3043 (many_sections_r_test_SOURCES): Remove.
3044 (many_sections_r_test_DEPENDENCIES): Remove.
3045 (many_sections_r_test_LDFLAGS): Remove.
3046 (many_sections_r_test_LDADD): Remove.
3047
3048 * object.cc (Sized_relobj::do_add_symbols): Always pass
3049 local_symbol_count_ to add_from_relobj.
3050
3051 * testsuite/Makefile.am (many_sections_check.h): Only check one in
3052 every thousand variables.
3053 * testsuite/Makefile.in: Rebuild.
3054
3055 * object.cc (Xindex::initialize_symtab_xindex): New function.
3056 (Xindex::read_symtab_xindex): New function.
3057 (Xindex::sym_xindex_to_shndx): New function.
3058 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
3059 available.
3060 (Sized_relobj::do_initialize_xindex): New function.
3061 (Sized_relobj::do_read_symbols): Adjust section links.
3062 (Sized_relobj::symbol_section_and_value): Add is_ordinary
3063 parameter. Change all callers.
3064 (Sized_relobj::include_section_group): Adjust section links and
3065 symbol section indexes.
3066 (Sized_relobj::do_layout): Adjust section links.
3067 (Sized_relobj::do_count_local_symbols): Adjust section links and
3068 symbol section indexes.
3069 (Sized_relobj::do_finalize_local_symbols): Distinguish between
3070 ordinary and special symbols.
3071 (Sized_relobj::write_local_symbols): Add symtab_xindex and
3072 dynsym_xindex parameters. Change all callers. Adjust section
3073 links. Use SHN_XINDEX when needed.
3074 (Sized_relobj::get_symbol_location_info): Adjust section links.
3075 Don't get fooled by special symbols.
3076 * object.h (class Xindex): Define.
3077 (class Object): Add xindex_ parameter. Declare virtual functoin
3078 do_initialize_xindex.
3079 (Object::adjust_sym_shndx): New function.
3080 (Object::set_xindex): New protected function.
3081 (class Symbol_value): Add is_ordinary_shndx_ field.
3082 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
3083 (Symbol_value::value): Assert ordinary section.
3084 (Symbol_value::initialize_input_to_output_map): Likewise.
3085 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
3086 Change all callers.
3087 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
3088 all callers.
3089 (class Sized_relobj): Update declarations.
3090 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
3091 parameter. Change all callers.
3092 (Sized_relobj::adjust_shndx): New function.
3093 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
3094 field.
3095 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
3096 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
3097 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
3098 (Sized_dynobj::read_dynsym_section): Adjust section links.
3099 (Sized_dynobj::read_dynamic): Likewise.
3100 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
3101 section links.
3102 (Sized_dynobj::do_initialize_xindex): New function.
3103 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
3104 do_initialize_xindex.
3105 (Sized_dynobj::adjust_shndx): New function.
3106 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
3107 dynsym_xindex_ fields.
3108 (Layout::finalize): Add a call to set_section_indexes before
3109 creating the symtab sections.
3110 (Layout::set_section_indexes): Don't do anything if the section
3111 already has a section index.
3112 (Layout::create_symtab_sections): Add shnum parameter. Change
3113 caller. Create .symtab_shndx section if needed.
3114 (Layout::create_shdrs): Add shstrtab_section parameter. Change
3115 caller.
3116 (Layout::allocated_output_section_count): New function.
3117 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
3118 needed.
3119 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
3120 fields. Update declarations.
3121 (Layout::symtab_xindex): New function.
3122 (Layout::dynsym_xindex): New function.
3123 (class Write_symbols_task): Add layout_ field.
3124 (Write_symbols_task::Write_symbols_task): Add layout parameter.
3125 Change caller.
3126 * output.cc (Output_section_headers::Output_section_headers): Add
3127 shstrtab_section parameter. Change all callers.
3128 (Output_section_headers::do_sized_write): Store overflow values
3129 for section count and section string table section index in
3130 section header zero.
3131 (Output_file_header::do_sized_write): Check for overflow of
3132 section count and section string table section index.
3133 (Output_symtab_xindex::do_write): New function.
3134 (Output_symtab_xindex::endian_do_write): New function.
3135 * output.h (class Output_section_headers): Add shstrtab_section_.
3136 Update declarations.
3137 (class Output_symtab_xindex): Define.
3138 (Output_section::has_out_shndx): New function.
3139 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
3140 field.
3141 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
3142 Change all callers.
3143 (Sized_symbol::init): Likewise.
3144 (Symbol::output_section): Check for ordinary symbol.
3145 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
3146 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
3147 callers.
3148 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
3149 Change all callers. Simplify handling of symbols from sections
3150 not included in the link.
3151 (Symbol_table::add_from_dynobj): Handle ordinary symbol
3152 distinction.
3153 (Weak_alias_sorter::operator()): Assert that symbols are
3154 ordinary.
3155 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
3156 distinction.
3157 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
3158 parameters. Change all callers.
3159 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
3160 symbol distinction. Use SHN_XINDEX when needed.
3161 (Symbol_table::write_section_symbol): Add symtab_xindex
3162 parameter. Change all callers.
3163 (Symbol_table::sized_write_section_symbol): Likewise. Use
3164 SHN_XINDEX when needed.
3165 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
3166 declarations.
3167 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
3168 (Symbol::is_defined): Check is_ordinary.
3169 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
3170 (Symbol::is_absolute, Symbol::is_common): Likewise.
3171 (class Sized_symbol): Update declarations.
3172 (class Symbol_table): Update declarations.
3173 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
3174 parameters. Change all callers.
3175 (Sized_symbol::override): Likewise.
3176 (Symbol_table::override): Likewise.
3177 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
3178 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
3179 is_ordinary, and orig_st_shndx parameters. Change all callers.
3180 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
3181 to be in an ordinary section.
3182 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
3183 object and is_ordinary parameters. Change all callers.
3184 (Sized_dwarf_line_info::read_relocs): Add object parameter.
3185 Change all callers. Don't add undefined or non-ordinary symbols
3186 to reloc_map_.
3187 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
3188 Change all callers.
3189 * dwarf_reader.h (class Sized_dwarf_line_info): Update
3190 declarations.
3191 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
3192 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
3193 (Sized_relobj::relocate_sections): Likewise.
3194 * target-reloc.h (scan_relocs): Adjust section symbol index.
3195 (scan_relocatable_relocs): Likewise.
3196 * i386.cc (Scan::local): Check for ordinary symbols.
3197 * sparc.cc (Scan::local): Likewise.
3198 * x86_64.cc (Scan::local): Likewise.
3199 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
3200 to symbol_section_and_value.
3201 * testsuite/many_sections_test.cc: New file.
3202 * testsuite/Makefile.am (BUILT_SOURCES): Define.
3203 (check_PROGRAMS): Add many_sections_test.
3204 (many_sections_test_SOURCES): Define.
3205 (many_sections_test_DEPENDENCIES): Define.
3206 (many_sections_test_LDFLAGS): Define.
3207 (BUILT_SOURCES): Add many_sections_define.h.
3208 (many_sections_define.h): New target.
3209 (BUILT_SOURCES): Add many_sections_check.h.
3210 (many_sections_check.h): New target.
3211 (check_PROGRAMS): Add many_sections_r_test.
3212 (many_sections_r_test_SOURCES): Define.
3213 (many_sections_r_test_DEPENDENCIES): Define.
3214 (many_sections_r_test_LDFLAGS): Define.
3215 (many_sections_r_test_LDADD): Define.
3216 (many_sections_r_test.o): New target.
3217 * testsuite/Makefile.in: Rebuild.
3218
3219 2008-04-17 Cary Coutant <ccoutant@google.com>
3220
3221 * errors.cc (Errors::info): New function.
3222 (gold_info): New function.
3223 * errors.h (Errors::info): New function.
3224 * gold.h (gold_info): New function.
3225 * object.cc (Input_objects::add_object): Print trace output.
3226 * options.cc (options::parse_set): New function.
3227 (General_options::parse_wrap): Deleted.
3228 (General_options::General_options): Deleted initializer.
3229 * options.h (options::String_set): New typedef.
3230 (options::parse_set): New function.
3231 (DEFINE_set): New macro.
3232 (General_options::wrap): Changed to use DEFINE_set. Changed
3233 callers of any_wrap_symbols and is_wrap_symbol.
3234 (General_options::trace, General_options::trace_symbol):
3235 New options.
3236 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
3237 (General_options::wrap_symbols_): Deleted.
3238 * symtab.cc (Symbol_table::add_from_object): Print trace output.
3239
3240 2008-04-17 David S. Miller <davem@davemloft.net>
3241
3242 * options.cc (General_options::parse_V): New function.
3243 * options.h: Add entries for -V and -Qy.
3244
3245 2008-04-17 Ian Lance Taylor <iant@google.com>
3246
3247 * common.cc (Symbol_table::allocate_commons): Remove options
3248 parameter. Change caller.
3249 (Symbol_table::do_allocate_commons): Remove options parameter.
3250 Change caller. Just call do_allocate_commons_list twice.
3251 (Symbol_table::do_allocate_commons_list): New function, broken out
3252 of do_allocate_commons.
3253 * common.h (class Allocate_commons_task): Remove options_ field.
3254 Update constructor.
3255 * symtab.cc (Symbol_table::Symbol_table): Initialize
3256 tls_commons_.
3257 (Symbol_table::add_from_object): Put TLS common symbols on
3258 tls_commons_ list.
3259 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
3260 which are IN_OUTPUT_DATA.
3261 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
3262 allocate_commons and do_allocate_commons declarations. Declare
3263 do_allocate_commons_list.
3264 * gold.cc (queue_middle_tasks): Update creation of
3265 Allocate_commons_task to not pass options.
3266 * testsuite/Makefile.am (INCLUDES): Add -I.. .
3267 (TLS_TEST_C_FLAGS): New variable.
3268 (tls_test_c_pic.o): New target.
3269 (tls_test_shared.so): Link in tls_test_c_pic.o.
3270 (tls_test_c_pic_ie.o): New target.
3271 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
3272 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
3273 (tls_test_c.o): New target.
3274 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
3275 (tls_pic_test_LDADD): Likewise.
3276 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
3277 (tls_shared_gd_to_ie_test_LDADD): Likewise.
3278 (tls_test_c_gnu2.o): New target.
3279 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
3280 tls_test_c_gnu2.o.
3281 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
3282 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
3283 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
3284 * testsuite/tls_test.cc: Include "config.h".
3285 (t_last): Call t11_last.
3286 * testsuite/tls_test.h (t11, t11_last): Declare.
3287 * testsuite/tls_test_c.c: New file.
3288 * testsuite/tls_test_main.cc (thread_routine): Call t11.
3289 * configure.ac: Check for OpenMP support.
3290 * configure, config.in, Makefile.in: Rebuild.
3291 * testsuite/Makefile.in: Rebuild.
3292
3293 2008-04-16 Cary Coutant <ccoutant@google.com>
3294
3295 * i386.cc (Target_i386::define_tls_base_symbol): New function.
3296 (Target_i386::tls_base_symbol_defined_): New field.
3297 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
3298 (Target_i386::Scan::global): Likewise.
3299 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
3300 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
3301 (Target_x86_64::tls_base_symbol_defined_): New field.
3302 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
3303 (Target_x86_64::Scan::global): Likewise.
3304
3305 2008-04-16 Cary Coutant <ccoutant@google.com>
3306
3307 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
3308 (Symbol::needs_plt_entry): Allow weak undefined symbols.
3309 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
3310 building shared libraries.
3311 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
3312 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
3313 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
3314 * testsuite/Makefile.in: Rebuild.
3315 * testsuite/weak_undef.h: New file.
3316 * testsuite/weak_undef_file1.cc: Add extra test cases.
3317 * testsuite/weak_undef_file2.cc: Likewise.
3318 * testsuite/weak_undef_test.cc: Likewise.
3319
3320 2008-04-16 David S. Miller <davem@davemloft.net>
3321
3322 * sparc.cc (Target_sparc::Scan): Change from struct to class.
3323 Add issued_non_pic_error_ field. Declare check_non_pic.
3324 (Target_sparc::Scan::check_non_pic): New function.
3325 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
3326 (Target_sparc::Scan::global): Likewise.
3327
3328 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
3329 * configure: Rebuild.
3330
3331 * options.h (DEFINE_enable): New macro.
3332 (new_dtags): New enable option.
3333 (initfirst, interpose, loadfltr, nodefaultlib,
3334 nodelete, nodlopen, nodump): New -z options.
3335 * layout.cc (Layout:finish_dynamic_section): If new
3336 dtags enabled, emit DT_RUNPATH. Also, emit a
3337 DT_FLAGS_1 containing any specified -z flags.
3338
3339 2008-04-16 Ian Lance Taylor <iant@google.com>
3340
3341 * copy-relocs.cc: New file.
3342 * copy-relocs.h: New file.
3343 * reloc.cc: Remove Copy_relocs code.
3344 * reloc.h: Likewise.
3345 * reloc-types.h (struct Reloc_types) [both versions]: Add
3346 get_reloc_addend_noerror.
3347 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
3348 variants of add_global which take an addend which must be zero.
3349 * i386.cc: Include "copy-relocs.h".
3350 (class Target_i386): Change type of copy_relocs_ to variable,
3351 update initializer.
3352 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
3353 Change all callers.
3354 (Target_i386::do_finalize_sections): Change handling of
3355 copy_relocs_.
3356 * sparc.cc: Include "copy-relocs.h".
3357 (class Target_sparc): Change type of copy_relocs_ to variable,
3358 update initializer.
3359 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
3360 Change all callers.
3361 (Target_sparc::do_finalize_sections): Change handling of
3362 copy_relocs_.
3363 * x86_64.cc: Include "copy-relocs.h".
3364 (class Target_x86_64): Change type of copy_relocs_ to variable,
3365 update initializer.
3366 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
3367 class. Change all callers.
3368 (Target_x86_64::do_finalize_sections): Change handling of
3369 copy_relocs_.
3370 * Makefile.am (CCFILES): Add copy-relocs.cc.
3371 (HFILES): Add copy-relocs.h.
3372
3373 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
3374
3375 * testsuite/script_test_4.sh: Permit leading zeroes.
3376
3377 2008-04-15 Ian Lance Taylor <iant@google.com>
3378
3379 * script-sections.cc (Script_sections::create_segments): Use
3380 header_size_adjustment even when there is enough room for the
3381 headers.
3382 * testsuite/script_test_4.sh: New file.
3383 * testsuite/script_test_4.t: New file.
3384 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
3385 (check_DATA): Add script_test_4.stdout.
3386 (MOSTLYCLEANFILES): Likewise.
3387 (script_test_4): New target.
3388 (script_test_4.stdout): New target.
3389 * testsuite/Makefile.in: Rebuild.
3390
3391 * sparc.cc: Add definitions for Output_data_plt_sparc class
3392 constants.
3393
3394 2008-04-14 David S. Miller <davem@davemloft.net>
3395
3396 * sparc.cc: New file.
3397 * Makefile.am (TARGETSOURCES): Add sparc.cc
3398 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
3399 * configure.tgt: Document targ_extra_size and
3400 targ_extra_big_endian. Add entries for sparc-* and
3401 sparc64-*.
3402 * configure.ac: Handle targ_extra_size and
3403 targ_extra_big_endian.
3404 * Makefile.in: Rebuild.
3405 * configure: Likewise.
3406 * po/POTFILES.in: Likewise.
3407 * po/gold.pot: Likewise.
3408
3409 2008-04-14 Ian Lance Taylor <iant@google.com>
3410
3411 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
3412 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
3413 in the name/type/flags to section mapping. Don't call
3414 allocate_output_section.
3415 (Layout::choose_output_section): Change parameter from adjust_name
3416 to is_input_section. Don't permit input sections after sections
3417 are attached to segments. Don't call allocate_output_section.
3418 (Layout::layout_eh_frame): Call update_flags_for_input_section,
3419 not write_enable_output_section.
3420 (Layout::make_output_section): Don't push to
3421 unattached_section_list_ nor call attach_to_segment. Call
3422 attach_section_to_segment if sections are attached.
3423 (Layout::attach_sections_to_segments): New function.
3424 (Layout::attach_section_to_segment): New function.
3425 (Layout::attach_allocated_section_to_segment): Rename from
3426 attach_to_segment. Remove flags parameter.
3427 (Layout::allocate_output_section): Remove function.
3428 (Layout::write_enable_output_section): Remove function.
3429 * layout.h (class Layout): Update for above changes. Add new
3430 field sections_are_attached_.
3431 * output.h (Output_section::update_flags_for_input_section): New
3432 function.
3433 * output.cc (Output_section::add_input_section): Call
3434 update_flags_for_input_section.
3435 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
3436
3437 2008-04-11 Cary Coutant <ccoutant@google.com>
3438
3439 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
3440 thought unnecessary.
3441 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
3442
3443 2008-04-11 Ian Lance Taylor <iant@google.com>
3444
3445 * output.h (class Output_section_data): Remove inline definition
3446 of set_addralign.
3447 * output.cc (Output_section_data::set_addralign): New function.
3448
3449 2008-04-11 Cary Coutant <ccoutant@google.com>
3450
3451 Add support for TLS descriptors for i386 and x86_64.
3452 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
3453 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
3454 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
3455 GOT_TYPE_TLS_DESC.
3456 (Target_i386::got_mod_index_entry): Remove unnecessary code.
3457 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
3458 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
3459 relocations.
3460 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
3461 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
3462 Fix problem with initial-exec relocations.
3463 (Target_i386::Relocate::relocate_tls): Likewise.
3464 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
3465 relaxation.
3466 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
3467 support for section-plus-offset dynamic table entries.
3468 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
3469 (Output_data_dynamic::Dynamic_entry): Add support for
3470 section-plus-offset dynamic table entries.
3471 (Output_data_dynamic::Classification): Likewise.
3472 (Output_data_dynamic::classification_): Renamed offset_.
3473 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
3474 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
3475 (Target_x86_64::make_plt_section): New function.
3476 (Target_x86_64::reserve_tlsdesc_entries): New function.
3477 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
3478 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
3479 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
3480 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
3481 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
3482 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
3483 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
3484 add extra PLT entry for TLS descriptors.
3485 (Output_data_plt_x86_64::got_): New field.
3486 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
3487 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
3488 fields.
3489 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
3490 descriptors.
3491 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
3492 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
3493 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
3494 R_386_TLS_DESC_CALL relocations.
3495 (Target_x86_64::Scan::global): Likewise.
3496 (Target_x86_64::do_finalize_sections): Add dynamic table entries
3497 for TLS descriptors.
3498 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
3499 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
3500 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
3501 GD-to-IE relaxation.
3502 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
3503 and TLS_DESCRIPTORS.
3504 * Makefile.in: Rebuild.
3505 * configure: Rebuild.
3506 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
3507 (tls_test_shared2.so): New target.
3508 (tls_shared_gd_to_ie_test_SOURCES): New variable.
3509 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
3510 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
3511 (tls_shared_gd_to_ie_test_LDADD): New variable.
3512 (tls_shared_gnu2_gd_to_ie_test): New target.
3513 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
3514 New targets.
3515 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
3516 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
3517 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
3518 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
3519 (tls_shared_gnu2_test): New target.
3520 (tls_test_gnu2_shared.so): New target.
3521 (tls_shared_gnu2_test_SOURCES): New variable.
3522 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
3523 (tls_shared_gnu2_test_LDFLAGS): New variable.
3524 (tls_shared_gnu2_test_LDADD): New variable.
3525 * testsuite/Makefile.in: Rebuild.
3526 * testsuite/Makefile.
3527
3528 2008-04-11 Ian Lance Taylor <iant@google.com>
3529
3530 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
3531 justsyms.t.
3532 * testsuite/Makefile.in: Rebuild.
3533
3534 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
3535 long.
3536 * testsuite/script_test_2.cc (main): Adjust test.
3537
3538 2008-04-11 David S. Miller <davem@davemloft.net>
3539 Ian Lance Taylor <iant@google.com>
3540
3541 * options.h (General_options): Add entries for '-Y' and
3542 '-relax'.
3543 * options.cc (General_options:finalize): If -Y was used, add those
3544 entries to the library path instead of the default "/lib" and
3545 "/usr/lib".
3546
3547 2008-04-11 David S. Miller <davem@davemloft.net>
3548
3549 * testsuite/justsyms.t: Start at 0x100.
3550 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
3551 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
3552 long.
3553 * testsuite/script_test_2.cc: Adjust string and section length
3554 checks.
3555
3556 2008-04-09 Ian Lance Taylor <iant@google.com>
3557
3558 PR gold/5996
3559 * script-sections.cc (Sections_element::allocate_to_segment): Add
3560 orphan parameter.
3561 (Output_section_definition::allocate_to_segment): Likewise.
3562 (Orphan_output_section::allocate_to_segment): Likewise.
3563 (Script_sections::attach_sections_using_phdrs_clause): Don't
3564 propagate non-PT_LOAD segments to orphan sections.
3565 * testsuite/Makefile.am (script_test_3.stdout): Generate using
3566 readelf rather than objdump.
3567 * testsuite/script_test_3.sh: Adjust accordingly. Test that
3568 .interp section and PT_INTERP segment are the same size.
3569 * testsuite/Makefile.in: Rebuild.
3570
3571 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
3572 aliases for symbols defined in the same object.
3573 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
3574 (weak_alias_test_SOURCES): New variable.
3575 (weak_alias_test_DEPENDENCIES): New variable.
3576 (weak_alias_test_LDFLAGS): New variable.
3577 (weak_alias_test_LDADD): New variable.
3578 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
3579 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
3580 (weak_alias_test_3.o): New target.
3581 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
3582 * testsuite/weak_alias_test_main.cc: New file.
3583 * testsuite/weak_alias_test_1.cc: New file.
3584 * testsuite/weak_alias_test_2.cc: New file.
3585 * testsuite/weak_alias_test_3.cc: New file.
3586
3587 2008-04-08 Ian Lance Taylor <iant@google.com>
3588
3589 * options.h (class General_options): Add --noinhibit-exec option.
3590 * main.cc (main): Check --noinhibit-exec.
3591
3592 * options.h (class General_options): Define --wrap as a special
3593 option. Add wrap_symbols_ field.
3594 (General_options::any_wrap_symbols): New function.
3595 (General_options::is_wrap_symbol): New function.
3596 * options.cc (General_options::parse_wrap): New function.
3597 (General_options::General_options): Initialize wrap_symbols_.
3598 * symtab.cc (Symbol_table::wrap_symbol): New function.
3599 (Symbol_table::add_from_object): Handle --wrap.
3600 * symtab.h (class Symbol_table): Declare wrap_symbol.
3601 * target.h (Target::wrap_char): New function.
3602 (Target::Target_info): Add wrap_char field.
3603 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
3604 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3605 * testsuite/testfile.cc (Target_test::test_target_info):
3606 Likewise.
3607
3608 * errors.cc (Errors::undefined_symbol): Mention symbol version if
3609 there is one.
3610
3611 * layout.h (class Layout): Add added_eh_frame_data_ field.
3612 * layout.cc (Layout::Layout): Initialize new field.
3613 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
3614 output section until we find a section we merged successfully.
3615 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
3616 that the size be non-zero.
3617
3618 * merge.cc (Object_merge_map::get_output_offset): Remove inline
3619 qualifier.
3620
3621 2008-04-08 Craig Silverstein <csilvers@google.com>
3622
3623 * configure.ac: Export new conditional variable HAVE_ZLIB.
3624 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
3625 on HAVE_ZLIB.
3626 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
3627 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3628
3629 2008-04-07 Ian Lance Taylor <iant@google.com>
3630
3631 * version.cc (version_string): Set to "1.5".
3632
3633 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
3634 Add issued_non_pic_error_ field. Declare check_non_pic.
3635 (Target_x86_64::Scan::check_non_pic): New function.
3636 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
3637 (Target_x86_64::Scan::global): Likewise.
3638
3639 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
3640 addend parameter. Change caller. Handle merge sections.
3641 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
3642 Address to Addend. Don't add in the result of
3643 local_section_offset, pass down the addend and use the returned
3644 value.
3645 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
3646 Update declarations of local_section_offset and symbol_value.
3647 * testsuite/two_file_test_1.cc (t18): New function.
3648 * testsuite/two_file_test_2.cc (f18): New function.
3649 * testsuite/two_file_test_main.cc (main): Call t18.
3650 * testsuite/two_file_test.h (t18, f18): Declare.
3651
3652 * configure.ac: Don't test for objdump, c++filt, or readelf.
3653 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
3654 conditionals.
3655 (TEST_READELF): New variable.
3656 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
3657 (check_PROGRAMS): Add two_file_strip_test.
3658 (two_file_strip_test): New target.
3659 (check_PROGRAMS): Add two_file_same_shared_strip_test.
3660 (two_file_same_shared_strip_test_SOURCES): New variable.
3661 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
3662 (two_file_same_shared_strip_test_LDFLAGS): New variable.
3663 (two_file_same_shared_strip_test_LDADD): New variable.
3664 (two_file_shared_strip.so): New target.
3665 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
3666 (ver_test_5.syms, ver_test_7.syms): Likewise.
3667 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
3668 (strip_test_3.stdout): Use TEST_OBJDUMP.
3669 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3670
3671 2008-04-04 Cary Coutant <ccoutant@google.com>
3672
3673 * symtab.h (Symbol::is_weak_undefined): New function.
3674 (Symbol::is_strong_undefined): New function.
3675 (Symbol::is_absolute): New function.
3676 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
3677 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
3678 absolute symbols.
3679 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
3680 (weak_undef_test): New target.
3681 * testsuite/Makefile.in: Rebuild.
3682 * testsuite/weak_undef_file1.cc: New file.
3683 * testsuite/weak_undef_file2.cc: New file.
3684 * testsuite/weak_undef_test.cc: New file.
3685
3686 2008-04-03 Craig Silverstein <csilvers@google.com>
3687
3688 * compressed_output.h (class Output_compressed_section): Use
3689 unsigned buffer.
3690 * compressed_output.cc (zlib_compress): Use unsigned buffers,
3691 add zlib header.
3692 (zlib_compressed_suffix): Removed.
3693 (Output_compressed_section::set_final_data_size): Use unsigned
3694 buffers.
3695 * testsuite/Makefile.am (flagstest_compress_debug_sections):
3696 Fix linker invocation.
3697 (flagstest_o_specialfile_and_compress_debug_sections):
3698 Likewise.
3699 * testsuite/Makefile.in: Regenerated.
3700
3701 2008-04-02 David S. Miller <davem@davemloft.net>
3702
3703 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
3704 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
3705
3706 2008-04-02 Craig Silverstein <csilvers@google.com>
3707
3708 * TODO: New file.
3709
3710 2008-04-02 Ian Lance Taylor <iant@google.com>
3711
3712 * fileread.cc (File_read::find_view): Add byteshift and vshifted
3713 parameters. Update for new key type to views_. Change all
3714 callers.
3715 (File_read::read): Adjust for byteshift in returned view.
3716 (File_read::add_view): New function, broken out of
3717 find_and_make_view.
3718 (File_read::make_view): New function, broken out of
3719 find_and_make_view.
3720 (File_read::find_or_make_view): Add offset and aligned
3721 parameters. Rewrite accordingly. Change all callers.
3722 (File_read::get_view): Add offset and aligned parameters. Adjust
3723 for byteshift in return value.
3724 (File_read::get_lasting_view): Likewise.
3725 * fileread.h (class File_read): Update declarations.
3726 (class File_read::View): Add byteshift_ field. Add byteshift to
3727 constructor. Add byteshift method.
3728 * archive.h (Archive::clear_uncached_views): New function.
3729 (Archive::get_view): Add aligned parameter. Change all callers.
3730 * object.h (Object::get_view): Add aligned parameter. Change all
3731 callers.
3732 (Object::get_lasting_view): Likewise.
3733
3734 * fileread.cc (File_read::release): Don't call clear_views if
3735 there are multiple objects.
3736 * fileread.h (File_read::clear_uncached_views): New function.
3737 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
3738 on the archive.
3739
3740 2008-03-31 Cary Coutant <ccoutant@google.com>
3741
3742 Add thin archive support.
3743 * archive.cc (Archive::armagt): New const.
3744 (Archive::setup): Remove task parameter and calls to unlock.
3745 (Archive::unlock_nested_archives): New function.
3746 (Archive::read_header): Add nested_off parameter. Change
3747 all callers.
3748 (Archive::interpret_header): Likewise.
3749 (Archive::include_all_members): Change to handle thin
3750 archives.
3751 (Archive::include_member): Likewise.
3752 * archive.h (Archive::Archive): Add new parameters and
3753 initializers.
3754 (Archive::armagt): New const.
3755 (Archive::setup): Remove task parameter.
3756 (Archive::unlock_nested_archives): New function.
3757 (Archive::read_header): Add nested_off parameter.
3758 (Archive::interpret_header): Likewise.
3759 (Archive::Nested_archive_table): New typedef.
3760 (Archive::is_thin_archive_): New field.
3761 (Archive::nested_archives_): New field.
3762 (Archive::options_): New field.
3763 (Archive::dirpath_): New field.
3764 (Archive::task_): New field.
3765 * readsyms.cc (Read_symbols::do_read_symbols): Add check
3766 for thin archives. Pass additional parameters to
3767 Archive::Archive. Unlock the archive file after calling
3768 Archive::setup.
3769
3770 2008-03-29 Ian Lance Taylor <iant@google.com>
3771
3772 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
3773 version symbol to be local.
3774 * testsuite/ver_test_4.sh: New file.
3775 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
3776 (check_DATA): Add ver_test_4.syms.
3777 (ver_test_4.syms): New target.
3778 * testsuite/Makefile.in: Rebuild.
3779
3780 * output.cc
3781 (Output_section::Input_section_sort_entry::has_priority): New
3782 function.
3783 (Output_section::Input_section_sort_entry::match_file_name): New
3784 function.
3785 (Output_section::Input_section_sort_entry::match_section_name):
3786 Remove.
3787 (Output_section::Input_section_sort_entry::match_section_name_prefix):
3788 Remove.
3789 (Output_section::Input_section_sort_entry::match_section_file):
3790 Remove.
3791 (Output_section::Input_section_sort_compare::operator()): Rewrite
3792 using new Input_section_sort_entry functions. Sort crtbegin and
3793 crtend first. Sort sections with no priority before sections with
3794 a priority.
3795 * testsuite/initpri1.c (d3): Check j != 4.
3796 (cd5): New constructor/destructor function.
3797 (main): Check j != 2.
3798
3799 * symtab.cc (Symbol_table::add_from_object): If we don't use the
3800 new symbol when resolving, don't call set_is_default.
3801 * testsuite/ver_test_7.cc: New file.
3802 * testsuite/ver_test_7.sh: New file.
3803 * testsuite/Makefile.am (ver_test_7.so): New target.
3804 (ver_test_7.o): New target.
3805 (check_SCRIPTS): Add ver_test_7.sh.
3806 (check_DATA): Add ver_test_7.syms.
3807 (ver_test_7.syms): New target.
3808
3809 2008-03-28 Ian Lance Taylor <iant@google.com>
3810
3811 * layout.cc (Layout::layout): If we see an input section with a
3812 name that needs sorting, set the must_sort flag for the output
3813 section.
3814 (Layout::make_output_section): If the name of the output section
3815 indicates that it might require sorting, set the may_sort flag.
3816 * output.h (Output_section::may_sort_attached_input_sections): New
3817 function.
3818 (Output_section::set_may_sort_attached_input_sections): New
3819 function.
3820 (Output_section::must_sort_attached_input_sections): New
3821 function.
3822 (Output_section::set_must_sort_attached_input_sections): New
3823 function.
3824 (class Output_section): Declare Input_section_sort_entry. Define
3825 Input_section_sort_compare. Declare
3826 sort_attached_input_sections. Add new fields:
3827 may_sort_attached_input_sections_,
3828 must_sort_attached_input_sections_,
3829 attached_input_sections_are_sorted_.
3830 * output.cc (Output_section::Output_section): Initialize new
3831 fields.
3832 (Output_section::add_input_section): Add an entry to
3833 input_sections_ if may_sort or must_sort are true.
3834 (Output_section::set_final_data_size): Call
3835 sort_attached_input_sections if necessary.
3836 (Output_section::Input_section_sort_entry): Define new class.
3837 (Output_section::Input_section_sort_compare::operator()): New
3838 function.
3839 (Output_section::sort_attached_input_sections): New function.
3840 * configure.ac: Check whether the compiler supports constructor
3841 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
3842 * testsuite/initpri1.c: New file.
3843 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
3844 CONSTRUCTOR_PRIORITY.
3845 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
3846 (initpri1_LDFLAGS): New variable.
3847 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
3848
3849 2008-03-27 Ian Lance Taylor <iant@google.com>
3850
3851 * common.cc (Sort_commons::operator): Correct sorting algorithm.
3852 * testsuite/common_test_1.c: New file.
3853 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
3854 (common_test_1_SOURCES): New variable.
3855 (common_test_1_DEPENDENCIES): New variable.
3856 (common_test_1_LDFLAGS): New variable.
3857
3858 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
3859 and commons_ correctly when NAME/VERSION does not override
3860 NAME/NULL.
3861 * testsuite/ver_test_6.c: New file.
3862 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
3863 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
3864 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
3865
3866 2008-03-26 Ian Lance Taylor <iant@google.com>
3867
3868 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
3869 of an undefined symbol from a version script.
3870 * testsuite/Makefile.am (ver_test_5.so): New target.
3871 (ver_test_5.o): New target.
3872 (check_SCRIPTS): Add ver_test_5.sh.
3873 (check_DATA): Add ver_test_5.syms.
3874 (ver_test_5.syms): New target.
3875 * testsuite/ver_test_5.cc: New file.
3876 * testsuite/ver_test_5.script: New file.
3877 * testsuite/ver_test_5.sh: New file.
3878 * Makefile.in, testsuite/Makefile.in: Rebuild.
3879
3880 PR gold/5986
3881 Fix problems building gold with gcc 4.3.0.
3882 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
3883 (gold_error_at_location, gold_warning_at_location): Use it.
3884 * configure.ac: Check whether we can compile and use a template
3885 function with a printf attribute.
3886 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
3887 when jumping over bytes.
3888 * object.cc: Instantiate Object::read_section_data.
3889 * debug.h: Include <cstring>
3890 * dwarf_reader.cc: Include <algorithm>
3891 * main.cc: Include <cstring>.
3892 * options.cc: Include <cstring>.
3893 * output.cc: Include <cstring>.
3894 * script.cc: Include <cstring>.
3895 * script.h: Include <string>.
3896 * symtab.cc: Include <cstring> and <algorithm>.
3897 * target-select.cc: Include <cstring>.
3898 * version.cc: Include <string>.
3899 * testsuite/testmain.cc: Include <cstdlib>.
3900 * configure, config.in: Rebuild.
3901
3902 2008-03-25 Ian Lance Taylor <iant@google.com>
3903
3904 * options.cc: Include "../bfd/bfdver.h".
3905 (options::help): Print bug reporting address.
3906
3907 * version.cc (print_version): Adjust output for current value of
3908 BFD_VERSION_STRING.
3909
3910 * NEWS: New file.
3911
3912 * options.cc (options::help): Print list of supported targets.
3913 * target-select.h: Include <vector>.
3914 (class Target_selector): Make machine_, size_, and is_big_endian_
3915 fields const. Add bfd_name_ and instantiated_target_ fields.
3916 (Target_selector::Target_selector): Add bfd_name parameter.
3917 (Target_selector::recognize): Make non-virtual, call
3918 do_recognize.
3919 (Target_selector::recognize_by_name): Make non-virtual, call
3920 do_recognize_by_name.
3921 (Target_selector::supported_names): New function.
3922 (Target_selector::bfd_name): New function.
3923 (Target_selector::do_instantiate_target): New pure virtual
3924 function.
3925 (Target_selector::do_recognize): New virtual function.
3926 (Target_selector::do_recognize_by_name): New virtual function.
3927 (Target_selector::instantiate_target): New private function.
3928 (supported_target_names): Declare.
3929 * target-select.cc (Target_selector::Target_selector): Update for
3930 new parameter and fields.
3931 (select_target_by_name): Check that the name matches before
3932 calling recognize_by_name.
3933 (supported_target_names): New function.
3934 * i386.cc (class Target_selector_i386): Update Target_selector
3935 constructor call. Remove recognize and recognize_by_name. Add
3936 do_instantiate_target.
3937 * x86_64.cc (class Target_selector_x86_64): Likewise.
3938 * testsuite/testfile.cc (class Target_selector_test): Update for
3939 changes to Target_selector.
3940
3941 * README: Rewrite, with some notes on unsupported features.
3942
3943 2008-03-24 Cary Coutant <ccoutant@google.com>
3944
3945 * i386.cc (Target_i386::Got_type): New enum declaration.
3946 (Target_i386::Scan::local): Updated callers of Output_data_got
3947 member functions.
3948 (Target_i386::Scan::global): Likewise.
3949 (Target_i386::Relocate::relocate): Likewise.
3950 (Target_i386::Relocate::relocate_tls): Likewise.
3951 * object.h (Got_offset_list): New class.
3952 (Sized_relobj::local_has_got_offset): Added got_type parameter.
3953 (Sized_relobj::local_got_offset): Likewise.
3954 (Sized_relobj::set_local_got_offset): Likewise.
3955 (Sized_relobj::local_has_tls_got_offset): Removed.
3956 (Sized_relobj::local_tls_got_offset): Removed.
3957 (Sized_relobj::set_local_tls_got_offset): Removed.
3958 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
3959 * output.cc (Output_data_got::add_global): Added got_type parameter.
3960 (Output_data_got::add_global_with_rel): Likewise.
3961 (Output_data_got::add_global_with_rela): Likewise.
3962 (Output_data_got::add_global_pair_with_rel): New function.
3963 (Output_data_got::add_global_pair_with_rela): New function.
3964 (Output_data_got::add_local): Added got_type parameter.
3965 (Output_data_got::add_local_with_rel): Likewise.
3966 (Output_data_got::add_local_with_rela): Likewise.
3967 (Output_data_got::add_local_pair_with_rel): New function.
3968 (Output_data_got::add_local_pair_with_rela): New function.
3969 (Output_data_got::add_global_tls): Removed.
3970 (Output_data_got::add_global_tls_with_rel): Removed.
3971 (Output_data_got::add_global_tls_with_rela): Removed.
3972 (Output_data_got::add_local_tls): Removed.
3973 (Output_data_got::add_local_tls_with_rel): Removed.
3974 (Output_data_got::add_local_tls_with_rela): Removed.
3975 * output.h (Output_data_got::add_global): Added got_type parameter.
3976 (Output_data_got::add_global_with_rel): Likewise.
3977 (Output_data_got::add_global_with_rela): Likewise.
3978 (Output_data_got::add_global_pair_with_rel): New function.
3979 (Output_data_got::add_global_pair_with_rela): New function.
3980 (Output_data_got::add_local): Added got_type parameter.
3981 (Output_data_got::add_local_with_rel): Likewise.
3982 (Output_data_got::add_local_with_rela): Likewise.
3983 (Output_data_got::add_local_pair_with_rel): New function.
3984 (Output_data_got::add_local_pair_with_rela): New function.
3985 (Output_data_got::add_global_tls): Removed.
3986 (Output_data_got::add_global_tls_with_rel): Removed.
3987 (Output_data_got::add_global_tls_with_rela): Removed.
3988 (Output_data_got::add_local_tls): Removed.
3989 (Output_data_got::add_local_tls_with_rel): Removed.
3990 (Output_data_got::add_local_tls_with_rela): Removed.
3991 * resolve.cc (Symbol::override_base_with_special): Removed
3992 reference to has_got_offset_ field.
3993 * symtab.cc (Symbol::init_fields): Replaced initialization
3994 of got_offset_ with got_offsets_. Removed initialization
3995 of has_got_offset_
3996 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
3997 (Symbol::got_offset): Likewise.
3998 (Symbol::set_got_offset): Likewise.
3999 (Symbol::has_tls_got_offset): Removed.
4000 (Symbol::tls_got_offset): Removed.
4001 (Symbol::set_tls_got_offset): Removed.
4002 (Symbol::got_offset_): Removed.
4003 (Symbol::tls_mod_got_offset_): Removed.
4004 (Symbol::tls_pair_got_offset_): Removed.
4005 (Symbol::got_offsets_): New field.
4006 (Symbol::has_got_offset): Removed.
4007 (Symbol::has_tls_mod_got_offset): Removed.
4008 (Symbol::has_tls_pair_got_offset): Removed.
4009 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
4010 (Target_x86_64::Scan::local): Updated callers of Output_data_got
4011 member functions.
4012 (Target_x86_64::Scan::global): Likewise.
4013 (Target_x86_64::Relocate::relocate): Likewise.
4014 (Target_x86_64::Relocate::relocate_tls): Likewise.
4015
4016 2008-03-25 Ben Elliston <bje@au.ibm.com>
4017
4018 * yyscript.y: Fix spelling error in comment.
4019
4020 2008-03-24 Ian Lance Taylor <iant@google.com>
4021
4022 * options.h (class General_options): Define build_id option.
4023 * layout.h (class Layout): Declare write_build_id, create_note,
4024 create_build_id. Add build_id_note_ member.
4025 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
4026 "libiberty.h", "md5.h", "sha1.h".
4027 (Layout::Layout): Initialize eh_frame_data_,
4028 eh_frame_hdr_section_, and build_id_note_.
4029 (Layout::finalize): Call create_build_id.
4030 (Layout::create_note): New function, broken out of
4031 Layout::create_gold_note.
4032 (Layout::create_gold_note): Call create_note.
4033 (Layout::create_build_id): New function.
4034 (Layout::write_build_id): New function.
4035 (Close_task_runner::run): Call write_build_id.
4036
4037 * x86_64.cc: Correct license to GPLv3.
4038
4039 2008-03-23 Ian Lance Taylor <iant@google.com>
4040
4041 * options.cc: Include "demangle.h".
4042 (parse_optional_string): New function.
4043 (parse_long_option): Handle takes_optional_argument.
4044 (parse_short_option): Update dash_z initializer. Handle
4045 takes_optional_argument.
4046 (General_options::General_options): Initialize do_demangle_.
4047 (General_options::finalize): Set do_demangle_. Handle demangling
4048 style.
4049 * options.h (parse_optional_string): Declare.
4050 (struct One_option): Add optional_arg field. Update constructor.
4051 Update call constructor calls. Add takes_optional_argument
4052 function.
4053 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
4054 (DEFINE_optional_string): Define.
4055 (General_options::demangle): Change from DEFINE_bool to
4056 DEFINE_optional_string.
4057 (General_options::no_demangle): New function.
4058 (General_options::do_demangle): New function.
4059 (General_options::set_do_demangle): New function.
4060 (General_options::execstack_status_): Move definition to end of
4061 class definition.
4062 (General_options::static_): Likewise.
4063 (General_options::do_demangle_): New field.
4064 * object.cc (big_endian>::get_symbol_location_info): Call
4065 Options::do_demangle, not Options::demangle.
4066 * symtab.cc (demangle): Likewise.
4067
4068 2008-03-22 Ian Lance Taylor <iant@google.com>
4069
4070 * gold.h: Include <cstddef> and <sys/types.h>
4071 * options.h: Include <cstring>.
4072
4073 2008-03-21 Ian Lance Taylor <iant@google.com>
4074
4075 * Added source code to GNU binutils.
This page took 0.111693 seconds and 5 git commands to generate.