Include "config.h" first
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2
3 * testsuite/tls_test.cc: Include "config.h" first.
4 * testsuite/tls_test_c.c: Likewise.
5
6 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
7 Nick Clifton <nickc@redhat.com>
8
9 PR 14072
10 * configure.in: Add check that sysdep.h has been included before
11 any system header files.
12 * configure: Regenerate.
13 * config.in: Regenerate.
14
15 2012-05-14 Cary Coutant <ccoutant@google.com>
16
17 * layout.cc (Layout::make_output_section): Mark .tdata section
18 as RELRO.
19 * testsuite/relro_test.cc: Add a TLS variable.
20
21 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
22
23 PR gold/14091
24 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
25 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
26 R_X86_64_64.
27
28 2012-05-08 Cary Coutant <ccoutant@google.com>
29
30 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
31 (lines_only_debug_sections): Likewise.
32
33 2012-05-02 Roland McGrath <mcgrathr@google.com>
34
35 * nacl.cc: New file.
36 * nacl.h: New file.
37 * Makefile.am (CCFILES, HFILES): Add them.
38 * Makefile.in: Regenerate.
39 * i386.cc (Output_data_plt_i386_nacl): New class.
40 (Output_data_plt_i386_nacl_exec): New class.
41 (Output_data_plt_i386_nacl_dyn): New class.
42 (Target_i386_nacl): New class.
43 (Target_selector_i386_nacl): New class.
44 (target_selector_i386): Use it instead of Target_selector_i386.
45 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
46 (Target_x86_64_nacl): New class.
47 (Target_selector_x86_64_nacl): New class.
48 (target_selector_x86_64, target_selector_x32): Use it instead of
49 Target_selector_x86_64.
50 * arm.cc (Output_data_plt_arm_nacl): New class.
51 (Target_arm_nacl): New class.
52 (Target_selector_arm_nacl): New class.
53 (target_selector_arm, target_selector_armbe): Use it instead of
54 Target_selector_arm.
55
56 * target-select.cc (select_target): Take new Input_file* and off_t
57 arguments, pass them on to recognize method of selector.
58 * object.cc (make_elf_sized_object): Update caller.
59 * parameters.cc (parameters_force_valid_target): Likewise.
60 * incremental.cc (make_sized_incremental_binary): Likewise.
61 * target-select.h: Update decl.
62 (Target_selector::recognize): Take new Input_file* argument,
63 pass it on to do_recognize.
64 (Target_selector::do_recognize): Take new Input_file* argument.
65 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
66 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
67 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
68 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
69
70 * target.h (Target::Target_info): New members isolate_execinstr
71 and rosegment_gap.
72 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
73 * arm.cc (Target_arm::arm_info): Update initializer.
74 * i386.cc (Target_i386::i386_info): Likewise.
75 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
76 * sparc.cc (Target_sparc::sparc_info): Likewise.
77 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
78 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
79 * layout.cc (Layout::attach_allocated_section_to_segment):
80 Take new const Target* argument. If target->isolate_execinstr(), act
81 like --rosegment.
82 (Layout::find_first_load_seg): Take new const Target* argument;
83 if target->isolate_execinstr(), reject PF_X segments.
84 (Layout::relaxation_loop_body): Update caller.
85 (Layout::set_segment_offsets): If target->isolate_execinstr(),
86 reset file offset to zero when we hit LOAD_SEG, and then do a second
87 loop over the segments before LOAD_SEG to reassign offsets after
88 addresses have been determined. Handle target->rosegment_gap().
89 (Layout::attach_section_to_segment): Take new const Target* argument;
90 pass it to attach_allocated_section_to_segment.
91 (Layout::make_output_section): Update caller.
92 (Layout::attach_sections_to_segments): Take new const Target* argument;
93 pass it to attach_section_to_segment.
94 * gold.cc (queue_middle_tasks): Update caller.
95 * layout.h (Layout): Update method decls with new arguments.
96
97 * arm.cc (Target_arm::Target_arm): Take optional argument for the
98 Target_info pointer to use.
99 (Target_arm::do_make_data_plt): New virtual method.
100 (Target_arm::make_data_plt): New method that calls it.
101 (Target_arm::make_plt_entry): Use it.
102 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
103 for the section alignment.
104 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
105 method.
106 (Output_data_plt_arm::first_plt_entry_offset): Call it.
107 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
108 method.
109 (Output_data_plt_arm::get_plt_entry_size): Call it.
110 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
111 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
112 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
113 method.
114 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
115 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
116 method instead of sizeof(plt_entry).
117 (Output_data_plt_arm::add_entry): Likewise.
118 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
119 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
120 than static method.
121 (Target_arm::plt_entry_size): Likewise.
122 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
123 Move to ...
124 (Output_data_plt_arm_standard): ... here, new class.
125 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
126 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
127 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
128
129 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
130 Take additional argument for the PLT entry size.
131 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
132 Use get_plt_entry_size method rather than plt_entry_size variable.
133 (Output_data_plt_x86_64::reserve_slot): Likewise.
134 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
135 (Output_data_plt_x86_64::add_entry): Likewise.
136 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
137 (Output_data_plt_x86_64::address_for_global): Likewise.
138 (Output_data_plt_x86_64::address_for_local): Likewise.
139 (Output_data_plt_x86_64::set_final_data_size): Likewise.
140 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
141 Make method non-static.
142 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
143 method.
144 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
145 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
146 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
147 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
148 virtual method.
149 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
150 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
151 virtual method.
152 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
153 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
154 virtual method.
155 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
156 (Output_data_plt_x86_64::plt_entry_size)
157 (Output_data_plt_x86_64::first_plt_entry)
158 (Output_data_plt_x86_64::plt_entry)
159 (Output_data_plt_x86_64::tlsdesc_plt_entry)
160 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
161 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
162 (Output_data_plt_x86_64_standard): ... here, new class.
163 (Target_x86_64::Target_x86_64): Take optional argument for the
164 Target_info pointer to use.
165 (Target_x86_64::do_make_data_plt): New virtual method.
166 (Target_x86_64::make_data_plt): New method to call it.
167 (Target_x86_64::init_got_plt_for_update): Use that.
168 Call this->plt_->add_eh_frame method here.
169 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
170 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
171 rather than static method.
172 (Target_x86_64::plt_entry_size): Likewise.
173 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
174 rather than plt_entry_size variable. Move guts of PLT filling to...
175 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
176 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
177 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
178
179 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
180 additional argument for the section alignment.
181 Don't do add_eh_frame_for_plt here.
182 (Output_data_plt_i386::first_plt_entry_offset): Make the method
183 non-static. Use get_plt_entry_size method rather than plt_entry_size
184 variable.
185 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
186 method.
187 (Output_data_plt_i386::get_plt_entry_size): Call it.
188 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
189 (Output_data_plt_i386::add_eh_frame): New method to call it.
190 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
191 method.
192 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
193 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
194 method.
195 (Output_data_plt_i386::fill_plt_entry): New method to call it.
196 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
197 method instead of plt_entry_size.
198 (Output_data_plt_i386::plt_entry_size)
199 (Output_data_plt_i386::plt_eh_frame_fde_size)
200 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
201 (Output_data_plt_i386_standard): ... here, new class.
202 (Output_data_plt_i386_exec): New class.
203 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
204 (Output_data_plt_i386_exec::first_plt_entry): ... here.
205 (Output_data_plt_i386::exec_plt_entry): Move to ...
206 (Output_data_plt_i386_exec::plt_entry): ... here.
207 (Output_data_plt_i386_dyn): New class.
208 (Output_data_plt_i386::first_plt_entry): Move to ...
209 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
210 (Output_data_plt_i386::dyn_plt_entry): Move to ...
211 (Output_data_plt_i386_dyn::plt_entry): ... here.
212 (Target_i386::Target_i386): Take optional argument for the Target_info
213 pointer to use.
214 (Target_i386::do_make_data_plt): New virtual method.
215 (Target_i386::make_data_plt): New method to call it.
216 (Target_i386::make_plt_section): Use that.
217 Call this->plt_->add_eh_frame method here.
218 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
219 rather than plt_entry_size variable.
220 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
221 (Output_data_plt_i386::address_for_local): Likewise.
222 (Output_data_plt_i386::do_write): Likewise.
223 Move guts of PLT filling to...
224 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
225 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
226 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
227 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
228
229 2012-05-01 Cary Coutant <ccoutant@google.com>
230
231 * dwarf_reader.cc (Dwarf_die::read_attributes)
232 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
233 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
234 * reduced_debug_output.cc
235 (Output_reduced_debug_info_section::get_die_end): Remove
236 DW_FORM_GNU_ref_index. Add default case.
237
238 2012-04-26 Mark Wielaard <mjw@redhat.com>
239
240 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
241 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
242 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
243 DW_AT_high_pc as offset from DW_AT_low_pc.
244
245 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
246 * testsuite/Makefile.in: Regenerate.
247 * testsuite/gdb_index_test_3.c: New test source file.
248 * testsuite/gdb_index_test_3.sh: New test source file.
249
250 2012-04-25 Ian Lance Taylor <iant@google.com>
251
252 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
253 pointer.
254 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
255 as a class, not a struct.
256 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
257 (Target_arm::apply_cortex_a8_workaround): Likewise.
258 * gc.h: Declare Reloc_types as a struct, not a class.
259 * object.h: Declare Symbols_data as a struct.
260 * reloc.h: Declare Read_relocs_data as a struct.
261 * target.h: Declare Relocate_info as a struct.
262
263 2012-04-24 David S. Miller <davem@davemloft.net>
264
265 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
266 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
267 and R_SPARC_WPLT30.
268
269 2012-04-24 Cary Coutant <ccoutant@google.com>
270
271 * incremental-dump.cc (find_input_containing_global): Replace
272 magic number with symbolic constant.
273 (dump_incremental_inputs): Update version number.
274 * incremental.cc (Output_section_incremental_inputs): Update version
275 number; import symbolic constants from Incremental_inputs_reader.
276 (Incremental_inputs::create_data_sections): Align relocations
277 section correctly for 64-bit targets.
278 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
279 constants; add padding.
280 (Output_section_incremental_inputs::write_header): Add assert for
281 header_size.
282 (Output_section_incremental_inputs::write_input_files): Add assert
283 for input_entry_size.
284 (Output_section_incremental_inputs::write_info_blocks): Add padding;
285 add assert for object_info_size, input_section_entry_size,
286 global_sym_entry_size.
287 * incremental.h (Incremental_inputs_reader): Add symbolic constants
288 for data structure sizes; use them.
289 (Incremental_input_entry_reader): Import symbolic constants from
290 Incremental_inputs_reader; use them.
291
292 2012-04-23 David S. Miller <davem@davemloft.net>
293
294 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
295 and elf_flags_set_.
296 (Target_sparc::Target_sparc): Initialize new fields.
297 (Target_sparc::do_make_elf_object): New function.
298 (Target_sparc::do_adjust_elf_header): New function.
299
300 2012-04-23 Cary Coutant <ccoutant@google.com>
301
302 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
303 CU range table of gdb index.
304
305 2012-04-20 David S. Miller <davem@davemloft.net>
306
307 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
308 instead of false.
309
310 2012-04-16 David S. Miller <davem@davemloft.net>
311
312 * sparc.cc (Target_sparc::got_address): New function.
313 (Sparc_relocate_functions::gdop_hix22): New function.
314 (Sparc_relocate_functions::gdop_lox10): New function.
315 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
316 relocs.
317 (Target_sparc::Scan::local): Likewise if the global symbol is not
318 preemptible and is not IFUNC.
319 (Target_sparc::Relocate::relocate): Perform GOTDATA code
320 transformations for local and non-preemptible non-IFUNC global
321 symbols.
322
323 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
324 writing out 64-bit part of ranges.
325
326 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
327 -fpic and -fpie respectively.
328 * Makefile.in: Regenerate.
329
330 * sparc.cc (class Target_sparc): Add rela_ifunc_.
331 (Target_sparc::Target_sparc): Initialize new field.
332 (Target_sparc::do_plt_section_for_global): New function.
333 (Target_sparc::do_plt_section_for_local): New function.
334 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
335 (Target_sparc::make_plt_section): New function, broken out of
336 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
337 (Target_sparc::make_plt_entry): Call make_plt_section.
338 (Target_sparc::make_local_ifunc_plt_entry): New function.
339 (Target_sparc::rela_ifunc_section): New function.
340 (Target_sparc::plt_section): Remove const.
341 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
342 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
343 and ifunc_count_ fields.
344 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
345 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
346 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
347 (Output_data_plt_sparc::rela_ifunc): New function.
348 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
349 (Output_data_plt_sparc::has_ifunc_section): New function.
350 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
351 (Output_data_plt_sparc::address_for_global): New function.
352 (Output_data_plt_sparc::address_for_local): New function.
353 (Output_data_plt_sparc::plt_index_to_offset): New function.
354 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
355 and entry_count.
356 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
357 entry_count.
358 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
359 R_SPARC_JMP_IREL to switch.
360 (Target_sparc::Scan::check_non_pic): Likewise.
361 (Target_sparc::Scan::local): Handle IFUNC symbols.
362 (Target_sparc::Scan::local): Likewise.
363 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
364 and plt_address_for_local.
365 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
366 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
367
368 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
369 (class Output_data_reloc): Adjust calls to Output_reloc_type.
370 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
371 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
372 global relocs too.
373 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
374 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
375 calls.
376 * sparc.cc (Target_sparc::Scan::global): Likewise.
377 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
378
379 2012-04-16 Cary Coutant <ccoutant@google.com>
380
381 * archive.cc (Library_base::should_include_member): Check for
382 --export-dynamic-symbol.
383 * options.h (class General_options): Add --export-dynamic-symbol.
384 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
385 --export-dynamic-symbol.
386 (Symbol_table::gc_mark_undef_symbols): Likewise.
387 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
388
389 2012-04-12 David S. Miller <davem@davemloft.net>
390
391 * sparc.cc (Reloc::wdisp10): New relocation method.
392 (Reloc::h34): Likewise.
393 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
394 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
395 R_SPARC_WDISP10.
396 (Target_sparc::Scan::local): Likewise.
397 (Target_sparc::Scan::global): Likewise.
398 (Target_sparc::Relocate::relocate): Likewise.
399
400 2012-04-09 Cary Coutant <ccoutant@google.com>
401
402 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
403 low_pc == 0.
404
405 2012-04-06 Ian Lance Taylor <iant@google.com>
406
407 * timer.cc: #include <unistd.h>.
408
409 2012-04-06 Roland McGrath <mcgrathr@google.com>
410
411 * configure.in (AC_CHECK_HEADERS): Add locale.h.
412 * config.in: Regenerate.
413 * configure: Regenerate.
414
415 2012-04-05 Nick Clifton <nickc@redhat.com>
416
417 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
418 (AM_LC_MESSAGES): Add.
419 * aclocal.m4: Regenerate.
420 * config.in: Regenerate.
421 * configure: Regenerate.
422
423 2012-03-21 Cary Coutant <ccoutant@google.com>
424
425 * Makefile.am: Add gdb-index.cc, gdb-index.h.
426 * Makefile.in: Regenerate.
427 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
428 (Sized_elf_reloc_mapper::symbol_section): New function.
429 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
430 (make_elf_reloc_mapper): New function.
431 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
432 (Dwarf_abbrev_table::do_read_abbrevs): New function.
433 (Dwarf_abbrev_table::do_get_abbrev): New function.
434 (Dwarf_ranges_table::read_ranges_table): New function.
435 (Dwarf_ranges_table::read_range_list): New function.
436 (Dwarf_pubnames_table::read_section): New function.
437 (Dwarf_pubnames_table::read_header): New function.
438 (Dwarf_pubnames_table::next_name): New function.
439 (Dwarf_die::Dwarf_die): New function.
440 (Dwarf_die::read_attributes): New function.
441 (Dwarf_die::skip_attributes): New function.
442 (Dwarf_die::set_name): New function.
443 (Dwarf_die::set_linkage_name): New function.
444 (Dwarf_die::attribute): New function.
445 (Dwarf_die::string_attribute): New function.
446 (Dwarf_die::int_attribute): New function.
447 (Dwarf_die::uint_attribute): New function.
448 (Dwarf_die::ref_attribute): New function.
449 (Dwarf_die::child_offset): New function.
450 (Dwarf_die::sibling_offset): New function.
451 (Dwarf_info_reader::check_buffer): New function.
452 (Dwarf_info_reader::parse): New function.
453 (Dwarf_info_reader::do_parse): New function.
454 (Dwarf_info_reader::do_read_string_table): New function.
455 (Dwarf_info_reader::lookup_reloc): New function.
456 (Dwarf_info_reader::get_string): New function.
457 (Dwarf_info_reader::visit_compilation_unit): New function.
458 (Dwarf_info_reader::visit_type_unit): New function.
459 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
460 Sized_elf_reloc_mapper.
461 (Sized_dwarf_line_info::symbol_section): Remove function.
462 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
463 (Sized_dwarf_line_info::read_line_mappings): Remove object
464 parameter, adjust callers.
465 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
466 * dwarf_reader.h: Include <sys/types.h>.
467 (class Track_relocs): Remove forward declaration.
468 (class Elf_reloc_mapper): New class.
469 (class Sized_elf_reloc_mapper): New class.
470 (class Dwarf_abbrev_table): New class.
471 (class Dwarf_range_list): New class.
472 (class Dwarf_ranges_table): New class.
473 (class Dwarf_pubnames_table): New class.
474 (class Dwarf_die): New class.
475 (class Dwarf_info_reader): New class.
476 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
477 (Sized_dwarf_line_info::symbol_section): Remove member function.
478 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
479 base class.
480 * gdb-index.cc: New source file.
481 * gdb-index.h: New source file.
482 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
483 and .debug_types sections, call Layout::add_to_gdb_index.
484 (Sized_relobj_incr::do_section_name): Implement.
485 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
486 return type; Implement.
487 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
488 return type.
489 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
490 parameter list and return type.
491 (Sized_incr_dynobj::do_section_contents): Likewise.
492 * layout.cc: Include gdb-index.h.
493 (Layout::Layout): Initialize gdb_index_data_.
494 (Layout::init_fixed_output_section): Check for .gdb_index section.
495 (Layout::add_to_gdb_index): New function. Instantiate.
496 * layout.h: Add forward declaration for class Gdb_index.
497 (Layout::add_to_gdb_index): New member function.
498 (Layout::gdb_index_data_): New data member.
499 * main.cc: Include gdb-index.h.
500 (main): Print statistics for gdb index.
501 * object.cc (Object::section_contents): Move code into
502 do_section_contents.
503 (need_decompressed_section): Check for sections needed when building
504 gdb index.
505 (build_compressed_section_map): Likewise.
506 (Sized_relobj_file::do_read_symbols): Need local symbols when building
507 gdb index.
508 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
509 sections; call Layout::add_to_gdb_index.
510 (Sized_relobj_file::do_decompressed_section_contents): Call
511 do_section_contents directly.
512 * object.h (Object::do_section_contents): Adjust parameter list and
513 return type.
514 (Object::do_decompressed_section_contents): Call do_section_contents
515 directly.
516 (Sized_relobj_file::do_section_contents): Adjust parameter list and
517 return type.
518 * options.h (class General_options): Add --gdb-index option.
519 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
520 list and return type.
521 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
522 * reloc.h (Track_relocs::checkpoint): New function.
523 (Track_relocs::reset): New function.
524
525 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
526 New test cases.
527 * testsuite/Makefile.in: Regenerate.
528 * testsuite/gdb_index_test.cc: New test source file.
529 * testsuite/gdb_index_test_1.sh: New test source file.
530 * testsuite/gdb_index_test_2.sh: New test source file.
531
532 2012-03-19 Doug Kwan <dougkwan@google.com>
533
534 * arm.cc (Target_arm::do_define_standard_symbols): New method.
535 (Target_arm::do_finalize_sections): Remove code which defines
536 __exidx_start and __exidx_end. Make symbol table parameter
537 anonymous as it is not used.
538 * gold.cc (queue_middle_tasks): Call target hook to define any
539 target-specific symbols.
540 * target.h (Target::define_standard_symbols): New method.
541 (Target::do_define_standard_symbols): Same.
542 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
543 * testsuite/Makefile.in: Regenerate.
544 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
545 and __exidx_end.
546 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
547 relocations are generated for __exidx_start and __exidx_end.
548
549 2012-03-16 Doug Kwan <dougkwan@google.com>
550
551 * testsuite/Makefile.am: Disable test initpri3b.
552 * testsuite/Makefile.in: Regenerate.
553
554 2012-03-15 Doug Kwan <dougkwan@google.com>
555
556 * arm.cc (Target_arm::got_section): Make .got section read-only
557 if -z now is given.
558
559 2012-03-15 Ian Lance Taylor <iant@google.com>
560
561 PR gold/13850
562 * layout.cc (Layout::make_output_section): Correctly mark
563 SHT_INIT_ARRAY, et. al., as relro.
564
565 2012-03-14 Doug Kwan <dougkwan@google.com>
566
567 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
568 dynamic relocations for protected symbols in shared objects.
569
570 2012-03-13 Ian Lance Taylor <iant@google.com>
571
572 * resolve.cc (Symbol_table::resolve): When merging common symbols,
573 keep the larger alignment.
574
575 2012-03-12 Cary Coutant <ccoutant@google.com>
576
577 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
578 handling of DW_LNE_define_file.
579
580 2012-03-12 Cary Coutant <ccoutant@google.com>
581
582 * reduced_debug_output.cc
583 (Output_reduced_debug_info_section::get_die_end): Add new FORM
584 codes to switch.
585
586 2012-02-29 Cary Coutant <ccoutant@google.com>
587
588 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
589
590 2012-02-29 Cary Coutant <ccoutant@google.com>
591
592 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
593 Call Object::decompressed_section_contents.
594 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
595 New dtor.
596 (Sized_dwarf_line_info::buffer_start_): New data member.
597 * merge.cc (Output_merge_data::do_add_input_section): Call
598 Object::decompressed_section_contents.
599 (Output_merge_string::do_add_input_section): Likewise.
600 * object.cc (need_decompressed_section): New function.
601 (build_compressed_section_map): Decompress sections needed later.
602 (Sized_relobj_file::do_decompressed_section_contents): New function.
603 (Sized_relobj_file::do_discard_decompressed_sections): New function.
604 * object.h (Object::decompressed_section_contents): New function.
605 (Object::discard_decompressed_sections): New function.
606 (Object::do_decompressed_section_contents): New function.
607 (Object::do_discard_decompressed_sections): New function.
608 (Compressed_section_info): New type.
609 (Compressed_section_map): Include decompressed section contents.
610 (Sized_relobj_file::do_decompressed_section_contents): New function.
611 (Sized_relobj_file::do_discard_decompressed_sections): New function.
612
613 2012-02-16 Cary Coutant <ccoutant@google.com>
614
615 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
616 * testsuite/Makefile.in: Regenerate.
617
618 2012-02-14 Cary Coutant <ccoutant@google.com>
619
620 * options.cc (General_options::finalize): Disallow -pie and -static.
621
622 2012-02-03 Doug Kwan <dougkwan@google.com>
623
624 * arm.cc (Arm_relocate_functions::abs8,
625 Arm_relocate_functions::abs16): Use
626 Bits::has_signed_unsigned_overflow32.
627 (Arm_relocate_functions::thm_abs8): Correct range of
628 overflow check.
629 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
630 in assertions.
631
632 2012-02-02 Doug Kwan <dougkwan@google.com>
633
634 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
635 position independent outputs, not just shared objects.
636
637 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
638
639 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
640 * configure: Regenerated.
641
642 2012-01-27 Ian Lance Taylor <iant@google.com>
643
644 * reloc.h (Bits): New class with static functions, copied from
645 namespace utils in arm.cc.
646 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
647 instead.
648
649 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
650
651 * incremental.cc (write_info_blocks): Correct relocation offset.
652
653 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
654
655 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
656 (Relocate::tls_gd_to_le): Likewise.
657
658 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
659
660 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
661
662 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
663
664 * configure.ac: Check if -mcmodel=medium works.
665 * configure: Regenerated.
666
667 2012-01-24 Cary Coutant <ccoutant@google.com>
668
669 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
670 definition and ...
671 (read_unsigned_LEB_128_x): ... this new function.
672 (read_signed_LEB_128): Replaced with inline definition and ...
673 (read_signed_LEB_128_x): ... this new function.
674 * int_encoding.h (read_unsigned_LEB_128_x): New function.
675 (read_unsigned_LEB_128): Add inline definition.
676 (read_signed_LEB_128_x): New function.
677 (read_signed_LEB_128): Add inline definition.
678 * testsuite/Makefile.am (leb128_unittest): New unit test.
679 * testsuite/Makefile.in: Regenerate.
680 * testsuite/leb128_unittest.cc: New unit test.
681
682 2012-01-23 Ian Lance Taylor <iant@google.com>
683
684 PR gold/13617
685 * i386.cc (Target_i386::do_code_fill): When using a jmp
686 instruction, pad with nop instructions.
687 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
688
689 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
690
691 * x86_64.cc (gc_process_relocs): Add typename on types used in
692 template.
693 (scan_relocs): Likewise.
694 (relocate_section): Likewise.
695 (apply_relocation): Likewise.
696
697 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
698
699 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
700 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
701 under x32.
702
703 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
704
705 * x86_64.cc: Initial support for x32.
706
707 2012-01-03 Cary Coutant <ccoutant@google.com>
708
709 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
710 Use abstract base class for GOT.
711 * gold/output.h (class Output_data_got_base): New abstract base class.
712 (class Output_data_got): Derive from new base class, adjust ctors.
713 (Output_data_got::reserve_slot): Make virtual; rename to
714 do_reserve_slot; Adjust callers.
715 * gold/target.h (Sized_target::init_got_plt_for_update): Return
716 pointer to abstract base class.
717 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
718
719 2011-12-18 Ian Lance Taylor <iant@google.com>
720
721 * object.h (Relobj::local_symbol_value): New function.
722 (Relobj::local_plt_offset): New function.
723 (Relobj::local_has_got_offset): New function.
724 (Relobj::local_got_offset): New function.
725 (Relobj::set_local_got_offset): New function.
726 (Relobj::do_local_symbol_value): New pure virtual function.
727 (Relobj::do_local_plt_offset): Likewise.
728 (Relobj::do_local_has_got_offset): Likewise.
729 (Relobj::do_local_got_offset): Likewise.
730 (Relobj::do_set_local_got_offset): Likewise.
731 (Sized_relobj::do_local_has_got_offset): Rename from
732 local_has_got_offset.
733 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
734 (Sized_relobj::do_set_local_got_offset): Rename from
735 set_local_got_offset.
736 (Sized_relobj_file::do_local_plt_offset): Rename from
737 local_plt_offset.
738 (Sized_relobj_file::do_local_symbol_value): New function.
739 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
740 local_plt_offset.
741 * output.cc (Output_data_got::Got_entry::write): Change object to
742 Relobj. Use local_symbol_value.
743 (Output_data_got::add_global_with_rel): Change rel_dyn to
744 Output_data_reloc_generic*. Use add_global_generic.
745 (Output_data_got::add_global_with_rela): Remove. Change all
746 callers to use add_global_with_rel.
747 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
748 Output_data_reloc_generic*. Use add_global_generic.
749 (Output_data_got::add_global_pair_with_rela): Remove. Change all
750 callers to use add_global_pair_with_rel.
751 (Output_data_got::add_local): Change object to Relobj*.
752 (Output_data_got::add_local_plt): Likewise.
753 (Output_data_got::add_local_with_rel): Change object to Relobj*,
754 change rel_dyn to Output_data_reloc_generic*. Use
755 add_local_generic.
756 (Output_data_got::add_local_with_rela): Remove. Change all
757 callers to use all_local_with_rel.
758 (Output_data_got::add_local_pair_with_rel): Change object to
759 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
760 add_output_section_generic.
761 (Output_data_got::add_local_pair_with_rela): Remove. Change all
762 callers to use add_local_pair_with_rel.
763 (Output_data_got::reserve_local): Change object to Relobj*.
764 * output.h: (class Output_data_reloc_generic): Add pure virtual
765 declarations for add_global_generic, add_local_generic,
766 add_output_section_generic.
767 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
768 functions for Output_data_reloc_generic. Update declarations for
769 changes listed in output.cc.
770 (class Output_data_got): Change template parameter to got_size.
771 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
772 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
773 function.
774 (Sized_relobj_incr::do_local_plt_offset): New function.
775 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
776 add_global_generic.
777
778 2011-12-17 Cary Coutant <ccoutant@google.com>
779
780 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
781 * resolve.cc (Symbol_table::resolve): Likewise.
782 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
783 arrays.
784 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
785
786 2011-12-16 Ian Lance Taylor <iant@google.com>
787
788 * output.h (Output_data_reloc_generic::add): Only call
789 add_dynamic_reloc if this is a dynamic reloc section.
790
791 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
792
793 PR gold/13505
794 * target-reloc.h (apply_relocation): Replace <64, false> with
795 <size, big_endian>.
796
797 2011-11-25 Nick Clifton <nickc@redhat.com>
798
799 * po/it.po: New Italian translation.
800
801 2011-11-17 Sterling Augustine <saugustine@google.com>
802
803 * script.cc (script_include_directive): Implement.
804 (read_script_file): New local variables name and search_path. Update
805 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
806 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
807 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
808
809 2011-11-11 Sterling Augustine <saugustine@google.com>
810
811 * yyscript.y (section_cmd): Add support for INCLUDE directive.
812 (file_or_sections_cmd): Likewise.
813
814 2011-11-11 Doug Kwan <dougkwan@google.com>
815
816 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
817 if --just-symbols is given.
818
819 2011-11-10 Doug Kwan <dougkwan@google.com>
820
821 PR gold/13362
822 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
823 when processing data relocs.
824 * reloc.h (Relocate_functions::rel_unaligned): New method.
825 (Relocate_functions::pcrel_unaligned): Ditto.
826 (Relocate_functions::rel32_unaligned): Ditto.
827 (Relocate_functions::pcrel32_unaligned): Ditto.
828
829 2011-11-09 Doug Kwan <dougkwan@google.com>
830
831 PR gold/13362
832 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
833 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
834 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
835 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
836 (Relocate_functions::rel_unaligned): New.
837 (Relocate_functions::rel32_unaligned): New.
838 * target-reloc.h (relocate_for_relocatable): Add code to handle
839 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
840 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
841 arm_unaligned_reloc_r): New targets.
842 * testsuite/Makefile.in: Regenerate.
843 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
844 linking.
845
846 2011-11-02 Ian Lance Taylor <iant@google.com>
847
848 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
849 NATIVE_LINKER.
850 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
851 * options.cc (General_options::finalize): Use library search path
852 from configure script if specified. If not native and no sysroot,
853 only search TOOLLIBDIR.
854 * options.h (Search_directory::Search_directory): Change name to
855 const std::string&.
856 (General_options::add_to_library_path_with_sysroot): Change arg to
857 const std::string&.
858 * configure, Makefile.in, config.in: Rebuild.
859
860 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
861
862 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
863 we are working around the ARM1176 Erratum.
864 * options.h (General_options::fix_arm1176): Add option.
865 * testsuite/Makefile.am: Add testcases, and keep current ones
866 working.
867 * testsuite/Makefile.in: Regenerate.
868 * testsuite/arm_fix_1176.s: New file.
869 * testsuite/arm_fix_1176.sh: Likewise.
870
871 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
872
873 * arm.cc (Target_arm::Target_arm): Remove initialisation of
874 may_use_blx_.
875 (Target_arm::may_use_blx): Remove method.
876 (Target_arm::set_may_use_blx): Likewise.
877 (Target_arm::may_use_v4t_interworking): New method.
878 (Target_arm::may_use_v5t_interworking): Likewise.
879 (Target_arm::may_use_blx_): Remove member variable.
880 (Arm_relocate_functions::arm_branch_common): Check for v5T
881 interworking.
882 (Arm_relocate_functions::thumb_branch_common): Likewise.
883 (Reloc_stub::stub_type_for_reloc): Likewise.
884 (Target_arm::do_finalize_sections): Correct interworking checks.
885 * testsuite/Makefile.am: Add new tests.
886 * testsuite/Makefile.in: Regenerate.
887 * testsuite/arm_farcall_arm_arm.s: New test.
888 * testsuite/arm_farcall_arm_arm.sh: Likewise.
889 * testsuite/arm_farcall_arm_thumb.s: Likewise.
890 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
891 * testsuite/arm_farcall_thumb_arm.s: Likewise.
892 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
893 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
894 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
895
896 2011-10-31 Cary Coutant <ccoutant@google.com>
897
898 PR gold/13023
899 * expression.cc (Expression::eval_with_dot): Add
900 is_section_dot_assignment parameter.
901 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
902 absolute and assigning to dot within a section.
903 * script-sections.cc
904 (Output_section_element_assignment::set_section_addresses): Pass
905 dot_section to set_if_absolute.
906 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
907 as is_section_dot_assignment flag to eval_with_dot.
908 (Output_section_element_dot_assignment::set_section_addresses):
909 Likewise.
910 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
911 parameter. Also set value if relative to dot_section; set the
912 symbol's output_section.
913 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
914 parameter. Adjust all callers.
915 (Expression::eval_maybe_dot): Likewise.
916 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
917 Adjust all callers.
918 * testsuite/script_test_2.t: Test assignment of an absolute value
919 to dot within an output section element.
920
921 2011-10-31 Cary Coutant <ccoutant@google.com>
922
923 * options.h (class General_options): Add --[no-]gnu-unique options.
924 * symtab.cc (Symbol_table::sized_write_globals): Convert
925 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
926
927 2011-10-31 Cary Coutant <ccoutant@google.com>
928
929 PR gold/13359
930 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
931 unnecessary assertion.
932 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
933
934 2011-10-31 Sriraman Tallam <tmsriram@google.com>
935
936 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
937 gc_mark_symbol.
938 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
939 gc_mark_symbol.
940 Change to just keep the section associated with symbol.
941 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
942 they are externally visible and --export-dynamic is turned on.
943 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
944
945 2011-10-19 Ian Lance Taylor <iant@google.com>
946
947 PR gold/13163
948 * script-sections.cc
949 (Output_section_element_dot_assignment::needs_output_section): New
950 function.
951
952 2011-10-19 Ian Lance Taylor <iant@google.com>
953
954 PR gold/13204
955 * layout.cc (Layout::segment_precedes): Don't assert failure if a
956 --section-start option was seen.
957 * options.h (General_options::any_section_start): New function.
958
959 2011-10-18 David S. Miller <davem@davemloft.net>
960
961 PR binutils/13301
962 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
963 member to track relocation locations that have moved during TLS
964 reloc optimizations.
965 (Target_sparc::Relocate::Relocate): Initialize to NULL.
966 (Target_sparc::Relocate::relocate): Adjust view down by 4
967 bytes if it matches reloc_adjust_addr_.
968 (Target_sparc::Relocate::relocate_tls): Always move the
969 __tls_get_addr call delay slot instruction forward 4 bytes when
970 performing relaxation.
971
972 2011-10-18 Cary Coutant <ccoutant@google.com>
973
974 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
975 (Output_file::map_no_anonymous): Check for non-zero
976 return code from posix_fallocate.
977
978 2011-10-17 Cary Coutant <ccoutant@google.com>
979
980 PR gold/13245
981 * plugin.cc (is_visible_from_outside): Check for symbols
982 referenced from dynamic objects.
983 * resolve.cc (Symbol_table::resolve): Don't count references
984 from dynamic objects as references from real ELF files.
985 * testsuite/plugin_test_2.sh: Adjust expected result.
986
987 2011-10-17 Cary Coutant <ccoutant@google.com>
988
989 * gold.cc: Include timer.h.
990 (queue_middle_tasks): Stamp time.
991 (queue_final_tasks): Likewise.
992 * main.cc (main): Store timer in parameters. Print timers
993 for each pass.
994 * parameters.cc (Parameters::Parameters): Initialize timer_.
995 (Parameters::set_timer): New function.
996 (set_parameters_timer): New function.
997 * parameters.h (Parameters::set_timer): New function.
998 (Parameters::timer): New function.
999 (Parameters::timer_): New data member.
1000 (set_parameters_timer): New function.
1001 * timer.cc (Timer::stamp): New function.
1002 (Timer::get_pass_time): New function.
1003 * timer.h (Timer::stamp): New function.
1004 (Timer::get_pass_time): New function.
1005 (Timer::pass_times_): New data member.
1006
1007 2011-10-17 Cary Coutant <ccoutant@google.com>
1008
1009 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1010 task for members of lib groups.
1011
1012 2011-10-17 Cary Coutant <ccoutant@google.com>
1013
1014 PR gold/13288
1015 * fileread.cc (File_read::find_view): Add assert.
1016 (File_read::make_view): Move bounds check (replace with assert)...
1017 (File_read::find_or_make_view): ... to here.
1018
1019 2011-10-12 Cary Coutant <ccoutant@google.com>
1020
1021 * output.cc (Output_file::open_base_file): Handle case where
1022 ::read returns less than requested size.
1023
1024 2011-10-10 Cary Coutant <ccoutant@google.com>
1025
1026 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1027 Initialize defined_count_.
1028 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1029 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1030 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1031 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1032 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1033 * incremental.h (Sized_relobj_incr::defined_count_): New data
1034 member.
1035 (Sized_incr_dynobj::defined_count_): New data member.
1036 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1037 Return zeroes instead of internal error.
1038
1039 2011-10-10 Cary Coutant <ccoutant@google.com>
1040
1041 PR gold/13249
1042 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1043 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1044 * output.h (class Output_reloc): Add use_plt_offset flag.
1045 (Output_reloc::type_): Adjust size of bit field.
1046 (Output_reloc::use_plt_offset_): New bit field.
1047 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1048 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1049 flag. Adjust all callers.
1050 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1051 creating RELATIVE relocations.
1052
1053 2011-10-10 Nick Clifton <nickc@redhat.com>
1054
1055 * po/es.po: Updated Spanish translation.
1056 * po/fi.po: Updated Finnish translation.
1057
1058 2011-10-03 Diego Novillo <dnovillo@google.com>
1059
1060 * options.cc (parse_uint): Fix dereference of RETVAL.
1061
1062 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1063
1064 * layout.h (section_order_map_): New member.
1065 (get_section_order_map): New member function.
1066 * output.cc (Output_section::add_input_section): Check for patterns
1067 only when --section-ordering-file is specified.
1068 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1069 output_sections have been formed.
1070 * layout.cc (Layout_Layout): Initialize section_order_map_.
1071 * plugin.cc (update_section_order): Store order in order_map. Do not
1072 update the order.
1073 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1074 * testsuite/Makefile.in: Regenerate.
1075 * testsuite/plugin_section_order.c: New file.
1076 * testsuite/plugin_final_layout.cc: New file.
1077 * testsuite/plugin_final_layout.sh: New file.
1078
1079 2011-09-29 Cary Coutant <ccoutant@google.com>
1080
1081 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1082 Check for NULL.
1083 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1084 symbols during incremental update.
1085 (Symbol_table::add_from_dynobj): Likewise.
1086
1087 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1088 Ian Lance Taylor <iant@google.com>
1089
1090 * symtab.cc (Symbol_table::define_special_symbol): Always
1091 canonicalize version string.
1092
1093 2011-09-26 Cary Coutant <ccoutant@google.com>
1094
1095 * gold.cc (queue_initial_tasks): Move option checks ...
1096 * options.cc (General_options::finalize): ... to here. Disable
1097 some options; make others fatal.
1098
1099 2011-09-26 Cary Coutant <ccoutant@google.com>
1100
1101 gcc PR lto/47247
1102 * plugin.cc (get_symbols_v2): New function.
1103 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1104 (is_referenced_from_outside): New function.
1105 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1106 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1107 (get_symbols): Pass version parameter.
1108 (get_symbols_v2): New function.
1109 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1110 parameter.
1111 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1112 (onload): Add LDPT_GET_SYMBOLS_V2.
1113 (all_symbols_read_hook): Use get_symbols_v2; check for
1114 LDPR_PREVAILING_DEF_IRONLY_EXP.
1115 * testsuite/plugin_test_3.sh: Update expected results.
1116
1117 2011-09-23 Simon Baldwin <simonb@google.com>
1118
1119 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1120 configuration options.
1121 * configure: Regenerate.
1122 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1123 * Makefile.in: Regenerate.
1124 * testsuite/Makefile.in: Regenerate.
1125
1126 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1127
1128 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1129
1130 2011-09-19 Cary Coutant <ccoutant@google.com>
1131
1132 * incremental.cc (can_incremental_update): Fix typo in comment.
1133 * incremental.h (can_incremental_update): Likewise.
1134
1135 2011-09-18 Cary Coutant <ccoutant@google.com>
1136
1137 * incremental.cc (can_incremental_update): New function.
1138 * incremental.h (can_incremental_update): New function.
1139 * layout.cc (Layout::init_fixed_output_section): Call it.
1140 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1141 * object.cc (Sized_relobj_file::do_layout): Call
1142 can_incremental_update.
1143
1144 2011-09-13 Cary Coutant <ccoutant@google.com>
1145
1146 * configure.ac: Check for glibc support for gnu_indirect_function
1147 support with static linking, setting automake conditional
1148 IFUNC_STATIC.
1149 * Makefile.in: Regenerate.
1150 * configure: Regenerate.
1151
1152 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1153 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1154 for IFUNC_STATIC.
1155 * testsuite/Makefile.in: Regenerate.
1156
1157 2011-09-13 Cary Coutant <ccoutant@google.com>
1158
1159 * incremental.cc (Sized_relobj_incr::do_layout): Call
1160 report_comdat_group for kept comdat sections.
1161 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1162 * testsuite/Makefile.in: Regenerate.
1163 * testsuite/incr_comdat_test_1.cc: New source file.
1164 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1165 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1166 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1167
1168 2011-09-13 Ian Lance Taylor <iant@google.com>
1169
1170 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1171 variable external_symbols_offset.
1172
1173 2011-09-12 Ian Lance Taylor <iant@google.com>
1174
1175 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1176 triggered if object has no symbols.
1177
1178 2011-09-09 David S. Miller <davem@davemloft.net>
1179
1180 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1181 (Output_fill_debug_line::do_write): Likewise.
1182
1183 2011-08-29 Cary Coutant <ccoutant@google.com>
1184
1185 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1186 casts to match formatting specs.
1187 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1188
1189 2011-08-26 Cary Coutant <ccoutant@google.com>
1190
1191 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1192 remaining hole size when allocating.
1193 (Layout::make_output_section): Set fill methods for debug sections.
1194 * layout.h (Free_list::Free_list_node): Move from private to
1195 public.
1196 (Free_list::set_min_hole_size): New function.
1197 (Free_list::begin, Free_list::end): New functions.
1198 (Free_list::min_hole_): New data member.
1199 * output.cc: Include dwarf.h.
1200 (Output_fill_debug_info::do_minimum_hole_size): New function.
1201 (Output_fill_debug_info::do_write): New function.
1202 (Output_fill_debug_line::do_minimum_hole_size): New function.
1203 (Output_fill_debug_line::do_write): New function.
1204 (Output_section::Output_section): Initialize new data member.
1205 (Output_section::set_final_data_size): Ensure patch space is larger
1206 than minimum hole size.
1207 (Output_section::do_write): Fill holes in debug sections.
1208 * output.h (Output_fill): New class.
1209 (Output_fill_debug_info): New class.
1210 (Output_fill_debug_line): New class.
1211 (Output_section::set_free_space_fill): New function.
1212 (Output_section::free_space_fill_): New data member.
1213 * testsuite/Makefile.am (incremental_test_3): Add
1214 --incremental-patch option.
1215 (incremental_test_4): Likewise.
1216 (incremental_test_5): Likewise.
1217 (incremental_test_6): Likewise.
1218 (incremental_copy_test): Likewise.
1219 (incremental_common_test_1): Likewise.
1220 * testsuite/Makefile.in: Regenerate.
1221
1222 2011-08-26 Nick Clifton <nickc@redhat.com>
1223
1224 * po/es.po: Updated Spanish translation.
1225
1226 2011-08-01 Cary Coutant <ccoutant@google.com>
1227
1228 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1229 * gold/testsuite/Makefile.in: Regenerate.
1230 * gold/testsuite/justsyms_exec.c: New source file.
1231 * gold/testsuite/justsyms_lib.c: New source file.
1232
1233 2011-08-01 Cary Coutant <ccoutant@google.com>
1234
1235 * layout.cc (Layout::set_segment_offsets): Don't realign text
1236 segment if -Ttext was specified.
1237 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1238 file type.
1239 * object.h (Sized_relobj_file::e_type): New function.
1240 (Sized_relobj_file::e_type_): New data member.
1241 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1242 base address for ET_EXEC files.
1243 * target.cc (Target::do_make_elf_object_implementation): Allow
1244 ET_EXEC files with --just-symbols option.
1245
1246 2011-07-28 Cary Coutant <ccoutant@google.com>
1247
1248 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1249 Add thread_number parameter.
1250 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1251 * workqueue-threads.cc
1252 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1253 current thread if its thread number is greater than desired thread
1254 count.
1255 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1256 Add thread_number parameter.
1257 (Workqueue::should_cancel_thread): Likewise.
1258 (Workqueue::find_runnable_or_wait): Pass thread_number to
1259 should_cancel_thread.
1260 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1261 parameter.
1262
1263 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1264
1265 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1266 only after checking if it cannot be forced local.
1267 * symtab.h (is_externally_visible): Check if the symbol is not forced
1268 local.
1269
1270 2011-07-15 Ian Lance Taylor <iant@google.com>
1271
1272 * options.h (class General_options): Add --print-output-format.
1273 Move -EL next to -EB, for better --help output.
1274 * target-select.cc: Include <cstdio>, "options.h", and
1275 "parameters.h".
1276 (Target_selector::do_target_bfd_name): New function.
1277 (print_output_format): New function.
1278 * target-select.h (class Target_selector): Update declarations.
1279 (Target_selector::target_bfd_name): New function.
1280 (print_output_format): Declare.
1281 * main.cc: Include "target-select.h".
1282 (main): Handle --print-output-format.
1283 * gold.cc: Include "target-select.h".
1284 (queue_initial_tasks): Handle --print-output-format when there are
1285 no input files.
1286 * parameters.cc (parameters_force_valid_target): Give a better
1287 error message if -EB/-EL does not match target.
1288 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1289 function.
1290
1291 2011-07-15 Ian Lance Taylor <iant@google.com>
1292
1293 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1294 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1295 (Output_data_plt_i386::do_write): Write address of .dynamic
1296 section to first entry in .got.plt section.
1297 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1298 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1299 Initialize layout_.
1300 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1301 section to first entry in .got.plt section.
1302 * layout.h (Layout::dynamic_section): New function.
1303
1304 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1305
1306 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1307 to claim_file call.
1308 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1309 input_section_position_, and input_section_glob_.
1310 (read_layout_from_file): Call function section_ordering_specified.
1311 * layout.h (is_section_ordering_specified): New function.
1312 (section_ordering_specified): New function.
1313 (section_ordering_specified_): New boolean member.
1314 * main.cc(main): Call load_plugins after layout object is defined.
1315 * output.cc (Output_section::add_input_section): Use
1316 function section_ordering_specified to check if section ordering is
1317 needed.
1318 * output.cc (Output_section::add_relaxed_input_section): Use
1319 function section_ordering_specified to check if section ordering is
1320 needed.
1321 (Output_section::update_section_layout): New function.
1322 (Output_section::sort_attached_input_sections): Check if input section
1323 must be reordered.
1324 * output.h (Output_section::update_section_layout): New function.
1325 * plugin.cc (get_section_count): New function.
1326 (get_section_type): New function.
1327 (get_section_name): New function.
1328 (get_section_contents): New function.
1329 (update_section_order): New function.
1330 (allow_section_ordering): New function.
1331 (Plugin::load): Add the new interfaces to the transfer vector.
1332 (Plugin_manager::load_plugins): New parameter.
1333 (Plugin_manager::all_symbols_read): New parameter.
1334 (Plugin_manager::claim_file): New parameter. Save the elf object for
1335 unclaimed objects.
1336 (Plugin_manager::get_elf_object): New function.
1337 (Plugin_manager::get_view): Change to directly use the bool to check
1338 if get_view is called from claim_file_hook.
1339 * plugin.h (input_objects): New function
1340 (Plugin__manager::load_plugins): New parameter.
1341 (Plugin_manager::claim_file): New parameter.
1342 (Plugin_manager::get_elf_object): New function.
1343 (Plugin_manager::in_claim_file_handler): New function.
1344 (Plugin_manager::in_claim_file_handler_): New member.
1345 (layout): New function.
1346 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1347 handler with an extra parameter. Make the elf object before calling
1348 claim_file handler.
1349 * testsuite/plugin_test.c (get_section_count): New function pointer.
1350 (get_section_type): New function pointer.
1351 (get_section_name): New function pointer.
1352 (get_section_contents): New function pointer.
1353 (update_section_order): New function pointer.
1354 (allow_section_ordering): New function pointer.
1355 (onload): Check if the new interfaces exist.
1356
1357 2011-07-13 Ian Lance Taylor <iant@google.com>
1358
1359 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1360 relro section.
1361 * x86_64.cc (Target_x86_64::got_section): Likewise.
1362 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1363 (relro_now_test_SOURCES): New variable.
1364 (relro_now_test_DEPENDENCIES): New variable.
1365 (relro_now_test_LDFLAGS): New variable.
1366 (relro_now_test_LDADD): New variable.
1367 (relro_now_test.so): New target.
1368 * testsuite/Makefile.in: Rebuild.
1369
1370 2011-07-12 Ian Lance Taylor <iant@google.com>
1371
1372 PR gold/12980
1373 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1374 GLOB_DAT relocation rather than a RELATIVE relocation for a
1375 protected symbol when creating a shared library.
1376 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1377 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1378 * testsuite/protected_main_1.cc (main): Test that protected
1379 function has same address.
1380
1381 2011-07-11 Ian Lance Taylor <iant@google.com>
1382
1383 PR gold/12979
1384 * options.h (class General_options): Add -Bgroup.
1385 * options.cc (General_options::finalize): If -Bgroup is set,
1386 default to --unresolved-symbols=report-all.
1387 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1388 * target-reloc.h (issue_undefined_symbol_error): Handle
1389 --unresolved-symbols=report-all.
1390
1391 2011-07-08 Ian Lance Taylor <iant@google.com>
1392
1393 PR gold/11985
1394 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1395 if linker script discards key sections.
1396 (Layout::create_dynamic_symtab): Likewise.
1397 (Layout::assign_local_dynsym_offsets): Likewise.
1398 (Layout::sized_create_version_sections): Likewise.
1399 (Layout::create_interp): Likewise.
1400 (Layout::finish_dynamic_section): Likewise.
1401 (Layout::set_dynamic_symbol_size): Likewise.
1402
1403 2011-07-08 Ian Lance Taylor <iant@google.com>
1404
1405 PR gold/12386
1406 * options.h (class General_options): Add --unresolved-symbols.
1407 * target-reloc.h (issue_undefined_symbol_error): Check
1408 --unresolved-symbols. Add comments.
1409
1410 2011-07-08 Ian Lance Taylor <iant@google.com>
1411
1412 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1413 expression more complex.
1414
1415 2011-07-08 Ian Lance Taylor <iant@google.com>
1416
1417 PR gold/11317
1418 * target-reloc.h (issue_undefined_symbol_error): New inline
1419 function, broken out of relocate_section.
1420 (relocate_section): Call issue_undefined_symbol_error.
1421 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1422 there is no TLS segment if we are about to issue an undefined
1423 symbol error.
1424 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1425
1426 2011-07-08 Ian Lance Taylor <iant@google.com>
1427
1428 PR gold/12279
1429 * resolve.cc (Symbol_table::should_override): Add fromtype
1430 parameter. Change all callers. Give error when linking together
1431 TLS and non-TLS symbol.
1432 (Symbol_table::should_override_with_special): Add fromtype
1433 parameter. Change all callers.
1434 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1435 there is no TLS segment if we have reported some errors.
1436 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1437
1438 2011-07-08 Ian Lance Taylor <iant@google.com>
1439
1440 PR gold/12372
1441 * target.h (Target::plt_address_for_global): New function.
1442 (Target::plt_address_for_local): New function.
1443 (Target::plt_section_for_global): Remove.
1444 (Target::plt_section_for_local): Remove.
1445 (Target::do_plt_address_for_global): New virtual function.
1446 (Target::do_plt_address_for_local): New virtual function.
1447 (Target::do_plt_section_for_global): Remove.
1448 (Target::do_plt_section_for_local): Remove.
1449 (Target::register_global_plt_entry): Add Symbol_table and Layout
1450 parameters.
1451 * output.cc (Output_data_got::Got_entry::write): Use
1452 plt_address_for_global and plt_address_for_local.
1453 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1454 address of output section.
1455 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1456 got_irelative_, and irelative_count_ fields. Update
1457 declarations.
1458 (Output_data_plt_i386::has_irelative_section): New function.
1459 (Output_data_plt_i386::entry_count): Add irelative_count_.
1460 (Output_data_plt_i386::set_final_data_size): Likewise.
1461 (class Target_i386): Add got_irelative_ and rel_irelative_
1462 fields. Update declarations.
1463 (Target_i386::Target_i386): Initialize new fields.
1464 (Target_i386::do_plt_address_for_global): New function replacing
1465 do_plt_section_for_global.
1466 (Target_i386::do_plt_address_for_local): New function replacing
1467 do_plt_section_for_local.
1468 (Target_i386::got_section): Create got_irelative_.
1469 (Target_i386::rel_irelative_section): New function.
1470 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1471 fields. Don't define __rel_iplt_{start,end}.
1472 (Output_data_plt_i386::add_entry): Add symtab and layout
1473 parameters. Change all callers. Use different PLT and GOT for
1474 IFUNC symbols.
1475 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1476 layout parameters. Change all callers. Use different PLT and
1477 GOT.
1478 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1479 (Output_data_plt_i386::rel_irelative): New function.
1480 (Output_data_plt_i386::address_for_global): New function.
1481 (Output_data_plt_i386::address_for_local): New function.
1482 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1483 IRELATIVE GOT when changing IFUNC GOT entries.
1484 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1485 reloc.
1486 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1487 if we didn't create an IRELATIVE GOT.
1488 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1489 plt_address_for_local.
1490 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1491 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1492 got_irelative_, and irelative_count_ fields. Update
1493 declarations.
1494 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1495 Initialize new fields. Remove symtab parameter. Change all
1496 callers.
1497 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1498 irelative_count_.
1499 (Output_data_plt_x86_64::has_irelative_section): New function.
1500 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1501 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1502 fields. Update declarations.
1503 (Target_x86_64::Target_x86_64): Initialize new fields.
1504 (Target_x86_64::do_plt_address_for_global): New function replacing
1505 do_plt_section_for_global.
1506 (Target_x86_64::do_plt_address_for_local): New function replacing
1507 do_plt_section_for_local.
1508 (Target_x86_64::got_section): Create got_irelative_.
1509 (Target_x86_64::rela_irelative_section): New function.
1510 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1511 all callers. Don't create __rel_iplt_{start,end}.
1512 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1513 parameters. Change all callers. Use different PLT and GOT for
1514 IFUNC symbols.
1515 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1516 layout parameters. Change all callers. Use different PLT and
1517 GOT.
1518 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1519 parameters. Change all callers. Use different PLT and GOT for
1520 IFUNC symbols.
1521 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1522 (Output_data_plt_x86_64::rela_irelative): New function.
1523 (Output_data_plt_x86_64::address_for_global): New function.
1524 (Output_data_plt_x86_64::address_for_local): New function.
1525 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1526 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1527 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1528 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1529 parameters.
1530 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1531 reloc.
1532 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1533 symbols if we didn't create an IRELATIVE GOT.
1534 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1535 plt_address_for_local.
1536 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1537 * testsuite/ifuncvar1.c: New test file.
1538 * testsuite/ifuncvar2.c: New test file.
1539 * testsuite/ifuncvar3.c: New test file.
1540 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1541 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1542 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1543 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1544 * testsuite/Makefile.in: Rebuild.
1545
1546 2011-07-07 Cary Coutant <ccoutant@google.com>
1547
1548 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1549 (two_file_test_1_ndebug.o): Likewise.
1550 (two_file_test_1b_ndebug.o): Likewise.
1551 (two_file_test_2_ndebug.o): Likewise.
1552 (two_file_test_main_ndebug.o): Likewise.
1553 (incremental_test_2): Link with no-debug versions.
1554
1555 2011-07-06 Cary Coutant <ccoutant@google.com>
1556
1557 * gold/incremental.cc
1558 (Output_section_incremental_inputs::write_info_blocks): Check for
1559 hidden and internal symbols.
1560
1561 2011-07-06 Cary Coutant <ccoutant@google.com>
1562
1563 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1564 Check disposition for startup file.
1565 (Incremental_inputs::report_command_line): Ignore
1566 --incremental-startup-unchanged option.
1567 * options.cc (General_options::parse_incremental_startup_unchanged):
1568 New function.
1569 (General_options::General_options): Initialize new data member.
1570 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1571 (General_options): Add --incremental-startup-unchanged option.
1572 (General_options::incremental_startup_disposition): New function.
1573 (General_options::incremental_startup_disposition_): New data member.
1574
1575 2011-07-06 Cary Coutant <ccoutant@google.com>
1576
1577 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1578 input file index to Script_info ctor.
1579 (Sized_incremental_binary::do_file_has_changed): Find the
1580 command-line argument for files named in scripts.
1581 * incremental.h (Script_info::Script_info): New ctor
1582 with input file index.
1583 (Script_info::input_file_index): New function.
1584 (Script_info::input_file_index_): New data member.
1585 (Incremental_binary::get_library): Add const.
1586 (Incremental_binary::get_script_info): Add const.
1587 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1588 * testsuite/Makefile.am (incremental_test_5): New test case.
1589 (incremental_test_6): New test case.
1590 * testsuite/Makefile.in: Regenerate.
1591
1592 2011-07-06 Cary Coutant <ccoutant@google.com>
1593
1594 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1595 debug output when command lines differ.
1596
1597 2011-07-06 Cary Coutant <ccoutant@google.com>
1598
1599 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1600 --incremental-patch option.
1601 * layout.cc (Free_list::allocate): Extend allocation beyond original
1602 end if enabled.
1603 (Layout::make_output_section): Mark sections that should get
1604 patch space.
1605 * options.cc (parse_percent): New function.
1606 * options.h (parse_percent): New function.
1607 (DEFINE_percent): New macro.
1608 (General_options): Add --incremental-patch option.
1609 * output.cc (Output_section::Output_section): Initialize new data
1610 members.
1611 (Output_section::add_input_section): Print section name when out
1612 of patch space.
1613 (Output_section::add_output_section_data): Likewise.
1614 (Output_section::set_final_data_size): Add patch space when
1615 doing --incremental-full.
1616 (Output_section::do_reset_address_and_file_offset): Remove patch
1617 space.
1618 (Output_segment::set_section_list_addresses): Print debug output
1619 only if --incremental-update.
1620 * output.h (Output_section::set_is_patch_space_allowed): New function.
1621 (Output_section::is_patch_space_allowed_): New data member.
1622 (Output_section::patch_space_): New data member.
1623 * parameters.cc (Parameters::incremental_full): New function.
1624 * parameters.h (Parameters::incremental_full): New function
1625 * testsuite/Makefile.am (incremental_test_2): Add test for
1626 --incremental-patch option.
1627 * testsuite/Makefile.in: Regenerate.
1628 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1629 (t18): Remove function body.
1630
1631 2011-07-05 Doug Kwan <dougkwan@google.com>
1632
1633 PR gold/12771
1634 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1635 Arm_Address type for relocation result.
1636 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1637 overflow check.
1638 (Arm_relocate_functions::abs32): Use unaligned access.
1639 (Arm_relocate_functions::rel32): Ditto.
1640 (Arm_relocate_functions::prel31): Ditto.
1641 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1642 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1643 static data relocations.
1644 * testsuite/Makefile.in: Regnerate.
1645 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1646
1647 2011-07-05 Ian Lance Taylor <iant@google.com>
1648
1649 PR gold/12392
1650 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1651 symbols if necessary.
1652 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1653
1654 2011-07-05 Ian Lance Taylor <iant@google.com>
1655
1656 PR gold/12952
1657 * resolve.cc (Symbol::override_base_with_special): Simply override
1658 version with special symbol version, ignoring previous version.
1659
1660 2011-07-05 Ian Lance Taylor <iant@google.com>
1661
1662 * object.cc (Sized_relobj_file::include_section_group): Add
1663 information to comment about signature location.
1664
1665 2011-07-02 Ian Lance Taylor <iant@google.com>
1666
1667 PR gold/12957
1668 * options.h (class General_options): Add -f and -F.
1669 * options.cc (General_options::finalize): Fatal error if -f/-F
1670 are used without -shared.
1671 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1672
1673 2011-07-02 Ian Lance Taylor <iant@google.com>
1674
1675 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1676
1677 2011-07-01 Ian Lance Taylor <iant@google.com>
1678
1679 PR gold/12525
1680 PR gold/12952
1681 * resolve.cc (Symbol::override_base_with_special): Don't override
1682 the version if the overriding symbol has a different name.
1683 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1684 all callers. If we give an error about an undefined version,
1685 define the base version if necessary.
1686 * dynobj.h (class Versions): Update declaration.
1687 * testsuite/weak_alias_test_5.cc: New file.
1688 * testsuite/weak_alias_test.script: New file.
1689 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1690 and versioned_alias have the right value, and call t2.
1691 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1692 weak_alias_test_5.so.
1693 (weak_alias_test_LDADD): Likewise.
1694 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1695 * testsuite/Makefile.in: Rebuild.
1696
1697 2011-07-01 Ian Lance Taylor <iant@google.com>
1698
1699 PR gold/12525
1700 * options.h (class General_options): Support -z notext.
1701 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1702 -Wl,-z,notext.
1703 (two_file_shared_nonpic.so): Likewise.
1704 (two_file_shared_mixed.so): Likewise.
1705 (two_file_shared_mixed_1.so): Likewise.
1706 (weak_undef_lib_nonpic.so): Likewise.
1707 (alt/weak_undef_lib_nonpic.so): Likewise.
1708 (tls_test_shared_nonpic.so): Likewise.
1709 * testsuite/Makefile.in: Rebuild.
1710
1711 2011-07-01 Ian Lance Taylor <iant@google.com>
1712
1713 PR gold/12525
1714 * configure.ac: Test whether static linking works, setting
1715 the automake conditional HAVE_STATIC.
1716 * testsuite/Makefile.am: Disable tests using -static if
1717 HAVE_STATIC is not true.
1718 * configure, testsuite/Makefile.in: Rebuild.
1719
1720 2011-07-01 Ian Lance Taylor <iant@google.com>
1721
1722 PR gold/12525
1723 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1724 Assert if we see DW_EH_PE_indirect.
1725 * target.h (Target::ehframe_datarel_base): New function.
1726 (Target::do_ehframe_datarel_base): New target function.
1727 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1728 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1729 function.
1730
1731 2011-07-01 Ian Lance Taylor <iant@google.com>
1732
1733 PR gold/12571
1734 * options.h (class General_options): Add
1735 --ld-generated-unwind-info.
1736 * ehframe.cc (Fde::write): Add address parameter. Change all
1737 callers. If associated with PLT, fill in address and size.
1738 (Cie::set_output_offset): Only add merge mapping if there is an
1739 object.
1740 (Cie::write): Add address parameter. Change all callers.
1741 (Eh_frame::add_ehframe_for_plt): New function.
1742 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1743 input_offset_ fields into union u_, with new plt field.
1744 (Fde::Fde): Adjust for new union field.
1745 (Fde::Fde) [Output_data version]: New constructor.
1746 (Fde::add_mapping): Only add merge mapping if there is an object.
1747 (class Cie): Update declarations.
1748 (class Eh_frame): Declare add_ehframe_for_plt.
1749 * layout.cc (Layout::layout_eh_frame): Break out code into
1750 make_eh_frame_section, and call it.
1751 (Layout::make_eh_frame_section): New function.
1752 (Layout::add_eh_frame_for_plt): New function.
1753 * layout.h (class Layout): Update declarations.
1754 * merge.cc (Merge_map::add_mapping): Add assertion.
1755 * i386.cc: Include "dwarf.h".
1756 (class Output_data_plt_i386): Make first_plt_entry,
1757 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1758 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1759 and plt_eh_frame_fde.
1760 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1761 boundary. Call add_eh_frame_for_plt if appropriate.
1762 * x86_64.cc: Include "dwarf.h".
1763 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1764 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1765 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1766 and plt_eh_frame_fde.
1767 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1768 appropriate.
1769
1770 2011-06-29 Ian Lance Taylor <iant@google.com>
1771
1772 PR gold/12629
1773 * object.cc (Sized_relobj_file::layout_section): Change shdr
1774 parameter to be const.
1775 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1776 out of do_layout.
1777 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1778 appropriate. Call layout_eh_frame_section.
1779 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1780 sections.
1781 * object.h (class Sized_relobj_file): Update declarations.
1782
1783 2011-06-29 Ian Lance Taylor <iant@google.com>
1784
1785 PR gold/12652
1786 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1787 modifier.
1788 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1789
1790 2011-06-29 Ian Lance Taylor <iant@google.com>
1791
1792 PR gold/12675
1793 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1794 SHT_X86_64_UNWIND.
1795 * layout.cc (Layout::layout_eh_frame): Likewise.
1796
1797 2011-06-29 Ian Lance Taylor <iant@google.com>
1798
1799 PR gold/12695
1800 * layout.cc (Layout::symtab_section_shndx): New function.
1801 * layout.h (class Layout): Declare symtab_section_shndx.
1802 * output.cc (Output_section::write_header): Call it.
1803
1804 2011-06-29 Ian Lance Taylor <iant@google.com>
1805
1806 PR gold/12818
1807 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1808 symbols which are not used in a relocation.
1809
1810 2011-06-28 Ian Lance Taylor <iant@google.com>
1811
1812 PR gold/12898
1813 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1814 script create indistinguishable segments.
1815 (Layout::set_segment_offsets): Use stable_sort when sorting
1816 segments. Pass this to Compare_segments constructor.
1817 * layout.h (class Layout): Make segment_precedes non-static.
1818 (class Compare_segments): Change from struct to class. Add
1819 layout_ field. Add constructor.
1820 * script-sections.cc
1821 (Script_sections::attach_sections_using_phdrs_clause): Rename
1822 local orphan to is_orphan. Don't report failure to put empty
1823 section in segment. On attachment failure, report name of
1824 section, and attach to first PT_LOAD segment.
1825
1826 2011-06-28 Ian Lance Taylor <iant@google.com>
1827
1828 PR gold/12934
1829 * target-select.cc (Target_selector::Target_selector): Add
1830 emulation parameter. Change all callers.
1831 (select_target_by_bfd_name): Rename from select_target_by_name.
1832 Change all callers.
1833 (select_target_by_emulation): New function.
1834 (supported_emulation_names): New function.
1835 * target-select.h (class Target_selector): Add emulation_ field.
1836 Update declarations.
1837 (Target_selector::recognize_by_bfd_name): Rename from
1838 recognize_by_name. Change all callers.
1839 (Target_selector::supported_bfd_names): Rename from
1840 supported_names. Change all callers.
1841 (Target_selector::recognize_by_emulation): New function.
1842 (Target_selector::supported_emulations): New function.
1843 (Target_selector::emulation): New function.
1844 (Target_selector::do_recognize_by_bfd_name): Rename from
1845 do_recognize_by_name. Change all callers.
1846 (Target_selector::do_supported_bfd_names): Rename from
1847 do_supported_names. Change all callers.
1848 (Target_selector::do_recognize_by_emulation): New function.
1849 (Target_selector::do_supported_emulations): New function.
1850 (select_target_by_bfd_name): Change name in declaration.
1851 (select_target_by_emulation): Declare.
1852 (supported_emulation_names): Declare.
1853 * parameters.cc (parameters_force_valid_target): Try to find
1854 target based on emulation from -m option.
1855 * options.h (class General_options): Change doc string for -m.
1856 * options.cc (help): Print emulations.
1857 (General_options::parse_V): Likewise.
1858 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1859 Add emulation parameter. Change all callers.
1860
1861 2011-06-28 Ian Lance Taylor <iant@google.com>
1862
1863 * target.h (class Target): Add osabi_ field.
1864 (Target::osabi): New function.
1865 (Target::set_osabi): New function.
1866 (Target::Target): Initialize osabi_.
1867 (Target::do_adjust_elf_header): Make pure virtual.
1868 (Sized_target::do_adjust_elf_header): Declare.
1869 * target.cc (Sized_target::do_adjust_elf_header): New function.
1870 (class Sized_target): Instantiate all versions.
1871 * freebsd.h (class Target_freebsd): Remove.
1872 (Target_selector_freebsd::do_recognize): Call set_osabi on
1873 Target.
1874 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1875 (Target_selector_freebsd::set_osabi): Remove.
1876 * i386.cc (class Target_i386): Inherit from Sized_target rather
1877 than Target_freebsd.
1878 * x86_64.cc (class Target_x86_64): Likewise.
1879
1880 2011-06-28 Ian Lance Taylor <iant@google.com>
1881
1882 * target.h (Target::can_check_for_function_pointers): Rewrite.
1883 Make non-virtual.
1884 (Target::can_icf_inline_merge_sections): Likewise.
1885 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1886 (Target::Target_info): Add can_icf_inline_merge_sections field.
1887 (Target::do_can_check_for_function_pointers): New virtual
1888 function.
1889 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1890 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1891 from can_check_for_function_pointers, move in file.
1892 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1893 section_may_have_icf_unsafe_poineters, move in file.
1894 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1895 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1896 Rename from can_check_for_function_pointers, move in file.
1897 (Target_i386::can_icf_inline_merge_sections): Remove.
1898 (Target_i386::i386_info): Initialize
1899 can_icf_inline_merge_sections.
1900 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1901 Initialize can_icf_inline_merge_sections.
1902 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1903 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1904 Rename from can_check_for_function_pointers, move in file.
1905 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1906 (Target_x86_64::x86_64_info): Initialize
1907 can_icf_inline_merge_sections.
1908 * testsuite/testfile.cc (Target_test::test_target_info):
1909 Likewise.
1910 * icf.cc (get_section_contents): Correct formatting.
1911
1912 2011-06-27 Ian Lance Taylor <iant@google.com>
1913
1914 * symtab.cc (Symbol::versioned_name): New function.
1915 (Symbol_table::add_to_final_symtab): Use versioned_name when
1916 appropriate.
1917 (Symbol_table::sized_write_symbol): Likewise.
1918 * symtab.h (class Symbol): Declare versioned_name.
1919 * stringpool.h (class Stringpool_template): Add variant of add
1920 which takes a std::basic_string.
1921 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1922 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1923 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1924 (ver_test_12.o): New target.
1925 * testsuite/Makefile.in: Rebuild.
1926
1927 2011-06-27 Doug Kwan <dougkwan@google.com>
1928
1929 * arm.cc (Arm_relocate_functions::thm_jump8,
1930 Arm_relocate_functions::thm_jump11): Use a wider signed
1931 type to compute offset.
1932 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1933 arm_thm_jump8.
1934 * testsuite/Makefile.in: Regenerate.
1935 * testsuite/arm_branch_in_range.sh: Check test results of
1936 arm_thm_jump11 and arm_thm_jump8.
1937 * testsuite/arm_thm_jump11.s: New test source file.
1938 * testsuite/arm_thm_jump11.t: New linker script.
1939 * testsuite/arm_thm_jump8.s: New test source file.
1940 * testsuite/arm_thm_jump8.t: New linker script.
1941
1942 2011-06-24 Ian Lance Taylor <iant@google.com>
1943
1944 * layout.cc: Include "object.h".
1945 (ctors_sections_in_init_array): New static variable.
1946 (Layout::is_ctors_in_init_array): New function.
1947 (Layout::layout): Add entry to ctors_sections_in_init_array if
1948 appropriate.
1949 * layout.h (class Layout): Declare is_ctors_in_init_array.
1950 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1951 is_ctors_reverse_view is set.
1952 (Sized_relobj_file::write_sections): Add layout parameter. Change
1953 all callers. Set is_ctors_reverse_view field of View_size.
1954 (Sized_relobj_file::reverse_words): New function.
1955 * object.h (Sized_relobj_file::View_size): Add
1956 is_ctors_reverse_view field.
1957 (class Sized_relobj_file): Update declarations.
1958 * testsuite/initpri3.c: New test.
1959 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1960 initpri3b.
1961 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1962 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1963 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1964 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1965 * testsuite/Makefile.in: Rebuild.
1966
1967 2011-06-24 Cary Coutant <ccoutant@google.com>
1968
1969 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1970 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1971 (debug_msg_cdebug.err): New targets.
1972 * testsuite/Makefile.in: Regenerate.
1973 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1974 Fix checks for link with shared library.
1975
1976 2011-06-24 Doug Kwan <dougkwan@google.com>
1977
1978 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1979 skip empty text sections.
1980 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1981
1982 2011-06-22 Ian Lance Taylor <iant@google.com>
1983
1984 PR gold/12910
1985 * options.h (class General_options): Add --ctors-in-init-array.
1986 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1987 friends as SHT_PROGBITS for merging sections.
1988 (Layout::layout): Remove special handling of .init_array and
1989 friends. Don't sort if doing relocatable link. Sort for .ctors
1990 and .dtors if ctors_in_init_array.
1991 (Layout::make_output_section): Force correct section types for
1992 .init_array and friends. Don't sort if doing relocatable link,
1993 Don't sort .ctors and .dtors if ctors_in_init_array.
1994 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1995 (Layout::output_section_name): Add relobj parameter. Change all
1996 callers. Handle .ctors. and .dtors. in code rather than table.
1997 Handle .ctors and .dtors if ctors_in_init_array.
1998 (Layout::match_file_name): New function, moved from output.cc.
1999 * layout.h (class Layout): Update declarations.
2000 * output.cc: Include "layout.h".
2001 (Input_section_sort_entry::get_priority): New function.
2002 (Input_section_sort_entry::match_file_name): Just call
2003 Layout::match_file_name.
2004 (Output_section::Input_section_sort_init_fini_compare::operator()):
2005 Handle .ctors and .dtors. Sort by explicit priority rather than
2006 by name.
2007 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2008 * testsuite/initpri2.c: New test.
2009 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2010 (check_PROGRAMS): Add initpri2.
2011 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2012 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2013 * configure, testsuite/Makefile.in: Rebuild.
2014
2015 2011-06-19 Ian Lance Taylor <iant@google.com>
2016
2017 PR gold/12880
2018 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2019 .interp section to a PT_INTERP segment even if we have seen a
2020 --dynamic-linker option. Don't do it if we have seen a PHDRS
2021 clause in a linker script.
2022 (Layout::finalize): Don't create a .interp section if we've
2023 already create a PT_INTERP segment.
2024 (Layout::create_interp): Always call choose_output_section (revert
2025 patch of 2011-06-17). Don't create PT_INTERP segment.
2026 * script-sections.cc
2027 (Script_sections::create_note_and_tls_segments): Add a .interp
2028 section to a PT_INTERP segment even if we have seen a
2029 --dynamic-linker option.
2030
2031 2011-06-18 Ian Lance Taylor <iant@google.com>
2032
2033 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2034 merely because a non-PT_LOAD segment has a dynamic reloc.
2035
2036 2011-06-18 Ian Lance Taylor <iant@google.com>
2037
2038 * layout.cc (Layout::finish_dynamic_section): Don't create
2039 DT_FLAGS entry if not needed.
2040
2041 2011-06-18 Ian Lance Taylor <iant@google.com>
2042
2043 PR gold/12745
2044 * layout.cc (Layout::layout_eh_frame): Correct handling of
2045 writable .eh_frame section.
2046
2047 2011-06-17 Ian Lance Taylor <iant@google.com>
2048
2049 PR gold/12893
2050 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2051 symbol is redefined with the exact same object and value.
2052
2053 2011-06-17 Ian Lance Taylor <iant@google.com>
2054
2055 PR gold/12880
2056 * layout.h (class Layout): Add interp_segment_ field.
2057 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2058 (Layout::attach_allocated_section_to_segment): If making shared
2059 library, put .interp section in PT_INTERP segment.
2060 (Layout::finalize): Also call create_interp if -dynamic-linker
2061 option was used.
2062 (Layout::create_interp): Assert that there is no PT_INTERP
2063 segment. If not using a SECTIONS clause, use make_output_section.
2064 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2065 * script-sections.cc
2066 (Script_sections::create_note_and_tls_segments): If making shared
2067 library, put .interp section in PT_INTERP segment.
2068
2069 2011-06-17 Ian Lance Taylor <iant@google.com>
2070
2071 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2072 when making a shared library.
2073
2074 2011-06-17 Ian Lance Taylor <iant@google.com>
2075
2076 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2077 parameter. Change all callers. Don't issue warning about PC32
2078 against locally defined symbol.
2079
2080 2011-06-16 Ian Lance Taylor <iant@google.com>
2081
2082 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2083 occurs in same object.
2084
2085 2011-06-14 Alan Modra <amodra@gmail.com>
2086
2087 * po/POTFILES.in: Regenerate.
2088
2089 2011-06-09 Ian Lance Taylor <iant@google.com>
2090
2091 * script-sections.cc
2092 (Orphan_output_section::set_section_addresses): For a relocatable
2093 link set address to 0.
2094
2095 2011-06-09 Cary Coutant <ccoutant@google.com>
2096
2097 PR gold/12804
2098 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2099 used with --compress-debug-sections.
2100 * gold/object.cc (Sized_relobj_file::do_layout): Report
2101 uncompressed size of compressed input sections.
2102
2103 2011-06-08 Cary Coutant <ccoutant@google.com>
2104
2105 PR gold/12804
2106 * testsuite/two_file_test_2_v1.cc: Change initialization of
2107 v2 to keep it in .data.
2108
2109 2011-06-07 Cary Coutant <ccoutant@google.com>
2110
2111 * common.cc (Symbol_table::do_allocate_commons_list): Call
2112 gold_fallback.
2113 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2114 (Errors::fallback): New function.
2115 (gold_fallback): New function.
2116 * errors.h (Errors::fallback): New function.
2117 * gold.cc (gold_exit): Change status parameter to enum; adjust
2118 all callers.
2119 (queue_initial_tasks): Call gold_fallback.
2120 * gold.h: Include cstdlib.
2121 (Exit_status): New enum type.
2122 (gold_exit): Change status parameter to enum.
2123 (gold_fallback): New function.
2124 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2125 (Layout::create_symtab_sections): Likewise.
2126 (Layout::create_shdrs): Likewise.
2127 * main.cc (main): Adjust call to gold_exit.
2128 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2129 (Output_data_got::add_got_entry_pair): Likewise.
2130 (Output_section::add_input_section): Likewise.
2131 (Output_section::add_output_section_data): Likewise.
2132 (Output_segment::set_section_list_addresses): Likewise.
2133 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2134
2135 2011-06-07 Cary Coutant <ccoutant@google.com>
2136
2137 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2138 for incremental links.
2139 * output.cc (Output_segment::set_section_list_addresses): Remove
2140 FIXME and test for TLS or BSS.
2141
2142 2011-06-07 Cary Coutant <ccoutant@google.com>
2143
2144 * testsuite/Makefile.am: Add incremental_copy_test,
2145 incremental_common_test_1.
2146 * testsuite/Makefile.in: Regenerate.
2147 * testsuite/common_test_1_v1.c: New source file.
2148 * testsuite/common_test_1_v2.c: New source file.
2149 * testsuite/copy_test_v1.cc: New source file.
2150
2151 2011-06-07 Cary Coutant <ccoutant@google.com>
2152
2153 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2154 update, allocate common from bss section's free list.
2155 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2156 linker-defined symbols.
2157 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2158 Skip GOT and PLT entries that are no longer referenced.
2159 (Output_section_incremental_inputs::write_info_blocks): Mark
2160 linker-defined symbols.
2161 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2162 * output.cc (Output_section::allocate): New function.
2163 * output.h (Output_section::allocate): New function.
2164 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2165 linker-defined symbols.
2166 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2167 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2168 (Symbol::init_base_output_data): Likewise.
2169 (Symbol::init_base_output_segment): Likewise.
2170 (Symbol::init_base_constant): Likewise.
2171 (Sized_symbol::init_output_data): Likewise.
2172 (Sized_symbol::init_output_segment): Likewise.
2173 (Sized_symbol::init_constant): Likewise.
2174 (Symbol_table::do_define_in_output_data): Likewise.
2175 (Symbol_table::do_define_in_output_segment): Likewise.
2176 (Symbol_table::do_define_as_constant): Likewise.
2177 * symtab.h (Symbol::is_predefined): New function.
2178 (Symbol::init_base_output_data): Add is_predefined parameter.
2179 (Symbol::init_base_output_segment): Likewise.
2180 (Symbol::init_base_constant): Likewise.
2181 (Symbol::is_predefined_): New data member.
2182 (Sized_symbol::init_output_data): Add is_predefined parameter.
2183 (Sized_symbol::init_output_segment): Likewise.
2184 (Sized_symbol::init_constant): Likewise.
2185 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2186
2187 2011-06-07 Cary Coutant <ccoutant@google.com>
2188
2189 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2190 instead of emit_copy_reloc.
2191 (Copy_relocs::emit_copy_reloc): Refactor.
2192 (Copy_relocs::make_copy_reloc): New function.
2193 (Copy_relocs::add_copy_reloc): Remove.
2194 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2195 section.
2196 (Copy_relocs::make_copy_reloc): New function.
2197 (Copy_relocs::add_copy_reloc): Remove.
2198 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2199 unchanged input files.
2200 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2201 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2202 Reserve BSS space for COPY relocations.
2203 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2204 (Output_section_incremental_inputs::write_info_blocks): Record
2205 whether a symbol is copied from a shared object.
2206 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2207 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2208 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2209 (Incremental_input_entry_reader::get_output_symbol_index): Add
2210 is_copy parameter.
2211 (Incremental_binary::emit_copy_relocs): New function.
2212 (Incremental_binary::do_emit_copy_relocs): New function.
2213 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2214 new data member.
2215 (Sized_incremental_binary::add_copy_reloc): New function.
2216 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2217 (Sized_incremental_binary::Copy_reloc): New struct.
2218 (Sized_incremental_binary::Copy_relocs): New typedef.
2219 (Sized_incremental_binary::copy_relocs_): New data member.
2220 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2221 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2222 * target.h (Sized_target::emit_copy_reloc): New function.
2223 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2224
2225 2011-06-02 Cary Coutant <ccoutant@google.com>
2226
2227 PR gold/12163
2228 * gold/archive.cc (Archive::Archive): Initialize new data member.
2229 (Archive::include_all_members): Return if archive has already been
2230 included.
2231 * gold/archive.h (Archive::include_all_members_): New data member.
2232
2233 2011-06-02 Nick Clifton <nickc@redhat.com>
2234
2235 * dynobj.h: Fix spelling mistake in comment.
2236 * output.cc: Likewise.
2237
2238 2011-05-31 Doug Kwan <dougkwan@google.com>
2239 Asier Llano
2240
2241 PR gold/12826
2242 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2243 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2244 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2245 redundant arm_exidx_test.so.
2246 * testsuite/Makefile.in: Regenerate.
2247 (check_SCRIPTS): Add pr12826.sh
2248 (check_DATA): Add pr12826.stdout
2249 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2250 * testsuite/pr12826.sh: New file.
2251 * testsuite/pr12826_1.s: Ditto.
2252 * testsuite/pr12826_1.s: Ditto.
2253
2254 2011-05-30 Ian Lance Taylor <iant@google.com>
2255
2256 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2257 sections.
2258
2259 2011-05-29 Ian Lance Taylor <iant@google.com>
2260
2261 PR gold/12804
2262 * testsuite/Makefile.am: Use different file name for two_file_test
2263 temporary file for each incremental test.
2264 * testsuite/Makefile.in: Rebuild.
2265
2266 2011-05-29 Ian Lance Taylor <iant@google.com>
2267
2268 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2269 binary input file is empty.
2270
2271 2011-05-27 Ian Lance Taylor <iant@google.com>
2272
2273 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2274 (ver_test_9.so): Likewise.
2275 * testsuite/Makefile.in: Rebuild.
2276
2277 2011-05-26 Cary Coutant <ccoutant@google.com>
2278
2279 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2280 * incremental.cc (Incremental_inputs::report_input_section): Fix
2281 comment, indentation.
2282 (Incremental_inputs::report_comdat_group): New function.
2283 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2284 of data for incremental input file entry.
2285 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2286 group count, COMDAT group signatures.
2287 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2288 an unchanged input file.
2289 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2290 Initialize new data member.
2291 (Incremental_object_entry::add_comdat_group): New function.
2292 (Incremental_object_entry::get_comdat_group_count): New function.
2293 (Incremental_object_entry::get_comdat_signature_key): New function.
2294 (Incremental_object_entry::groups_): New data member.
2295 (Incremental_inputs::report_comdat_group): New function.
2296 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2297 data for incremental input file entry.
2298 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2299 (Incremental_input_entry_reader::get_input_section): Adjust size of
2300 data for incremental input file entry.
2301 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2302 (Incremental_input_entry_reader::get_comdat_group_signature): New
2303 function.
2304 * object.cc (Sized_relobj::include_section_group): Report kept
2305 COMDAT groups for incremental links.
2306
2307 2011-05-24 David Meyer <pdox@google.com>
2308
2309 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2310 with name parameter. Add found_name parameter.
2311 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2312 * dirsearch.h (class Dirsearch): Update declaration.
2313
2314 2011-05-24 Ian Lance Taylor <iant@google.com>
2315
2316 * archive.cc (Library_base::should_include_member): Pull in object
2317 from archive if it defines the entry symbol.
2318 * parameters.cc (Parameters::entry): New function.
2319 * parameters.h (class Parameters): Declare entry.
2320 * output.h (class Output_file_header): Remove entry_ field.
2321 * output.cc (Output_file_header::Output_file_header): Remove entry
2322 parameter. Change all callers.
2323 (Output_file_header::entry): Use parameters->entry.
2324 * gold.cc (queue_middle_tasks): Likewise.
2325 * plugin.cc (Plugin_hook::run): Likewise.
2326
2327 2011-05-24 Cary Coutant <ccoutant@google.com>
2328
2329 * gold.cc (queue_initial_tasks): Pass incremental base filename
2330 to Output_file::open_base_file; don't print error message.
2331 * incremental-dump.cc (main): Adjust call to
2332 Output_file::open_for_modification.
2333 * incremental-dump.cc (main): Likewise.
2334 * incremental.cc (Incremental_inputs::report_command_line):
2335 Ignore --incremental-base option when comparing command lines.
2336 Ignore parameter when given as separate argument.
2337 * options.h (class General_options): Add --incremental-base.
2338 * output.cc (Output_file::Output_file):
2339 (Output_file::open_base_file): Add base_name and writable parameters;
2340 read base file into new file; print error message here.
2341 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2342 callers.
2343 * output.h (Output_file::open_for_modification): Rename to...
2344 (Output_file::open_base_file): ...this; add base_name and
2345 writable parameters; adjust all callers.
2346 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2347 callers.
2348 * testsuite/Makefile.am (incremental_test_4): Test
2349 --incremental-base.
2350 * testsuite/Makefile.in: Regenerate.
2351
2352 2011-05-24 Cary Coutant <ccoutant@google.com>
2353
2354 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2355 incremental_test_4.
2356 * testsuite/Makefile.in: Regenerate.
2357 * testsuite/two_file_test_1_v1.cc: New test source file.
2358 * testsuite/two_file_test_1b_v1.cc: New test source file.
2359 * testsuite/two_file_test_2_v1.cc: New test source file.
2360
2361 2011-05-24 Cary Coutant <ccoutant@google.com>
2362
2363 * dynobj.h (Dynobj::do_dynobj): New function.
2364 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2365 flag and soname for shared objects.
2366 * incremental.cc (Incremental_inputs::report_object): Make
2367 either Incremental_object_entry or Incremental_dynobj_entry; add
2368 soname to string table.
2369 (Incremental_inputs::report_input_section): Add assertion.
2370 (Output_section_incremental_inputs::set_final_data_size): Adjust
2371 type of input file entry for shared libraries; adjust size of
2372 shared library info entry.
2373 (Output_section_incremental_inputs::write_input_files): Write
2374 as_needed flag for shared libraries.
2375 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2376 of input file entry for shared libraries; write soname.
2377 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2378 soname from incremental info.
2379 * incremental.h (enum Incremental_input_flags): Add
2380 INCREMENTAL_INPUT_AS_NEEDED.
2381 (Incremental_input_entry::Incremental_input_entry): Initialize new
2382 data member.
2383 (Incremental_input_entry::set_as_needed): New function.
2384 (Incremental_input_entry::as_needed): New function.
2385 (Incremental_input_entry::do_dynobj_entry): New function.
2386 (Incremental_input_entry::as_needed_): New data member.
2387 (Incremental_object_entry::Incremental_object_entry): Don't check
2388 for shared library.
2389 (Incremental_object_entry::do_type): Likewise.
2390 (class Incremental_dynobj_entry): New class.
2391 (Incremental_input_entry_reader::as_needed): New function.
2392 (Incremental_input_entry_reader::get_soname): New function.
2393 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2394 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2395 size of shared library info entry.
2396 * layout.cc (Layout::finish_dynamic_section): Don't test for
2397 incremental link when adding DT_NEEDED entries.
2398 * object.h (Object::Object): Initialize new data member.
2399 (Object::dynobj): New function.
2400 (Object::set_as_needed): New function.
2401 (Object::as_needed): New function.
2402 (Object::do_dynobj): New function.
2403 (Object::as_needed_): New data member.
2404
2405 2011-05-24 Cary Coutant <ccoutant@google.com>
2406
2407 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2408 info; adjust display of GOT entries.
2409 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2410 vector of input objects; remove file_status_.
2411 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2412 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2413 got_plt reader; call target hooks to reserve GOT entries.
2414 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2415 of input file info header and GOT info entry.
2416 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2417 relocation info.
2418 (Got_plt_view_info::got_descriptor): Remove.
2419 (Got_plt_view_info::sym_index): New data member.
2420 (Got_plt_view_info::input_index): New data member.
2421 (Local_got_offset_visitor::visit): Write input file index.
2422 (Global_got_offset_visitor::visit): Write 0 for input file index.
2423 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2424 with sym_index and input_index.
2425 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2426 incremental info GOT entry; replace got_descriptor with input_index.
2427 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2428 map from input file index to object.
2429 (Sized_relobj_incr::do_layout): Replace direct data member reference
2430 with accessor function.
2431 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2432 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2433 Adjust size of input file info header.
2434 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2435 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2436 (Incremental_input_entry_reader::get_input_section): Adjust size of
2437 input file info header.
2438 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2439 of incremental info GOT entry.
2440 (Incremental_got_plt_reader::get_got_desc): Remove.
2441 (Incremental_got_plt_reader::get_got_symndx): New function.
2442 (Incremental_got_plt_reader::get_got_input_index): New function.
2443 (Sized_incremental_binary::Sized_incremental_binary): Remove
2444 file_status_; add input_objects_.
2445 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2446 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2447 (Sized_incremental_binary::file_is_unchanged): Remove.
2448 (Sized_incremental_binary::set_input_object): New function.
2449 (Sized_incremental_binary::input_object): New function.
2450 (Sized_incremental_binary::file_status_): Remove.
2451 (Sized_incremental_binary::input_objects_): New data member.
2452 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2453 references.
2454 (Sized_relobj_incr::invalid_address): Move to base class.
2455 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2456 class.
2457 (Sized_relobj_incr::do_output_section_offset): Likewise.
2458 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2459 (Sized_relobj_incr::section_offsets_): Likewise.
2460 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2461 function.
2462 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2463 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2464 with accessor function.
2465 (Sized_relobj_file::do_layout): Likewise.
2466 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2467 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2468 (Sized_relobj_file::compute_final_local_value): Replace refs to
2469 section_offsets_ with accessor function.
2470 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2471 * object.h (Relobj::Relobj): Initialize new data members.
2472 (Relobj::add_dyn_reloc): New function.
2473 (Relobj::first_dyn_reloc): New function.
2474 (Relobj::dyn_reloc_count): New function.
2475 (Relobj::first_dyn_reloc_): New data member.
2476 (Relobj::dyn_reloc_count_): New data member.
2477 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2478 references.
2479 (Sized_relobj::Address): New typedef.
2480 (Sized_relobj::invalid_address): Move here from child class.
2481 (Sized_relobj::Sized_relobj): Initialize new data members.
2482 (Sized_relobj::sized_relobj): New function.
2483 (Sized_relobj::is_output_section_offset_invalid): Move here from
2484 child class.
2485 (Sized_relobj::get_output_section_offset): Likewise.
2486 (Sized_relobj::local_has_got_offset): Likewise.
2487 (Sized_relobj::local_got_offset): Likewise.
2488 (Sized_relobj::set_local_got_offset): Likewise.
2489 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2490 (Sized_relobj::clear_got_offsets): New function.
2491 (Sized_relobj::section_offsets): Move here from child class.
2492 (Sized_relobj::do_output_section_offset): Likewise.
2493 (Sized_relobj::do_set_section_offset): Likewise.
2494 (Sized_relobj::Local_got_offsets): Likewise.
2495 (Sized_relobj::local_got_offsets_): Likewise.
2496 (Sized_relobj::section_offsets_): Likewise.
2497 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2498 references.
2499 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2500 class.
2501 (Sized_relobj_file::sized_relobj): New function
2502 (Sized_relobj_file::local_has_got_offset): Move to base class.
2503 (Sized_relobj_file::local_got_offset): Likewise.
2504 (Sized_relobj_file::set_local_got_offset): Likewise.
2505 (Sized_relobj_file::get_output_section_offset): Likewise.
2506 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2507 (Sized_relobj_file::do_output_section_offset): Likewise.
2508 (Sized_relobj_file::do_set_section_offset): Likewise.
2509 (Sized_relobj_file::Local_got_offsets): Likewise.
2510 (Sized_relobj_file::local_got_offsets_): Likewise.
2511 (Sized_relobj_file::section_offsets_): Likewise.
2512 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2513 (all constructors).
2514 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2515 (Output_reloc::get_symbol_index): Likewise.
2516 (Output_reloc::local_section_offset): Likewise.
2517 (Output_reloc::get_address): Likewise.
2518 (Output_reloc::symbol_value): Likewise.
2519 (Output_data_got::reserve_slot): Move to class definition.
2520 (Output_data_got::reserve_local): New function.
2521 (Output_data_got::reserve_slot_for_global): Remove.
2522 (Output_data_got::reserve_global): New function.
2523 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2524 (all constructors, two instantiations).
2525 (Output_reloc::get_relobj): New function (two instantiations).
2526 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2527 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2528 (Output_data_reloc::add_global): Adjust type of relobj.
2529 (Output_data_reloc::add_global_relative): Likewise.
2530 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2531 (Output_data_reloc::add_local): Likewise.
2532 (Output_data_reloc::add_local_relative): Likewise.
2533 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2534 (Output_data_reloc::add_local_section): Likewise.
2535 (Output_data_reloc::add_output_section): Likewise.
2536 (Output_data_reloc::add_absolute): Likewise.
2537 (Output_data_reloc::add_target_specific): Likewise.
2538 (Output_data_got::reserve_slot): Move definition here.
2539 (Output_data_got::reserve_local): New function.
2540 (Output_data_got::reserve_global): New function.
2541 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2542 section_offsets_ with accessor function.
2543 (Sized_relobj_file::write_sections): Likewise.
2544 (Sized_relobj_file::do_relocate_sections): Likewise.
2545 * target.h (Sized_target::reserve_local_got_entry): New function.
2546 (Sized_target::reserve_global_got_entry): New function.
2547 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2548 (Target_x86_64::reserve_global_got_entry): New function.
2549 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2550
2551 2011-05-23 Cary Coutant <ccoutant@google.com>
2552
2553 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2554 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2555 bit when checking got_type.
2556 * incremental.cc (Sized_incremental_binary::setup_readers):
2557 Store symbol table and string table locations; initialize bit vector
2558 of file status flags.
2559 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2560 unchanged files.
2561 (Sized_incremental_binary::do_process_got_plt): New function.
2562 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2563 (Output_section_incremental_inputs::set_final_data_size): Record
2564 file index for each input file.
2565 (Output_section_incremental_inputs::write_got_plt): Store file index
2566 instead of input entry offset for each GOT entry.
2567 * incremental.h
2568 (Incremental_input_entry::Incremental_input_entry): Initialize new
2569 data member.
2570 (Incremental_input_entry::set_offset): Store file index.
2571 (Incremental_input_entry::get_file_index): New function.
2572 (Incremental_input_entry::file_index_): New data member.
2573 (Incremental_binary::process_got_plt): New function.
2574 (Incremental_binary::do_process_got_plt): New function.
2575 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2576 data members.
2577 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2578 (Sized_incremental_binary::set_file_is_unchanged): New function.
2579 (Sized_incremental_binary::file_is_unchanged): New function.
2580 (Sized_incremental_binary::do_process_got_plt): New function.
2581 (Sized_incremental_binary::file_status_): New data member.
2582 (Sized_incremental_binary::main_symtab_loc_): New data member.
2583 (Sized_incremental_binary::main_strtab_loc_): New data member.
2584 * output.cc (Output_data_got::Got_entry::write): Add case
2585 RESERVED_CODE.
2586 (Output_data_got::add_global): Call add_got_entry.
2587 (Output_data_got::add_global_plt): Likewise.
2588 (Output_data_got::add_global_with_rel): Likewise.
2589 (Output_data_got::add_global_with_rela): Likewise.
2590 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2591 (Output_data_got::add_global_pair_with_rela): Likewise.
2592 (Output_data_got::add_local): Call add_got_entry.
2593 (Output_data_got::add_local_plt): Likewise.
2594 (Output_data_got::add_local_with_rel): Likewise.
2595 (Output_data_got::add_local_with_rela): Likewise.
2596 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2597 (Output_data_got::add_local_pair_with_rela): Likewise.
2598 (Output_data_got::reserve_slot): New function.
2599 (Output_data_got::reserve_slot_for_global): New function.
2600 (Output_data_got::add_got_entry): New function.
2601 (Output_data_got::add_got_entry_pair): New function.
2602 (Output_section::add_output_section_data): Edit FIXME.
2603 * output.h
2604 (Output_section_data_build::Output_section_data_build): New
2605 constructor with size parameter.
2606 (Output_data_space::Output_data_space): Likewise.
2607 (Output_data_got::Output_data_got): Initialize new data member; new
2608 constructor with size parameter.
2609 (Output_data_got::add_constant): Call add_got_entry.
2610 (Output_data_got::reserve_slot): New function.
2611 (Output_data_got::reserve_slot_for_global): New function.
2612 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2613 (Output_data_got::add_got_entry): New function.
2614 (Output_data_got::add_got_entry_pair): New function.
2615 (Output_data_got::free_list_): New data member.
2616 * target.h (Sized_target::init_got_plt_for_update): New function.
2617 (Sized_target::register_global_plt_entry): New function.
2618 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2619 Initialize new data member; call init; add constructor with PLT count.
2620 (Output_data_plt_x86_64::init): New function.
2621 (Output_data_plt_x86_64::add_relocation): New function.
2622 (Output_data_plt_x86_64::reserve_slot): New function.
2623 (Output_data_plt_x86_64::free_list_): New data member.
2624 (Target_x86_64::init_got_plt_for_update): New function.
2625 (Target_x86_64::register_global_plt_entry): New function.
2626 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2627 incremental updates.
2628 (Output_data_plt_x86_64::add_relocation): New function.
2629 * testsuite/object_unittest.cc (Object_test): Set default options.
2630
2631 2011-05-16 Ian Lance Taylor <iant@google.com>
2632
2633 * options.h (class General_options): Make -i a synonym for -r.
2634
2635 2011-05-16 Ian Lance Taylor <iant@google.com>
2636
2637 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2638
2639 2011-05-10 Cary Coutant <ccoutant@google.com>
2640
2641 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2642 strip_all (-s).
2643
2644 2011-05-06 Ian Lance Taylor <iant@google.com>
2645
2646 * layout.cc (Layout::layout): If the output section flags change,
2647 update the ordering.
2648
2649 2011-04-25 Cary Coutant <ccoutant@google.com>
2650
2651 * incremental-dump.cc (dump_incremental_inputs): Print local
2652 symbol info for each input file.
2653 * incremental.cc
2654 (Output_section_incremental_inputs::set_final_data_size): Add local
2655 symbol info to input file entries in incremental info.
2656 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2657 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2658 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2659 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2660 implementation.
2661 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2662 (Sized_incr_relobj::do_relocate): Write the local symbols.
2663 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2664 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2665 Adjust size of input file header.
2666 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2667 (Incremental_inputs_reader::get_local_symbol_count): New function.
2668 (Incremental_inputs_reader::get_input_section): Adjust size of input
2669 file header.
2670 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2671 (Sized_incr_relobj::This): New typedef.
2672 (Sized_incr_relobj::sym_size): New const data member.
2673 (Sized_incr_relobj::Local_symbol): New struct.
2674 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2675 (Sized_incr_relobj::do_local_symbol_offset): New function.
2676 (Sized_incr_relobj::local_symbol_count_): New data member.
2677 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2678 (Sized_incr_relobj::local_symbol_index_): New data member.
2679 (Sized_incr_relobj::local_symbol_offset_): New data member.
2680 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2681 (Sized_incr_relobj::local_symbols_): New data member.
2682 * object.h (Relobj::output_local_symbol_count): New function.
2683 (Relobj::local_symbol_offset): New function.
2684 (Relobj::do_output_local_symbol_count): New function.
2685 (Relobj::do_local_symbol_offset): New function.
2686 (Sized_relobj::do_output_local_symbol_count): New function.
2687 (Sized_relobj::do_local_symbol_offset): New function.
2688
2689 2011-04-22 Vladimir Simonov <sv@sw.ru>
2690
2691 * descriptors.cc (set_close_on_exec): New function.
2692 (Descriptors::open): Use set_close_on_exec.
2693 * output.cc (S_ISLNK): Define if not defined.
2694
2695 2011-04-22 Cary Coutant <ccoutant@google.com>
2696
2697 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2698 global symbol map.
2699 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2700 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2701 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2702 relocations.
2703 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2704 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2705 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2706 * incremental.h
2707 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2708 function.
2709 (Incremental_binary::apply_incremental_relocs): New function.
2710 (Incremental_binary::do_apply_incremental_relocs): New function.
2711 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2712 data member.
2713 (Sized_incremental_binary::add_global_symbol): New function.
2714 (Sized_incremental_binary::global_symbol): New function.
2715 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2716 (Sized_incremental_binary::symbol_map_): New data member.
2717 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2718 * target.h (Sized_target::apply_relocation): New function.
2719 * target-reloc.h (apply_relocation): New function.
2720 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2721
2722 2011-04-22 Doug Kwan <dougkwan@google.com>
2723
2724 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2725 flag of a SHT_ARM_EXIDX section.
2726 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2727 * testsuite/Makefile.in: Regenerate.
2728 * testsuite/arm_exidx_test.s: New file.
2729 * testsuite/arm_exidx_test.sh: Same.
2730
2731 2011-04-20 Cary Coutant <ccoutant@google.com>
2732
2733 PR gold/12689
2734 * archive.h (Incremental_archive_entry::Archive_member):
2735 Initialize arg_serial_ (second constructor).
2736
2737 2011-04-17 Ian Lance Taylor <iant@google.com>
2738
2739 * object.cc (Relocate_info::location): Simplify location string.
2740 * errors.cc (Errors::error_at_location): Don't print program
2741 name.
2742 (Errors::warning_at_location): Likewise.
2743 (Errors::undefined_symbol): Likewise.
2744 * testsuite/debug_msg.sh: Update accordingly.
2745
2746 2011-04-14 Cary Coutant <ccoutant@google.com>
2747
2748 * gold/layout.cc (Layout::symtab_section_offset): New function.
2749 * gold/layout.h (Layout::symtab_section_offset): New function.
2750 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2751
2752 2011-04-12 Ian Lance Taylor <iant@google.com>
2753
2754 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2755 with MREMAP_MAYMOVE.
2756 * output.h (class Output_file): Add map_is_allocated_ field.
2757 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2758 not available, provide stubs. If mremap is not available, #define
2759 it to gold_mremap.
2760 (MREMAP_MAYMOVE): Define if not defined.
2761 (Output_file::Output_file): Initialize map_is_allocated_.
2762 (Output_file::resize): Check map_is_allocated_.
2763 (Output_file::map_anonymous): If mmap fails, use malloc.
2764 (Output_file::unmap): Don't do anything for an anonymous map.
2765 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2766 is not available, provide stubs.
2767 (File_read::View::~View): Use free rather than delete[].
2768 (File_read::make_view): Use malloc rather than new[]. If mmap
2769 fails, use malloc.
2770 (File_read::find_or_make_view): Use malloc rather than new[].
2771 * gold.h: Remove HAVE_REMAP code.
2772 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2773 exists. Rename mremap to gold_mremap. If mmap is not available
2774 don't do anything.
2775 * configure, config.in: Rebuild.
2776
2777 2011-04-11 Ian Lance Taylor <iant@google.com>
2778
2779 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2780 initialize local variable v.
2781
2782 2011-04-11 Cary Coutant <ccoutant@google.com>
2783
2784 * archive.cc (Archive::include_member): Adjust call to
2785 report_object.
2786 (Add_archive_symbols::run): Track argument serial numbers.
2787 (Lib_group::include_member): Likewise.
2788 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2789 * archive.h (Incremental_archive_entry::Archive_member):
2790 Initialize arg_serial_.
2791 (Archive_member::arg_serial_): New data member.
2792 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2793 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2794 incremental link.
2795 (Sized_dynobj::do_for_all_local_got_entries): New function.
2796 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2797 function.
2798 * fileread.cc (get_mtime): New function.
2799 * fileread.h (get_mtime): New function.
2800 * gold.cc (queue_initial_tasks): Check for incremental update.
2801 (process_incremental_input): New function.
2802 (queue_middle_tasks): Don't force valid target for incremental
2803 update.
2804 * incremental-dump.cc (find_input_containing_global): Adjust
2805 size of symbol info entry.
2806 (dump_incremental_inputs): Dump argument serial number and
2807 in_system_directory flag; bias shndx by 1; print symbol names
2808 when dumping per-file symbol lists; use new symbol info readers.
2809 * incremental.cc
2810 (Output_section_incremental_inputs:update_data_size): New function.
2811 (Sized_incremental_binary::setup_readers): Setup input readers
2812 for each input file; build maps for files added from libraries
2813 and scripts.
2814 (Sized_incremental_binary::check_input_args): New function.
2815 (Sized_incremental_binary::do_check_inputs): Build map of argument
2816 serial numbers to input arguments.
2817 (Sized_incremental_binary::do_file_has_changed): Rename
2818 do_file_is_unchanged to this; compare file modification times.
2819 (Sized_incremental_binary::do_init_layout): New function.
2820 (Sized_incremental_binary::do_reserve_layout): New function.
2821 (Sized_incremental_binary::do_get_input_reader): Remove.
2822 (Sized_incremental_binary::get_symtab_view): New function.
2823 (Incremental_checker::can_incrementally_link_output_file): Remove.
2824 (Incremental_inputs::report_command_line): Exclude --debug options.
2825 (Incremental_inputs::report_archive_begin): Add parameter; track
2826 argument serial numbers; don't put input file entry for archive
2827 before archive members.
2828 (Incremental_inputs::report_archive_end): Put input file entry
2829 for archive after archive members.
2830 (Incremental_inputs::report_object): Add parameter; track argument
2831 serial numbers and in_system_directory flag.
2832 (Incremental_inputs::report_script): Add parameter; track argument
2833 serial numbers.
2834 (Output_section_incremental_inputs::set_final_data_size): Adjust
2835 size of symbol info entry; check for forwarding symbols.
2836 (Output_section_incremental_inputs::write_input_files): Write
2837 in_system_directory flag and argument serial number.
2838 (Output_section_incremental_inputs::write_info_blocks): Map section
2839 indices between incremental info and original input file; store
2840 input section index for each symbol.
2841 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2842 change operator() to visit().
2843 (class Global_got_offset_visitor): Likewise.
2844 (class Global_symbol_visitor_got_plt):
2845 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2846 classes.
2847 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2848 (Sized_incr_relobj::do_read_symbols): New function.
2849 (Sized_incr_relobj::do_layout): New function.
2850 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2851 (Sized_incr_relobj::do_add_symbols): New function.
2852 (Sized_incr_relobj::do_should_include_member): New function.
2853 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2854 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2855 (Sized_incr_relobj::do_section_size): New function.
2856 (Sized_incr_relobj::do_section_name): New function.
2857 (Sized_incr_relobj::do_section_contents): New function.
2858 (Sized_incr_relobj::do_section_flags): New function.
2859 (Sized_incr_relobj::do_section_entsize): New function.
2860 (Sized_incr_relobj::do_section_address): New function.
2861 (Sized_incr_relobj::do_section_type): New function.
2862 (Sized_incr_relobj::do_section_link): New function.
2863 (Sized_incr_relobj::do_section_info): New function.
2864 (Sized_incr_relobj::do_section_addralign): New function.
2865 (Sized_incr_relobj::do_initialize_xindex): New function.
2866 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2867 (Sized_incr_relobj::do_read_relocs): New function.
2868 (Sized_incr_relobj::do_gc_process_relocs): New function.
2869 (Sized_incr_relobj::do_scan_relocs): New function.
2870 (Sized_incr_relobj::do_count_local_symbols): New function.
2871 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2872 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2873 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2874 (Sized_incr_relobj::do_relocate): New function.
2875 (Sized_incr_relobj::do_set_section_offset): New function.
2876 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2877 (Sized_incr_dynobj::do_read_symbols): New function.
2878 (Sized_incr_dynobj::do_layout): New function.
2879 (Sized_incr_dynobj::do_add_symbols): New function.
2880 (Sized_incr_dynobj::do_should_include_member): New function.
2881 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2882 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2883 (Sized_incr_dynobj::do_section_size): New function.
2884 (Sized_incr_dynobj::do_section_name): New function.
2885 (Sized_incr_dynobj::do_section_contents): New function.
2886 (Sized_incr_dynobj::do_section_flags): New function.
2887 (Sized_incr_dynobj::do_section_entsize): New function.
2888 (Sized_incr_dynobj::do_section_address): New function.
2889 (Sized_incr_dynobj::do_section_type): New function.
2890 (Sized_incr_dynobj::do_section_link): New function.
2891 (Sized_incr_dynobj::do_section_info): New function.
2892 (Sized_incr_dynobj::do_section_addralign): New function.
2893 (Sized_incr_dynobj::do_initialize_xindex): New function.
2894 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2895 (make_sized_incremental_object): New function.
2896 (Incremental_library::copy_unused_symbols): New function.
2897 (Incremental_library::do_for_all_unused_symbols): New function.
2898 * incremental.h (enum Incremental_input_flags): New type.
2899 (class Incremental_checker): Remove.
2900 (Incremental_input_entry::Incremental_input_entry): Add argument
2901 serial number.
2902 (Incremental_input_entry::arg_serial): New function.
2903 (Incremental_input_entry::set_is_in_system_directory): New function.
2904 (Incremental_input_entry::is_in_system_directory): New function.
2905 (Incremental_input_entry::arg_serial_): New data member.
2906 (Incremental_input_entry::is_in_system_directory_): New data member.
2907 (class Script_info): Move here from script.h.
2908 (Script_info::Script_info): Add filename parameter.
2909 (Script_info::filename): New function.
2910 (Script_info::filename_): New data member.
2911 (Incremental_script_entry::Incremental_script_entry): Add argument
2912 serial number.
2913 (Incremental_object_entry::Incremental_object_entry): Likewise.
2914 (Incremental_object_entry::add_input_section): Build list of input
2915 sections with map to original shndx.
2916 (Incremental_object_entry::get_input_section_index): New function.
2917 (Incremental_object_entry::shndx_): New data member.
2918 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2919 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2920 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2921 serial number.
2922 (Incremental_inputs::report_archive_begin): Likewise.
2923 (Incremental_inputs::report_object): Likewise.
2924 (Incremental_inputs::report_script): Likewise.
2925 (class Incremental_global_symbol_reader): New class.
2926 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2927 and store flags and input file type.
2928 (Incremental_input_entry_reader::arg_serial): New function.
2929 (Incremental_input_entry_reader::type): Extract type from flags.
2930 (Incremental_input_entry_reader::is_in_system_directory): New function.
2931 (Incremental_input_entry_reader::get_input_section_count): Call
2932 accessor function for type.
2933 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2934 function for type; adjust size of global symbol entry.
2935 (Incremental_input_entry_reader::get_global_symbol_count): Call
2936 accessor function for type.
2937 (Incremental_input_entry_reader::get_object_count): Likewise.
2938 (Incremental_input_entry_reader::get_object_offset): Likewise.
2939 (Incremental_input_entry_reader::get_member_count): Likewise.
2940 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2941 (Incremental_input_entry_reader::get_member_offset): Likewise.
2942 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2943 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2944 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2945 (Incremental_input_entry_reader::get_global_symbol_reader): New
2946 function.
2947 (Incremental_input_entry_reader::get_output_symbol_index): New
2948 function.
2949 (Incremental_input_entry_reader::type_): Remove.
2950 (Incremental_input_entry_reader::flags_): New data member.
2951 (Incremental_inputs_reader::input_file_offset): New function.
2952 (Incremental_inputs_reader::input_file_index): New function.
2953 (Incremental_inputs_reader::input_file): Call input_file_offset.
2954 (Incremental_inputs_reader::input_file_at_offset): New function.
2955 (Incremental_relocs_reader::get_r_type): Reformat.
2956 (Incremental_relocs_reader::get_r_shndx): Reformat.
2957 (Incremental_relocs_reader::get_r_offset): Reformat.
2958 (Incremental_relocs_reader::data): New function.
2959 (Incremental_binary::Incremental_binary): Initialize new data members.
2960 (Incremental_binary::check_inputs): Add cmdline parameter.
2961 (Incremental_binary::file_is_unchanged): Remove.
2962 (Input_reader::arg_serial): New function.
2963 (Input_reader::get_unused_symbol_count): New function.
2964 (Input_reader::get_unused_symbol): New function.
2965 (Input_reader::do_arg_serial): New function.
2966 (Input_reader::do_get_unused_symbol_count): New function.
2967 (Input_reader::do_get_unused_symbol): New function.
2968 (Incremental_binary::input_file_count): New function.
2969 (Incremental_binary::get_input_reader): Change signature to use
2970 index instead of filename.
2971 (Incremental_binary::file_has_changed): New function.
2972 (Incremental_binary::get_input_argument): New function.
2973 (Incremental_binary::get_library): New function.
2974 (Incremental_binary::get_script_info): New function.
2975 (Incremental_binary::init_layout): New function.
2976 (Incremental_binary::reserve_layout): New function.
2977 (Incremental_binary::output_file): New function.
2978 (Incremental_binary::do_check_inputs): New function.
2979 (Incremental_binary::do_file_is_unchanged): Remove.
2980 (Incremental_binary::do_file_has_changed): New function.
2981 (Incremental_binary::do_init_layout): New function.
2982 (Incremental_binary::do_reserve_layout): New function.
2983 (Incremental_binary::do_input_file_count): New function.
2984 (Incremental_binary::do_get_input_reader): Change signature.
2985 (Incremental_binary::input_args_map_): New data member.
2986 (Incremental_binary::library_map_): New data member.
2987 (Incremental_binary::script_map_): New data member.
2988 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2989 new data members.
2990 (Sized_incremental_binary::output_section): New function.
2991 (Sized_incremental_binary::inputs_reader): Add const.
2992 (Sized_incremental_binary::symtab_reader): Add const.
2993 (Sized_incremental_binary::relocs_reader): Add const.
2994 (Sized_incremental_binary::got_plt_reader): Add const.
2995 (Sized_incremental_binary::get_symtab_view): New function.
2996 (Sized_incremental_binary::Inputs_reader): New typedef.
2997 (Sized_incremental_binary::Input_entry_reader): New typedef.
2998 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2999 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3000 (Sized_incremental_binary::do_file_has_changed): New function.
3001 (Sized_incremental_binary::do_init_layout): New function.
3002 (Sized_incremental_binary::do_reserve_layout): New function.
3003 (Sized_input_reader::Inputs_reader): Remove.
3004 (Sized_input_reader::Input_entry_reader): Remove.
3005 (Sized_input_reader::do_arg_serial): New function.
3006 (Sized_input_reader::do_get_unused_symbol_count): New function.
3007 (Sized_input_reader::do_get_unused_symbol): New function.
3008 (Sized_incremental_binary::do_input_file_count): New function.
3009 (Sized_incremental_binary::do_get_input_reader): Change signature;
3010 use index instead of filename.
3011 (Sized_incremental_binary::section_map_): New data member.
3012 (Sized_incremental_binary::input_entry_readers_): New data member.
3013 (class Sized_incr_relobj): New class.
3014 (class Sized_incr_dynobj): New class.
3015 (make_sized_incremental_object): New function.
3016 (class Incremental_library): New class.
3017 * layout.cc (Free_list::num_lists): New static data member.
3018 (Free_list::num_nodes): New static data member.
3019 (Free_list::num_removes): New static data member.
3020 (Free_list::num_remove_visits): New static data member.
3021 (Free_list::num_allocates): New static data member.
3022 (Free_list::num_allocate_visits): New static data member.
3023 (Free_list::init): New function.
3024 (Free_list::remove): New function.
3025 (Free_list::allocate): New function.
3026 (Free_list::dump): New function.
3027 (Free_list::print_stats): New function.
3028 (Layout_task_runner::run): Resize output file for incremental updates.
3029 (Layout::Layout): Initialize new data members.
3030 (Layout::set_incremental_base): New function.
3031 (Layout::init_fixed_output_section): New function.
3032 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3033 incremental updates.
3034 (Layout::create_gold_note): Do not create gold note section for
3035 incremental updates.
3036 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3037 for incremental updates.
3038 (Layout::set_section_offsets): For incremental updates, allocate space
3039 from free list.
3040 (Layout::create_symtab_sections): Layout with offsets relative to
3041 start of section; for incremental updates, allocate space from free
3042 list.
3043 (Layout::create_shdrs): For incremental updates, allocate space from
3044 free list.
3045 (Layout::finish_dynamic_section): For incremental updates, do not
3046 check --as-needed (fixed in subsequent patch).
3047 * layout.h (class Free_list): New class.
3048 (Layout::set_incremental_base): New function.
3049 (Layout::incremental_base): New function.
3050 (Layout::init_fixed_output_section): New function.
3051 (Layout::allocate): New function.
3052 (Layout::incremental_base_): New data member.
3053 (Layout::free_list_): New data member.
3054 * main.cc (main): Print Free_list statistics.
3055 * object.cc (Relobj::finalize_incremental_relocs): Add
3056 clear_counts parameter; clear counts only when clear_counts is set.
3057 (Sized_relobj::Sized_relobj): Initialize new base class.
3058 (Sized_relobj::do_layout): Don't report special sections.
3059 (Sized_relobj::do_for_all_local_got_entries): New function.
3060 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3061 symtab_off to all symbol table offsets.
3062 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3063 * object.h (class Got_offset_list): Move to top of file.
3064 (Object::Object): Allow case where input_file == NULL.
3065 (Object::~Object): Likewise.
3066 (Object::input_file): Assert that input_file != NULL.
3067 (Object::lock): Allow case where input_file == NULL.
3068 (Object::unlock): Likewise.
3069 (Object::is_locked): Likewise.
3070 (Object::token): Likewise.
3071 (Object::release): Likewise.
3072 (Object::is_incremental): New function.
3073 (Object::get_mtime): New function.
3074 (Object::for_all_local_got_entries): New function.
3075 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3076 (Object::set_is_in_system_directory): New function.
3077 (Object::is_in_system_directory): New function.
3078 (Object::do_is_incremental): New function.
3079 (Object::do_get_mtime): New function.
3080 (Object::do_for_all_local_got_entries): New function.
3081 (Object::is_in_system_directory_): New data member.
3082 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3083 (class Sized_relobj_base): New class.
3084 (class Sized_relobj): Derive from Sized_relobj_base.
3085 (class Sized_relobj::Symbols): Redeclare from base class.
3086 (class Sized_relobj::local_got_offset_list): Remove.
3087 (class Sized_relobj::Output_sections): Redeclare from base class.
3088 (class Sized_relobj::do_for_all_local_got_entries): New function.
3089 (class Sized_relobj::write_local_symbols): Add offset parameter.
3090 (class Sized_relobj::local_symbol_offset_): Update comment.
3091 (class Sized_relobj::local_dynsym_offset_): Update comment.
3092 * options.cc (Input_arguments::add_file): Remove const.
3093 * options.h (Input_file_argument::Input_file_argument):
3094 Initialize arg_serial_ (all constructors).
3095 (Input_file_argument::set_arg_serial): New function.
3096 (Input_file_argument::arg_serial): New function.
3097 (Input_file_argument::arg_serial_): New data member.
3098 (Input_arguments::Input_arguments): Initialize file_count_.
3099 (Input_arguments::add_file): Remove const.
3100 (Input_arguments::number_of_input_files): New function.
3101 (Input_arguments::file_count_): New data member.
3102 (Command_line::number_of_input_files): Call
3103 Input_arguments::number_of_input_files.
3104 * output.cc (Output_segment_headers::Output_segment_headers):
3105 Set current size.
3106 (Output_section::Input_section::current_data_size): New function.
3107 (Output_section::Output_section): Initialize new data members.
3108 (Output_section::add_input_section): Don't do merge sections for
3109 an incremental link; allocate space from free list for an
3110 incremental update.
3111 (Output_section::add_output_section_data): Allocate space from
3112 free list for an incremental update.
3113 (Output_section::update_data_size): New function.
3114 (Output_section::set_fixed_layout): New function.
3115 (Output_section::reserve): New function.
3116 (Output_segment::set_section_addresses): Remove const.
3117 (Output_segment::set_section_list_addresses): Remove const; allocate
3118 space from free list for an incremental update.
3119 (Output_segment::set_offset): Adjust size of RELRO segment for an
3120 incremental update.
3121 * output.h (Output_data::current_data_size): Move here from
3122 child classes.
3123 (Output_data::pre_finalize_data_size): New function.
3124 (Output_data::update_data_size): New function.
3125 (Output_section_headers::update_data_size): new function.
3126 (Output_section_data_build::current_data_size): Move to Output_data.
3127 (Output_data_strtab::update_data_size): New function.
3128 (Output_section::current_data_size): Move to Output_data.
3129 (Output_section::set_fixed_layout): New function.
3130 (Output_section::has_fixed_layout): New function.
3131 (Output_section::reserve): New function.
3132 (Output_section::update_data_size): New function.
3133 (Output_section::has_fixed_layout_): New data member.
3134 (Output_section::free_list_): New data member.
3135 (Output_segment::set_section_addresses): Remove const.
3136 (Output_segment::set_section_list_addresses): Remove const.
3137 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3138 New function.
3139 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3140 New function.
3141 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3142 parameter when calling Add_symbols constructor; store argument
3143 serial number for members of a lib group.
3144 (Add_symbols::locks): Allow case where token == NULL.
3145 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3146 (Read_member::~Read_member): New function.
3147 (Read_member::is_runnable): New function.
3148 (Read_member::locks): New function.
3149 (Read_member::run): New function.
3150 (Check_script::~Check_script): New function.
3151 (Check_script::is_runnable): New function.
3152 (Check_script::locks): New function.
3153 (Check_script::run): New function.
3154 (Check_library::~Check_library): New function.
3155 (Check_library::is_runnable): New function.
3156 (Check_library::locks): New function.
3157 (Check_library::run): New function.
3158 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3159 (Add_symbols::library_): New data member.
3160 (class Read_member): New class.
3161 (class Check_script): New class.
3162 (class Check_library): New class.
3163 * reloc.cc (Read_relocs::is_runnable): Allow case where
3164 token == NULL.
3165 (Read_relocs::locks): Likewise.
3166 (Scan_relocs::locks): Likewise.
3167 (Relocate_task::locks): Likewise.
3168 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3169 to clear counters.
3170 (Sized_relobj::incremental_relocs_scan): Fix comment.
3171 (Sized_relobj::do_relocate): Pass output file offset to
3172 write_local_symbols.
3173 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3174 from class declaration.
3175 * script.cc (read_input_script): Allocate Script_info; pass
3176 argument serial number to report_script.
3177 * script.h (class Script_info): Move to incremental.h.
3178 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3179 * symtab.h (Symbol_table::add_from_incrobj): New function.
3180 (Symbol_table::set_file_offset): New function.
3181
3182 2011-04-05 Cary Coutant <ccoutant@google.com>
3183
3184 * incremental-dump.cc (dump_incremental_inputs): Change signature
3185 to take a Sized_incremental_binary; change caller. Use readers
3186 in Sized_incremental_binary.
3187 * incremental.cc
3188 (Sized_incremental_binary::find_incremental_inputs_sections):
3189 Rename do_find_incremental_inputs_sections to this.
3190 (Sized_incremental_binary::setup_readers): New function.
3191 (Sized_incremental_binary::do_check_inputs): Check
3192 has_incremental_info_ flag; move setup code to setup_readers;
3193 use input readers.
3194 (Sized_incremental_binary::do_file_is_unchanged): New function.
3195 (Sized_incremental_binary::do_get_input_reader): New function.
3196 * incremental.h (class Incremental_binary): Move to end of file.
3197 (Incremental_binary::file_is_unchanged): New function.
3198 (Incremental_binary::do_file_is_unchanged): New function.
3199 (Incremental_binary::Input_reader): New class.
3200 (Incremental_binary::get_input_reader): New function.
3201 (class Sized_incremental_binary): Move to end of file.
3202 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3203 input section reader classes.
3204 (Sized_incremental_binary::has_incremental_info): New function.
3205 (Sized_incremental_binary::inputs_reader): New function.
3206 (Sized_incremental_binary::symtab_reader): New function.
3207 (Sized_incremental_binary::relocs_reader): New function.
3208 (Sized_incremental_binary::got_plt_reader): New function.
3209 (Sized_incremental_binary::do_file_is_unchanged): New function.
3210 (Sized_incremental_binary::Sized_input_reader): New class.
3211 (Sized_incremental_binary::get_input_reader): New function.
3212 (Sized_incremental_binary::find_incremental_inputs_sections):
3213 Rename do_find_incremental_inputs_sections to this.
3214 (Sized_incremental_binary::setup_readers): New function.
3215 (Sized_incremental_binary::has_incremental_info_): New data member.
3216 (Sized_incremental_binary::inputs_reader_): New data member.
3217 (Sized_incremental_binary::symtab_reader_): New data member.
3218 (Sized_incremental_binary::relocs_reader_): New data member.
3219 (Sized_incremental_binary::got_plt_reader_): New data member.
3220 (Sized_incremental_binary::current_input_file_): New data member.
3221
3222 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3223
3224 PR gold/12640
3225 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3226 violation.
3227
3228 2011-03-30 Cary Coutant <ccoutant@google.com>
3229
3230 * archive.cc (Archive::include_member): Adjust call to report_object.
3231 (Add_archive_symbols::run): Add script_info to call to
3232 report_archive_begin.
3233 (Lib_group::include_member): Adjust call to report_object.
3234 (Add_lib_group_symbols::run): Adjust call to report_object.
3235 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3236 blocks. Add object count for script input files.
3237 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3238 script_info parameter; change all callers.
3239 (Incremental_inputs::report_object): Add script_info parameter;
3240 change all callers.
3241 (Incremental_inputs::report_script): Store backpointer to
3242 incremental info entry.
3243 (Output_section_incremental_inputs::set_final_data_size): Record
3244 additional information for scripts.
3245 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3246 * incremental.h (Incremental_script_entry::add_object): New function.
3247 (Incremental_script_entry::get_object_count): New function.
3248 (Incremental_script_entry::get_object): New function.
3249 (Incremental_script_entry::objects_): New data member; adjust
3250 constructor.
3251 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3252 (Incremental_inputs::report_object): Add script_info parameter.
3253 (Incremental_inputs_reader::get_object_count): New function.
3254 (Incremental_inputs_reader::get_object_offset): New function.
3255 * options.cc (Input_arguments::add_file): Return reference to
3256 new input argument.
3257 * options.h (Input_argument::set_script_info): New function.
3258 (Input_argument::script_info): New function.
3259 (Input_argument::script_info_): New data member; adjust all
3260 constructors.
3261 (Input_file_group::add_file): Return reference to new input argument.
3262 (Input_file_lib::add_file): Likewise.
3263 (Input_arguments::add_file): Likewise.
3264 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3265 * script.cc (Parser_closure::Parser_closure): Add script_info
3266 parameter; adjust all callers.
3267 (Parser_closure::script_info): New function.
3268 (Parser_closure::script_info_): New data member.
3269 (read_input_script): Report scripts earlier to incremental info.
3270 (script_add_file): Set script_info in Input_argument.
3271 (script_add_library): Likewise.
3272 * script.h (Script_options::Script_info): Rewrite class.
3273
3274 2011-03-29 Cary Coutant <ccoutant@google.com>
3275
3276 * archive.cc (Library_base::should_include_member): Move
3277 method here from class Archive.
3278 (Archive::Archive): Initialize base class.
3279 (Archive::should_include_member): Move to base class.
3280 (Archive::do_for_all_unused_symbols): New function.
3281 (Add_archive_symbols::run): Remove redundant access to
3282 incremental_inputs.
3283 (Lib_group::Lib_group): Initialize base class.
3284 (Lib_group::do_filename): New function.
3285 (Lib_group::include_member): Pass pointer to Lib_group to
3286 report_object.
3287 (Lib_group::do_for_all_unused_symbols): New function.
3288 (Add_lib_group_symbols::run): Report archive information for
3289 incremental links.
3290 * archive.h (class Library_base): New base class.
3291 (class Archive): Derive from Library_base.
3292 (Archive::filename): Move to base class.
3293 (Archive::set_incremental_info): Likewise.
3294 (Archive::incremental_info): Likewise.
3295 (Archive::Should_include): Likewise.
3296 (Archive::should_include_member): Likewise.
3297 (Archive::Armap_entry): Remove.
3298 (Archive::Unused_symbol_iterator): Remove.
3299 (Archive::unused_symbols_begin): Remove.
3300 (Archive::unused_symbols_end): Remove.
3301 (Archive::do_filename): New function.
3302 (Archive::do_get_mtime): New function.
3303 (Archive::do_for_all_unused_symbols): New function.
3304 (Archive::task_): Move to base class.
3305 (Archive::incremental_info_): Likewise.
3306 (class Lib_group): Derive from Library_base.
3307 (Lib_group::do_filename): New function.
3308 (Lib_group::do_get_mtime): New function.
3309 (Lib_group::do_for_all_unused_symbols): New function.
3310 (Lib_group::task_): Move to base class.
3311 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3312 function.
3313 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3314 function.
3315 * incremental.cc (Incremental_inputs::report_archive_begin):
3316 Use Library_base; call library's get_mtime; add incremental inputs
3317 entry before members.
3318 (class Unused_symbol_visitor): New class.
3319 (Incremental_inputs::report_archive_end): Use Library_base; use
3320 visitor class to record unused symbols; don't add incremental inputs
3321 entry after members.
3322 (Incremental_inputs::report_object): Use Library_base.
3323 * incremental.h
3324 (Incremental_archive_entry::Incremental_archive_entry): Remove
3325 unused Archive parameter.
3326 (Incremental_inputs::report_archive_begin): Use Library_base.
3327 (Incremental_inputs::report_archive_end): Likewise.
3328 (Incremental_inputs::report_object): Likewise.
3329 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3330 function.
3331 * object.h (Object::for_all_global_symbols): New function.
3332 (Object::do_for_all_global_symbols): New function.
3333 (Sized_relobj::do_for_all_global_symbols): New function.
3334 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3335 function.
3336 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3337 function.
3338
3339 2011-03-27 Ian Lance Taylor <iant@google.com>
3340
3341 * archive.cc (Archive::interpret_header): Return -1 if something
3342 goes wrong. Change callers accordingly.
3343
3344 2011-03-25 Cary Coutant <ccoutant@google.com>
3345
3346 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3347 * testsuite/Makefile.in: Regenerate.
3348
3349 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3350
3351 * plugin.cc (get_view): New.
3352 (Plugin::load): Pass get_view to the plugin.
3353 (Plugin_manager::get_view): New.
3354
3355 2011-03-21 Ian Lance Taylor <iant@google.com>
3356
3357 * testsuite/final_layout.sh: Rewrite to not use dc.
3358 * testsuite/relro_test.sh: Fail if dc is not present.
3359
3360 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3361
3362 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3363 Change == to -eq.
3364 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3365 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3366 Change == to -eq.
3367 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3368 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3369
3370 2011-03-14 Ian Lance Taylor <iant@google.com>
3371
3372 * script-sections.cc (Sort_output_sections::script_compare):
3373 Rename from is_before, change return type.
3374 (Sort_output_sections::operator()): Adjust accordingly.
3375
3376 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3377
3378 PR gold/12572
3379 * testsuite/odr_violation2.cc: Add comment to make all error line
3380 numbers double digits.
3381 * testsuite/debug_msg.sh: Adjust expected errors.
3382
3383 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3384
3385 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3386 but mark earlier ones as non-canonical
3387 (offset_to_iterator): Update search target and example
3388 (do_addr2line): Return extra lines in a vector*
3389 (format_file_lineno): Extract from do_addr2line
3390 (one_addr2line): Add vector* out-param
3391 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3392 when a lineno entry appeared last for its instruction
3393 (Dwarf_line_info): Add vector* out-param
3394 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3395 * symtab.cc (Odr_violation_compare): Include the lineno in the
3396 comparison again.
3397 (linenos_from_loc): New. Combine the canonical line for an
3398 address with its other lines.
3399 (True_if_intersect): New. Helper functor to make
3400 std::set_intersection a query.
3401 (detect_odr_violations): Compare sets of lines instead of just
3402 one line for each function. This became less deterministic, but
3403 has fewer false positives.
3404 * symtab.h: Declarations.
3405 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3406 mix an optimized and non-optimized object in the same binary
3407 (odr_violation2.so): Same.
3408 * testsuite/Makefile.in: Regenerate from Makefile.am.
3409 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3410 * testsuite/debug_msg.sh: Update line numbers and add
3411 assertions.
3412 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3413 non-optimized context.
3414 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3415 isn't inlined, and use OdrDerived in an optimized context.
3416 * testsuite/odr_header1.h: Defines OdrDerived, where
3417 optimization will change the
3418 first-instruction-in-the-destructor's file and line number.
3419 * testsuite/odr_header2.h: Defines OdrBase.
3420
3421 2011-03-09 Ian Lance Taylor <iant@google.com>
3422
3423 * fileread.cc (File_read::clear_views): Don't delete the whole
3424 file view.
3425
3426 2011-03-08 Ian Lance Taylor <iant@google.com>
3427
3428 PR gold/12525
3429 * fileread.cc: #include <climits>.
3430 (GOLD_IOV_MAX): Define.
3431 (File_read::read_multiple): Limit number of entries by iov_max.
3432 * fileread.h (class File_read): Always set max_readv_entries to
3433 128.
3434
3435 2011-03-07 Ian Lance Taylor <iant@google.com>
3436
3437 PR gold/12525
3438 * options.h (class General_options): Add -dy and -dn.
3439
3440 2011-03-02 Cary Coutant <ccoutant@google.com>
3441
3442 * testsuite/script_test_9.t: Add TLS segment.
3443
3444 2011-03-02 Simon Baldwin <simonb@google.com>
3445
3446 * configure.ac: Add check for gnu_indirect_function support in
3447 the toolchain building binutils.
3448 * configure: Rebuild.
3449
3450 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3451
3452 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3453 plugin only symbols.
3454 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3455 in plugin files as not needed in the symbol table.
3456
3457 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3458
3459 * output.cc (Output_section::add_input_section): Delay fill
3460 generation for section ordering.
3461
3462 2011-02-09 Ian Lance Taylor <iant@google.com>
3463
3464 PR gold/12316
3465 * object.h (class Sized_relobj): Remove clear_local_symbols.
3466 * reloc.cc (Sized_relobj::do_relocate): Don't call
3467 clear_local_symbols.
3468
3469 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3470
3471 * plugin.cc (is_visible_from_outside): Return true for symbols
3472 in the -u option.
3473
3474 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3475
3476 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3477 filename.
3478
3479 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3480
3481 * icf.h (is_section_foldable_candidate): Change type of parameter
3482 to std::string.
3483 * icf.cc (Icf::find_identical_sections): Change type of local variable
3484 section_name to be std::string.
3485 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3486
3487 2011-01-25 Ian Lance Taylor <iant@google.com>
3488
3489 * script.cc (script_add_extern): Rewrite to use
3490 add_symbol_reference.
3491
3492 2011-01-25 Doug Kwan <dougkwan@google.com>
3493
3494 * icf.cc (get_section_contents): Always lock section's object.
3495
3496 2011-01-24 Ian Lance Taylor <iant@google.com>
3497
3498 * options.h (class General_options): Accept
3499 --no-detect-odr-violations.
3500
3501 2011-01-24 Ian Lance Taylor <iant@google.com>
3502
3503 * version.cc (version_string): Bump to 1.11.
3504
3505 2011-01-24 Ian Lance Taylor <iant@google.com>
3506
3507 * plugin.cc (class Plugin_rescan): Define new class.
3508 (Plugin_manager::claim_file): Set any_claimed_.
3509 (Plugin_manager::save_archive): New function.
3510 (Plugin_manager::save_input_group): New function.
3511 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3512 necessary.
3513 (Plugin_manager::new_undefined_symbol): New function.
3514 (Plugin_manager::rescan): New function.
3515 (Plugin_manager::rescannable_defines): New function.
3516 (Plugin_manager::add_input_file): Set any_added_.
3517 * plugin.h (class Plugin_manager): define new fields rescannable_,
3518 undefined_symbols_, any_claimed_, and any_added_. Declare
3519 Plugin_rescan as friend. Declare new functions.
3520 (Plugin_manager::Rescannable): Define type.
3521 (Plugin_manager::Rescannable_list): Define type.
3522 (Plugin_manager::Undefined_symbol_list): Define type.
3523 (Plugin_manager::Plugin_manager): Initialize new fields.
3524 * archive.cc (Archive::defines_symbol): New function.
3525 (Add_archive_symbols::run): Pass archive to plugins if any.
3526 * archive.h (class Archive): Declare defines_symbol.
3527 * readsyms.cc (Input_group::~Input_group): New function.
3528 (Finish_group::run): Pass input_group to plugins if any.
3529 * readsyms.h (class Input_group): Declare destructor.
3530 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3531 any.
3532
3533 2011-01-10 Ian Lance Taylor <iant@google.com>
3534
3535 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3536 section as relro.
3537 (Layout::set_segment_offsets): Reset increase_relro before calling
3538 set_section_addresses a second time.
3539
3540 2011-01-04 Cary Coutant <ccoutant@google.com>
3541
3542 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3543 sections before NOBITS sections.
3544
3545 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3546
3547 * version.cc (print_version): Update copyright to 2011.
3548
3549 2010-12-23 Cary Coutant <ccoutant@google.com>
3550
3551 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3552 of OS to this->add. Add OD parameter to second form of the function.
3553
3554 2010-12-20 Ian Lance Taylor <iant@google.com>
3555
3556 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3557 second of two consecutive entries with same offset.
3558
3559 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3560
3561 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3562 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3563 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3564 to avoid unneeded links against $(LDADD).
3565 * testsuite/Makefile.in: Regenerate.
3566
3567 2010-12-15 Ian Lance Taylor <iant@google.com>
3568
3569 PR gold/12324
3570 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3571 for R_X86_64_32 and R_X86_64_PC32.
3572 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3573 ver_matching_def_pic.o.
3574 (ver_matching_def_pic.o): New target.
3575
3576 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3577
3578 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3579 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3580 Move definition before File_read::View member definitions.
3581 (File_read::View::~View): Initialize and hold lock before
3582 updating current_mapped_bytes.
3583
3584 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3585
3586 * dwarf_reader.cc: Remove outdated comment.
3587 * gold-threads.cc: Fix typo in error message.
3588 * archive.cc: Fix typos in comments.
3589 * archive.h: Likewise.
3590 * arm-reloc-property.cc: Likewise.
3591 * arm-reloc-property.h: Likewise.
3592 * arm-reloc.def: Likewise.
3593 * arm.cc: Likewise.
3594 * attributes.h: Likewise.
3595 * cref.cc: Likewise.
3596 * ehframe.cc: Likewise.
3597 * fileread.h: Likewise.
3598 * gold.h: Likewise.
3599 * i386.cc: Likewise.
3600 * icf.cc: Likewise.
3601 * incremental.h: Likewise.
3602 * int_encoding.cc: Likewise.
3603 * layout.h: Likewise.
3604 * main.cc: Likewise.
3605 * merge.h: Likewise.
3606 * object.cc: Likewise.
3607 * object.h: Likewise.
3608 * options.cc: Likewise.
3609 * readsyms.cc: Likewise.
3610 * reduced_debug_output.cc: Likewise.
3611 * reloc.cc: Likewise.
3612 * script-sections.cc: Likewise.
3613 * sparc.cc: Likewise.
3614 * symtab.h: Likewise.
3615 * target-reloc.h: Likewise.
3616 * target.cc: Likewise.
3617 * target.h: Likewise.
3618 * timer.cc: Likewise.
3619 * timer.h: Likewise.
3620 * x86_64.cc: Likewise.
3621
3622 2010-12-09 Cary Coutant <ccoutant@google.com>
3623
3624 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3625 stack.
3626 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3627 parameter; change all callers.
3628 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3629 * options.h (warn_execstack): New option.
3630
3631 2010-12-07 Doug Kwan <dougkwan@google.com>
3632
3633 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3634 like function call relocations.
3635
3636 2010-12-07 Ian Lance Taylor <iant@google.com>
3637
3638 * archive.cc (Archive::get_elf_object_for_member): Permit
3639 punconfigured to be NULL.
3640 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3641 (Archive::include_member): Pass NULL to get_elf_object_for_member
3642 if we searched for the archive and this is the first included
3643 object.
3644
3645 2010-12-01 Ian Lance Taylor <iant@google.com>
3646
3647 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3648 track_relocs_type_ field.
3649 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3650 Set track_relocs_type_.
3651 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3652 contents when using RELA relocs.
3653 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3654 reloc_map_.
3655 * reloc.cc (Track_relocs::next_addend): New function.
3656 * reloc.h (class Track_relocs): Declare next_addend.
3657
3658 2010-12-01 Ian Lance Taylor <iant@google.com>
3659
3660 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3661 virtual destructor.
3662
3663 2010-12-01 Ian Lance Taylor <iant@google.com>
3664
3665 * README: Update compilers known to work and fail.
3666
3667 2010-11-23 Matthias Klose <doko@ubuntu.com>
3668
3669 * configure.in: For --enable-gold, handle value `default' instead of
3670 `both*'. Always install ld as ld.bfd, install as ld if gold is
3671 not the default.
3672 * configure: Regenerate.
3673
3674 2010-11-18 Doug Kwan <dougkwan@google.com>
3675
3676 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3677 and right_alignment to be zero. Store result alignment only if it is
3678 greater than existing alignment.
3679
3680 2010-11-16 Cary Coutant <ccoutant@google.com>
3681
3682 PR gold/12220
3683 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3684 Check for ".zdebug_line".
3685
3686 2010-11-16 Doug Kwan <dougkwan@google.com>
3687 Cary Coutant <ccoutant@google.com>
3688
3689 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3690 by reference; adjust all callers.
3691 * output.cc (Output_segment::set_section_addresses): Adjust references
3692 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3693 list is empty.
3694 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3695 end at page boundary.
3696
3697 2010-11-16 Cary Coutant <ccoutant@google.com>
3698
3699 PR gold/12220
3700 * layout.cc (Layout::choose_output_section): Transform names of
3701 compressed sections even when using a script with a SECTIONS clause.
3702 (Layout::output_section_name): Remove code to transform
3703 compressed debug section names.
3704 * output.cc (Output_section::add_input_section): Use uncompressed
3705 section size when tracking input sections.
3706
3707 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3708
3709 * symtab.h (Symbol::NON_PIC_REF): Remove.
3710 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3711 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3712 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3713 (Symbol::use_plt_offset): Take a flags argument and pass it
3714 directly to needs_dynamic_reloc. Restrict check for undefined
3715 weak symbols to function calls.
3716 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3717 (Target_arm::Scan::global): Use it.
3718 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3719 (Target_arm::Relocate::relocate): Likewise.
3720 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3721 parameter with an r_type parameter. Use get_reference_flags
3722 to get the flags.
3723 (Target_arm::Relocate::relocate): Update accordingly.
3724 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3725 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3726 (Target_i386::Scan::global): Likewise.
3727 (Target_i386::Relocate::relocate): Likewise.
3728 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3729 parameter with an r_type parameter. Use get_reference_flags
3730 to get the flags.
3731 (Target_i386::Relocate::relocate): Update accordingly.
3732 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3733 (Target_powerpc::Scan::global): Use it.
3734 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3735 (Target_powerpc::Relocate::relocate): Likewise.
3736 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3737 (Target_sparc::Scan::global): Use it.
3738 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3739 (Target_sparc::Relocate::relocate): Likewise.
3740 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3741 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3742 (Target_x86_64::Scan::global): Likewise.
3743 (Target_x86_64::Relocate::relocate): Likewise.
3744
3745 2010-11-08 Doug Kwan <dougkwan@google.com>
3746 Cary Coutant <ccoutant@google.com>
3747
3748 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3749 (Arm_exidx_merge_section::section_contents_): New data member.
3750 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3751 (Arm_input_section::~Arm_input_section): De-allocate memory.
3752 (Arm_input_section::original_contents_): New data member.
3753 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3754 in parameters instead of calling Object::section_contents without
3755 locking.
3756 (Arm_output_section::group_section): New parameter TASK. Pass it
3757 to callees that need locking objects.
3758 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3759 to lock EXIDX input sections. Fix a formatting issue. Call
3760 Arm_exidx_merged_section::build_contents to create merged section
3761 contents.
3762 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3763 to lock object of stub table owner.
3764 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3765 TEXT_SIZE to initialize data member TEXT_SIZE_.
3766 (Arm_exidx_input_section::addralign): Fix typo in comment.
3767 (Arm_exidx_input_section::text_size): New method.
3768 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3769 that require locking objects. Lock objects before scanning for stubs
3770 and updating local symbols.
3771 (Arm_input_section<big_endian>::init): Copy contents of original
3772 input section.
3773 (Arm_input_section<big_endian>::do_write): Use saved contents of
3774 original input section instead of calling Object::section_contents
3775 without locking.
3776 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3777 size without calling Object::section_size().
3778 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3779 for size. Allocate a buffer for merged EXIDX entries.
3780 (Arm_exidx_merged_section::build_contents): New method.
3781 (Arm_exidx_merged_section::do_write): Move merge section contents
3782 building code to Arm_exidx_merged_section::build_contetns. Write
3783 out contetns in buffer instead of building it on the fly.
3784 (Arm_relobj::make_exidx_input_section): Also pass text section size
3785 to Arm_exidx_input_section constructor.
3786 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3787 (Arm_dynobj::do_read_symbols): Fix memory leak.
3788 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3789 * target.h: (class Task): Add forward declaration.
3790 (Target::relax): Add new parameter TASK and pass it to
3791 Target::do_relax().
3792 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3793
3794 2010-11-05 Cary Coutant <ccoutant@google.com>
3795
3796 PR gold/10708
3797 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3798 object when reading from the file.
3799 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3800 second layout pass.
3801 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3802 when reading section contents.
3803 (get_section_contents): Likewise.
3804 (icf::find_identical_sections): Likewise.
3805 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3806 object when reading from the file.
3807 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3808 the object when doing deferred section layout.
3809
3810 2010-11-03 Nick Clifton <nickc@redhat.com>
3811
3812 PR gold/12001
3813 * script.h (class Symbol_assignment: name): New member. Returns
3814 the name of the symbol.
3815 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3816 Returns true if the given symbol name is on the list of
3817 assignments wating to be processed.
3818 * archive.cc (should_incldue_member): If the symbol is undefined,
3819 check to see if it is on the list of symbols pending assignment.
3820
3821 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3822
3823 * script-sections.cc (Script_sections::find_memory_region): Check
3824 for a NULL output section pointer.
3825
3826 2010-10-29 Doug Kwan <dougkwan@google.com>
3827
3828 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3829 Output_section::add_relaxed_input_section.
3830 * output.cc (Output_section::add_relaxed_input_section): Add new
3831 arguments LAYOUT and NAME. Set section order index.
3832 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3833 Copy section order index.
3834 * output.h (Output_section::add_relaxed_input_section): Add new
3835 arguments LAYOUT and NAME.
3836
3837 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3838
3839 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3840 NATIVE_OR_CROSS_LINKER.
3841 * testsuite/Makefile.in: Regenerate.
3842
3843 2010-10-20 Doug Kwan <dougkwan@google.com>
3844
3845 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3846 without SHF_LINK_ORDER flags.
3847 * layout.cc (Layout::choose_output_section): Do not filter
3848 SHF_LINK_ORDER flag in a relocatable link.
3849
3850 2010-10-17 Cary Coutant <ccoutant@google.com>
3851
3852 * output.h (Output_segment::set_section_addresses): Change function
3853 signature. Update all callers.
3854 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3855 sections.
3856 (Output_segment::set_section_addresses): Align after last TLS
3857 section. Add padding before last relro section instead of after.
3858
3859 2010-10-17 Doug Kwan <dougkwan@google.com>
3860
3861 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3862 GOT output section to be writable.
3863
3864 2010-10-14 Cary Coutant <ccoutant@google.com>
3865
3866 * debug.h (DEBUG_INCREMENTAL): New flag.
3867 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3868 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3869 mode.
3870 * incremental.cc (report_command_line): Ignore all forms of
3871 --incremental.
3872 * layout.cc (Layout::Layout): Check parameters for incremental link
3873 mode.
3874 * options.cc (General_options::parse_incremental): New function.
3875 (General_options::parse_no_incremental): New function.
3876 (General_options::parse_incremental_full): New function.
3877 (General_options::parse_incremental_update): New function.
3878 (General_options::incremental_mode_): New data member.
3879 (General_options::finalize): Check incremental_mode_.
3880 * options.h (General_options): Update help text for --incremental.
3881 Add --no-incremental, --incremental-full, --incremental-update.
3882 (General_options::Incremental_mode): New enum type.
3883 (General_options::incremental_mode): New function.
3884 (General_options::incremental_mode_): New data member.
3885 * parameters.cc (Parameters::incremental_mode_): New data member.
3886 (Parameters::set_options): Set incremental_mode_.
3887 (Parameters::set_incremental_full): New function.
3888 (Parameters::incremental): New function.
3889 (Parameters::incremental_update): New function.
3890 (set_parameters_incremental_full): New function.
3891 * parameters.h (Parameters::set_incremental_full): New function.
3892 (Parameters::incremental): New function.
3893 (Parameters::incremental_update): New function.
3894 (Parameters::incremental_mode_): New data member.
3895 (set_parameters_incremental_full): New function.
3896 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3897 incremental link mode.
3898 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3899 (Sized_relobj::do_relocate_sections): Likewise.
3900 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3901 option.
3902 * testsuite/Makefile.in: Regenerate.
3903 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3904
3905 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3906
3907 * script-sections.h (class Script_sections): Make
3908 Sections_elements typedef public.
3909 * script-sections.cc (class Sort_output_sections): Add elements_
3910 field. Add constructor which sets it; change all callers.
3911 (Sort_output_sections::is_before): New function.
3912 (Sort_output_sections::operator()): Call is_before.
3913 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3914 conditional.
3915 * testsuite/script_test_10.sh: New test. Test script section
3916 order.
3917 * testsuite/script_test_10.t: Likewise.
3918 * testsuite/script_test_10.s: Likewise.
3919 * testsuite/Makefile.am: Wrap the cross linker tests and the
3920 common tests into NATIVE_OR_CROSS_LINKER.
3921 (check_SCRIPTS): Add script_test_10.sh.
3922 (check_DATA): Add script_test_10.stdout.
3923 (script_test_10.o, script_test_10): New targets.
3924 (script_test_10.stdout): New target.
3925 * configure, testsuite/Makefile.in: Regenerate.
3926
3927 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3928
3929 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3930 error for the deprecated relocations.
3931 (Target_arm::Scan::global): Likewise.
3932 (Target_arm::Relocate::relocate): Likewise.
3933
3934 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3935
3936 * fileread.cc (Input_file::find_file): Initialize *found_name
3937 and *namep when using the fallback search for case 4.
3938
3939 2010-10-11 Cary Coutant <ccoutant@google.com>
3940
3941 * options.h (class General_options): Redefine -z lazy as an alias for
3942 the negation of -z now.
3943
3944 2010-10-11 Ian Lance Taylor <iant@google.com>
3945
3946 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3947 binding.
3948
3949 2010-10-06 Nick Clifton <nickc@redhat.com>
3950
3951 * script-sections.cc(class Memory_region): Remove
3952 current_lma_offset_ field. Rename current_vma_offset_ to
3953 current_offset_. Add last_section_ field.
3954 (Memory_region::get_current_vma_address): Rename to
3955 get_current_address.
3956 (Memory_region::get_current_lma_address): Delete.
3957 (Memory_region::increment_vma_offset): Rename to
3958 increment_offset.
3959 (Memory_region::increment_lma_offset): Delete.
3960 (Memory_region::attributes_compatible): New method. Returns
3961 true if the provided section is compatible with the region.
3962 (Memory_region::get_last_section): New method. Returns the last
3963 section to use the region.
3964 (Memory_region::set_last_section): New method. Stores the last
3965 section to use the region.
3966 (Script_sections::block_in_region): New method. Returns true if
3967 a block of memory is contained within a region.
3968 (Script_sections::find_memory_region): New method. Locates a
3969 memory region to be used to set a VMA or LMA address.
3970 (Output_section_definition::set_section_addresses): Add code to
3971 check for addresses set by memory regions.
3972 (Output_segment::set_section_addresses): Remove memory region
3973 walking code.
3974 (Script_sections::create_segment): Add a warning if a header
3975 segment is created outside of any region.
3976 * script-sections.h (class Script_sections): Add prototypes for
3977 find_memory_region and block_in_region methods.
3978 * testsuite/memory_test.s: Use .long instead of .word.
3979 * testsuite/memory_test.t: Add some more output sections.
3980 * testsuite/memory_test.sh: Update expected output.
3981
3982 2010-10-02 Doug Kwan <dougkwan@google.com>
3983
3984 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3985 defintion to symtab.h
3986 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3987 declaration to defintion.
3988
3989 2010-10-01 Nick Clifton <nickc@redhat.com>
3990
3991 * expression.cc (eval): Replace dummy argument with NULL.
3992 (eval_maybe_dot): Check for a NULL result section pointer.
3993 (Symbol_expression::value): Likewise.
3994 (Dot_expression::value): Likewise.
3995 (BINARY_EXPRESSION): Likewise.
3996 (Max_expression::value): Likewise.
3997 (Min_expression::value): Likewise.
3998 (Absolute_expression::value): Likewise.
3999 (Addr_expression::value_from_output_section): Likewise.
4000 (Loaddddr_expression::value_from_output_section): Likewise.
4001 (Segment_start_expression::value): Likewise.
4002 * script-sections.cc
4003 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4004 argument with NULL.
4005 (Sections_elememt_dot_assignment::set_section_addresses):
4006 Likewise.
4007 (Output_data_expression::do_write_to_buffer): Likewise.
4008 (Output_section_definition::finalize_symbols): Likewise.
4009 (Output_section_definition::set_section_addresses): Likewise.
4010
4011 2010-09-30 Doug Kwan <dougkwan@google.com>
4012
4013 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4014
4015 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4016
4017 * target.h (Target::can_icf_inline_merge_sections): New virtual
4018 function.
4019 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4020 virtual function.
4021 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4022 virtual function.
4023 * icf.cc (get_section_contents): Inline merge sections only when
4024 target allows it.
4025
4026 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4027
4028 * configure: Regenerate.
4029
4030 2010-09-17 Ian Lance Taylor <iant@google.com>
4031
4032 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4033 * testsuite/Makefile.am (memory_test.o): New target.
4034 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4035 memory_test.t.
4036 * testsuite/Makefile.in: Rebuild.
4037
4038 2010-09-17 Doug Kwan <dougkwan@google.com>
4039
4040 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4041 defintion if relocation uses GOT entries of the symbol.
4042 * testsuite/icf_safe_test.sh: Fix test.
4043 * testsuite/icf_safe_so_test.sh: Fix test.
4044
4045 2010-09-16 Cary Coutant <ccoutant@google.com>
4046
4047 * script_sections.cc (class Memory_region): Remove "NULL" from
4048 vector initializations.
4049
4050 2010-09-15 Cary Coutant <ccoutant@google.com>
4051
4052 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4053 Resolve forwarding symbols.
4054
4055 2010-09-15 Doug Kwan <dougkwan@google.com>
4056
4057 * gold/testsuite/script_test_3.t: Add ARM special sections.
4058 * gold/testsuite/script_test_4.t: Same.
4059 * gold/testsuite/script_test_5.t: Same.
4060 * gold/testsuite/script_test_6.t: Same.
4061 * gold/testsuite/script_test_7.t: Same.
4062 * gold/testsuite/script_test_7.t: Same.
4063 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4064
4065 2010-09-14 Cary Coutant <ccoutant@google.com>
4066
4067 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4068 (Target_x86_64::Relocate::relocate_tls): Replace check for
4069 saw_tls_block_reloc_ with test for executable section.
4070
4071 2010-09-12 Cary Coutant <ccoutant@google.com>
4072
4073 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4074 position-independent executables to shared libraries need dynamic
4075 relocations.
4076 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4077 position-independent executables.
4078 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4079 * testsuite/Makefile.in: Regenerate.
4080
4081 2010-09-10 Nick Clifton <nickc@redhat.com>
4082
4083 PR gold/11997
4084 * testsuite/memory_test.t: Discard any sections that are not
4085 needed.
4086
4087 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4088
4089 PR gold/11996
4090 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4091 "This::" to work around a bug in gcc 4.2.
4092
4093 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4094
4095 2010-09-09 Rafael Espindola <espindola@google.com>
4096
4097 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4098 sections with different PF_X flags in the same segment.
4099 (Layout::find_first_load_seg): Search all segments to find the first
4100 one.
4101 * options.h (rosegment): New.
4102
4103 2010-09-08 Rafael Espindola <espindola@google.com>
4104
4105 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4106
4107 2010-09-08 Doug Kwan <dougkwan@google.com>
4108
4109 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4110 (Arm_relobj::do_relocate_sections): Add new parameter for output
4111 file to match the parent.
4112 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4113 of local symbols instead of input values. Update code to track
4114 changes in gold::relocate_section.
4115 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4116 (Sized_relobj::compute_final_local_value_internal): New methods.
4117 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4118 body into private version of Sized_relobj::compute_final_local_value.
4119 Call the inline method.
4120 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4121 merged symbol value if there is one.
4122 (Symbol_value::has_output_value): New method defintiion.
4123 (Sized_relobj::Compute_final_local_value_status): New enum type.
4124 (Sized_relobj::compute_final_local_value): New methods.
4125 (Sized_relobj::compute_final_local_value_internal): New methods.
4126 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4127 and arm_cortex_a8.sh.
4128 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4129 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4130 New tests.
4131 * Makefile.in: Regenerate.
4132 * testsuite/arm_bl_out_of_range.s: Update test.
4133 * testsuite/thumb_bl_out_of_range.s: Ditto.
4134 * testsuite/thumb_blx_out_of_range.s: Ditto.
4135 * testsuite/arm_branch_out_of_range.sh: New file.
4136 * testsuite/arm_cortex_a8.sh: Ditto.
4137 * testsuite/arm_cortex_a8_b.s: Ditto.
4138 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4139 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4140 * testsuite/arm_cortex_a8_bl.s: Ditto.
4141 * testsuite/arm_cortex_a8_blx.s: Ditto.
4142 * testsuite/arm_cortex_a8_local.s: Ditto.
4143 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4144 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4145
4146 2010-09-08 Rafael Espindola <espindola@google.com>
4147
4148 * Makefile.am (memory_test.stdout): Run readelf with -W.
4149 * Makefile.in: Regenerate.
4150 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4151 64 bit output.
4152
4153 2010-09-08 Rafael Espindola <espindola@google.com>
4154
4155 * script-sections.cc (Script_sections::add_memory_region): Convert
4156 field precision to int.
4157 * script.cc (script_set_section_region, script_set_section_region):
4158 Convert field precision to int.
4159
4160 2010-09-08 Rafael Espindola <espindola@google.com>
4161
4162 * arm.cc (do_finalize_sections): Create the __exidx_start and
4163 __exdix_end symbols even when the section is missing.
4164
4165 2010-09-08 Nick Clifton <nickc@redhat.com>
4166
4167 * README: Remove claim that MEMORY is not supported.
4168 * expression.cc (script_exp_function_origin)
4169 (script_exp_function_length): Move from here to ...
4170 * script.cc: ... here.
4171 (script_set_section_region, script_add_memory)
4172 (script_parse_memory_attr, script_include_directive): New
4173 functions.
4174 * script-sections.cc
4175 (class Memory_region): New class.
4176 (class Output_section_definition): Add set_memory_region,
4177 set_section_vma, set_section_lma and get_section_name methods.
4178 (class Script_Sections): Add add_memory_region,
4179 find_memory_region, find_memory_region_origin,
4180 find_memory_region_length and set_memory_region methods.
4181 Have set_section_addresses method walk the list of set memory
4182 regions.
4183 Extend the print methos to display memory regions.
4184 * script-sections.h: Add prototypes for new methods.
4185 Add enum for MEMORY region attributes.
4186 * yyscript.y: Add support for parsing MEMORY regions.
4187 * script-c.h: Add prototypes for new functions.
4188 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4189 * testsuite/Makefile.in: Regenerate.
4190 * testsuite/memory_test.sh: New script.
4191 * testsuite/memory_test.s: New assembler source file.
4192 * testsuite/memory_test.t: New linker script.
4193
4194 2010-08-27 Doug Kwan <dougkwan@google.com>
4195
4196 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4197 reference override an existing dynamic weak reference.
4198 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4199 * testsuite/Makefile.in: Regenerate.
4200 * testsuite/dyn_weak_ref.sh: New file.
4201 * testsuite/dyn_weak_ref_1.c: Ditto.
4202 * testsuite/dyn_weak_ref_2.c: Ditto.
4203
4204 2010-08-27 Ian Lance Taylor <iant@google.com>
4205
4206 * incremental.h (class Incremental_input_entry): Add virtual
4207 destructor.
4208
4209 2010-08-27 Ian Lance Taylor <iant@google.com>
4210
4211 * testsuite/start_lib_test_3.c: Mark t3 as used.
4212
4213 2010-08-27 Nick Clifton <nickc@redhat.com>
4214
4215 * options.cc (version_script): Fix small typo in previous
4216 whitespace tidyup.
4217
4218 2010-08-25 Nick Clifton <nickc@redhat.com>
4219
4220 * archive.cc: Formatting fixes: Remove whitespace between
4221 typename and following asterisk. Remove whitespace between
4222 function name and opening parenthesis.
4223 * archive.h: Likewise.
4224 * arm.cc: Likewise.
4225 * attributes.cc: Likewise.
4226 * attributes.h: Likewise.
4227 * common.cc: Likewise.
4228 * copy-relocs.cc: Likewise.
4229 * dirsearch.h: Likewise.
4230 * dynobj.cc: Likewise.
4231 * ehframe.cc: Likewise.
4232 * ehframe.h: Likewise.
4233 * expression.cc: Likewise.
4234 * fileread.cc: Likewise.
4235 * fileread.h: Likewise.
4236 * gc.h: Likewise.
4237 * gold-threads.cc: Likewise.
4238 * gold.cc: Likewise.
4239 * i386.cc: Likewise.
4240 * icf.h: Likewise.
4241 * incremental-dump.cc: Likewise.
4242 * incremental.cc: Likewise.
4243 * layout.cc: Likewise.
4244 * layout.h: Likewise.
4245 * main.cc: Likewise.
4246 * merge.cc: Likewise.
4247 * merge.h: Likewise.
4248 * object.cc: Likewise.
4249 * object.h: Likewise.
4250 * options.cc: Likewise.
4251 * options.h: Likewise.
4252 * output.cc: Likewise.
4253 * output.h: Likewise.
4254 * plugin.cc: Likewise.
4255 * plugin.h: Likewise.
4256 * powerpc.cc: Likewise.
4257 * reloc.cc: Likewise.
4258 * script-c.h: Likewise.
4259 * script-sections.cc: Likewise.
4260 * script.cc: Likewise.
4261 * stringpool.cc: Likewise.
4262 * symtab.cc: Likewise.
4263 * symtab.h: Likewise.
4264 * target.cc: Likewise.
4265 * timer.cc: Likewise.
4266 * timer.h: Likewise.
4267 * version.cc: Likewise.
4268 * x86_64.cc: Likewise.
4269
4270 2010-08-24 Nick Clifton <nickc@redhat.com>
4271
4272 PR 11899
4273 * layout.cc (segment_precedes): Sort segments by their physical
4274 addresses, if they have been set.
4275
4276 2010-08-23 Cary Coutant <ccoutant@google.com>
4277
4278 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4279 symbols data.
4280 (Lib_group::include_member): Unlock object after deleting its
4281 symbols data.
4282 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4283 the bug fixed here.
4284
4285 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4286 Cary Coutant <ccoutant@google.com>
4287
4288 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4289 constructor, and set_blocker.
4290 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4291 readsyms_blocker_.
4292 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4293 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4294 * testsuite/Makefile.am (start_lib_test): New test case.
4295 * testsuite/Makefile.in: Regenerate.
4296 * testsuite/start_lib_test_main.c: New file.
4297 * testsuite/start_lib_test_1.c: New file.
4298 * testsuite/start_lib_test_2.c: New file.
4299 * testsuite/start_lib_test_3.c: New file.
4300
4301 2010-08-19 Ian Lance Taylor <iant@google.com>
4302
4303 * Makefile.in: Rebuild with automake 1.11.1.
4304 * aclocal.m4: Likewise.
4305 * testsuite/Makefile.in: Likewise.
4306
4307 2010-08-19 Ian Lance Taylor <iant@google.com>
4308
4309 PR 10893
4310 * i386.cc (class Output_data_plt_i386): Update declarations.
4311 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4312 local_ifuncs_ fields.
4313 (Target_i386::do_plt_section_for_global): New function.
4314 (Target_i386::do_plt_section_for_local): New function.
4315 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4316 parameter; change all callers. Initialize global_ifuncs_ and
4317 local_ifuncs_. If doing a static link define __rel_iplt_start and
4318 __rel_iplt_end.
4319 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4320 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4321 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4322 symbols.
4323 (Target_i386::make_plt_section): New function, broken out of
4324 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4325 (Target_i386::make_plt_entry): Call make_plt_section.
4326 (Target_i386::make_local_ifunc_plt_entry): New function.
4327 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4328 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4329 R_386_IRELATIVE to switch.
4330 (Target_i386::Scan::global): Likewise.
4331 (Target_i386::Relocate::relocate): Likewise.
4332 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4333 switch.
4334 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4335 (Target_x86_64::do_plt_section_for_global): New function.
4336 (Target_x86_64::do_plt_section_for_local): New function.
4337 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4338 parameter; change all callers. If doing a static link define
4339 __rela_iplt_start and __rela_iplt_end.
4340 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4341 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4342 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4343 to point to .plt.
4344 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4345 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4346 switch.
4347 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4348 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4349 R_X86_64_IRELATIVE to switch.
4350 (Target_x86_64::Scan::global): Likewise.
4351 (Target_x86_64::Relocate::relocate): Likewise.
4352 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4353 switch.
4354 * target.h (class Target): Add plt_section_for_global and
4355 plt_section_for_local functions. Add do_plt_section_for_global
4356 and do_plt_section_for_local virtual functions.
4357 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4358 clarifying comments.
4359 (Symbol::use_plt_offset): Handle IFUNC symbol.
4360 * object.cc (Sized_relobj::Sized_relobj): Initialize
4361 local_plt_offsets_.
4362 (Sized_relobj::local_has_plt_offset): New function.
4363 (Sized_relobj::local_plt_offset): New function.
4364 (Sized_relobj::set_local_plt_offset): New function.
4365 (Sized_relobj::do_count): Handle IFUNC symbol.
4366 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4367 a bit away from input_shndx_ field. Add set_is_func_symbol and
4368 is_ifunc_symbol functions.
4369 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4370 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4371 local_plt_offsets_ field.
4372 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4373 * output.h (class Output_section_data): Add non-const
4374 output_section function.
4375 (class Output_data_got): Update declarations.
4376 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4377 Add use_plt_offset parameter to global and local constructors.
4378 Change all callers. Change local_sym_index_ field to 31 bits.
4379 Change GSYM_CODE and CONSTANT_CODE accordingly.
4380 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4381 doing a static link don't set sh_link field.
4382 (Output_data_got::Got_entry::write): Use PLT offset if
4383 appropriate.
4384 (Output_data_got::add_global_plt): New function.
4385 (Output_data_got::add_local_plt): New function.
4386 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4387 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4388 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4389 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4390 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4391 IFUNC conditional.
4392 * testsuite/ifunc-sel.h: New file.
4393 * testsuite/ifuncmain1.c: New file.
4394 * testsuite/ifuncmain1vis.c: New file.
4395 * testsuite/ifuncmod1.c: New file.
4396 * testsuite/ifuncdep2.c: New file.
4397 * testsuite/ifuncmain2.c: New file.
4398 * testsuite/ifuncmain3.c: New file.
4399 * testsuite/ifuncmod3.c: New file.
4400 * testsuite/ifuncmain4.c: New file.
4401 * testsuite/ifuncmain5.c: New file.
4402 * testsuite/ifuncmod5.c: New file.
4403 * testsuite/ifuncmain6pie.c: New file.
4404 * testsuite/ifuncmod6.c: New file.
4405 * testsuite/ifuncmain7.c: New file.
4406 * configure, testsuite/Makefile.in: Rebuild.
4407
4408 2010-08-18 Ian Lance Taylor <iant@google.com>
4409
4410 * incremental.cc
4411 (Output_section_incremental_inputs::write_input_files): Add cast
4412 to avoid signed/unsigned comparison warning.
4413 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4414
4415 2010-08-12 Cary Coutant <ccoutant@google.com>
4416
4417 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4418
4419 2010-08-13 Ian Lance Taylor <iant@google.com>
4420
4421 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4422
4423 2010-08-12 Cary Coutant <ccoutant@google.com>
4424 Doug Kwan <dougkwan@google.com>
4425
4426 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4427 defintion overrides non-weak undef, remember that the original undef
4428 is not weak.
4429 * symtab.cc (Symbol_table::sized_write_global): For undef without
4430 an original weak binding, set binding to global in output.
4431 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4432 * testsuite/Makefile.in: Regenerate.
4433 * testsuite/strong_ref_weak_def.sh: New file.
4434 * testsuite/strong_ref_weak_def_1.c: Ditto.
4435 * testsuite/strong_ref_weak_def_2.c: Ditto.
4436
4437 2010-08-12 Cary Coutant <ccoutant@google.com>
4438
4439 * testsuite/incremental_test.sh: Rewrite.
4440 * testsuite/incremental_test_1.c: Rewrite.
4441 * testsuite/incremental_test_2.c: Rewrite.
4442
4443 2010-08-12 Cary Coutant <ccoutant@google.com>
4444
4445 * arm.cc (Target_arm::got_size): Add const.
4446 (Target_arm::got_entry_count): New function.
4447 (Target_arm::plt_entry_count): New function.
4448 (Target_arm::first_plt_entry_offset): New function.
4449 (Target_arm::plt_entry_size): New function.
4450 (Output_data_plt_arm::entry_count): New function.
4451 (Output_data_plt_arm::first_plt_entry_offset): New function.
4452 (Output_data_plt_arm::get_plt_entry_size): New function.
4453 * i386.cc (Target_i386::got_size): Add const.
4454 (Target_i386::got_entry_count): New function.
4455 (Target_i386::plt_entry_count): New function.
4456 (Target_i386::first_plt_entry_offset): New function.
4457 (Target_i386::plt_entry_size): New function.
4458 (Output_data_plt_i386::entry_count): New function.
4459 (Output_data_plt_i386::first_plt_entry_offset): New function.
4460 (Output_data_plt_i386::get_plt_entry_size): New function.
4461 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4462 find_incremental_inputs_sections. Dump incremental_got_plt section.
4463 * incremental.cc: Include target.h.
4464 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4465 parameter. Adjust all callers. Find incremental_got_plt section.
4466 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4467 section.
4468 (Output_section_incremental_inputs::set_final_data_size): Calculate
4469 size of incremental_got_plt section.
4470 (Output_section_incremental_inputs::do_write): Write the
4471 incremental_got_plt section.
4472 (Got_plt_view_info): New struct.
4473 (Local_got_offset_visitor): New class.
4474 (Global_got_offset_visitor): New class.
4475 (Global_symbol_visitor_got_plt): New class.
4476 (Output_section_incremental_inputs::write_got_plt): New function.
4477 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4478 Add parameter. Adjust all callers.
4479 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4480 (Incremental_inputs::got_plt_section): New function.
4481 (Incremental_inputs::got_plt_section_): New data member.
4482 (Incremental_got_plt_reader): New class.
4483 * layout.cc (Layout::create_incremental_info_sections): Add the
4484 incremental_got_plt section.
4485 * object.h (Got_offset_list::get_list): New function.
4486 (Got offset_list::for_all_got_offsets): New function.
4487 (Sized_relobj::local_got_offset_list): New function.
4488 * powerpc.cc (Target_powerpc::got_size): Add const.
4489 (Target_powerpc::got_entry_count): New function.
4490 (Target_powerpc::plt_entry_count): New function.
4491 (Target_powerpc::first_plt_entry_offset): New function.
4492 (Target_powerpc::plt_entry_size): New function.
4493 (Output_data_plt_powerpc::entry_count): New function.
4494 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4495 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4496 * sparc.cc (Target_sparc::got_size): Add const.
4497 (Target_sparc::got_entry_count): New function.
4498 (Target_sparc::plt_entry_count): New function.
4499 (Target_sparc::first_plt_entry_offset): New function.
4500 (Target_sparc::plt_entry_size): New function.
4501 (Output_data_plt_sparc::entry_count): New function.
4502 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4503 (Output_data_plt_sparc::get_plt_entry_size): New function.
4504 * symtab.h (Symbol::got_offset_list): New function.
4505 (Symbol_table::for_all_symbols): New function.
4506 * target.h (Sized_target::got_entry_count): New function.
4507 (Sized_target::plt_entry_count): New function.
4508 (Sized_target::plt_entry_size): New function.
4509 * x86_64.cc (Target_x86_64::got_size): Add const.
4510 (Target_x86_64::got_entry_count): New function.
4511 (Target_x86_64::plt_entry_count): New function.
4512 (Target_x86_64::first_plt_entry_offset): New function.
4513 (Target_x86_64::plt_entry_size): New function.
4514 (Output_data_plt_x86_64::entry_count): New function.
4515 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4516 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4517
4518 2010-08-12 Cary Coutant <ccoutant@google.com>
4519
4520 * archive.cc: Include incremental.h.
4521 (Archive::Archive): Initialize incremental_info_.
4522 (Archive::include_member): Record archive members in incremental info.
4523 (Add_archive_symbols::run): Record begin and end of an archive in
4524 incremental info.
4525 (Lib_group::include_member): Record objects in incremental info.
4526 * archive.h (Incremental_archive_entry): Forward declaration.
4527 (Archive::set_incremental_info): New member function.
4528 (Archive::incremental_info): New member function.
4529 (Archive::Unused_symbol_iterator): New class.
4530 (Archive::unused_symbols_begin): New member function.
4531 (Archive::unused_symbols_end): New member function.
4532 (Archive::incremental_info_): New data member.
4533 * incremental-dump.cc (find_input_containing_global): New function.
4534 (dump_incremental_inputs): Dump new incremental info sections.
4535 * incremental.cc: Include symtab.h.
4536 (Output_section_incremental_inputs): New class.
4537 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4538 new incremental info sections.
4539 (Sized_incremental_binary::do_check_inputs): Likewise.
4540 (Incremental_inputs::report_archive): Remove.
4541 (Incremental_inputs::report_archive_begin): New function.
4542 (Incremental_inputs::report_archive_end): New function.
4543 (Incremental_inputs::report_object): New function.
4544 (Incremental_inputs::finalize_inputs): Remove.
4545 (Incremental_inputs::report_input_section): New function.
4546 (Incremental_inputs::report_script): Rewrite.
4547 (Incremental_inputs::finalize): Do nothing but finalize string table.
4548 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4549 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4550 (Incremental_inputs::create_data_sections): New function.
4551 (Incremental_inputs::relocs_entsize): New function.
4552 (Output_section_incremental_inputs::set_final_data_size): New function.
4553 (Output_section_incremental_inputs::do_write): New function.
4554 (Output_section_incremental_inputs::write_header): New function.
4555 (Output_section_incremental_inputs::write_input_files): New function.
4556 (Output_section_incremental_inputs::write_info_blocks): New function.
4557 (Output_section_incremental_inputs::write_symtab): New function.
4558 * incremental.h (Incremental_script_entry): Forward declaration.
4559 (Incremental_object_entry): Forward declaration.
4560 (Incremental_archive_entry): Forward declaration.
4561 (Incremental_inputs): Forward declaration.
4562 (Incremental_inputs_header_data): Remove.
4563 (Incremental_inputs_header): Remove.
4564 (Incremental_inputs_header_write): Remove.
4565 (Incremental_inputs_entry_data): Remove.
4566 (Incremental_inputs_entry): Remove.
4567 (Incremental_inputs_entry_write): Remove.
4568 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4569 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4570 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4571 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4572 Likewise.
4573 (Incremental_input_entry): New class.
4574 (Incremental_script_entry): New class.
4575 (Incremental_object_entry): New class.
4576 (Incremental_archive_entry): New class.
4577 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4578 (Incremental_inputs::report_inputs): Remove.
4579 (Incremental_inputs::report_archive): Remove.
4580 (Incremental_inputs::report_archive_begin): New function.
4581 (Incremental_inputs::report_archive_end): New function.
4582 (Incremental_inputs::report_object): Change prototype.
4583 (Incremental_inputs::report_input_section): New function.
4584 (Incremental_inputs::report_script): Change prototype.
4585 (Incremental_inputs::get_reloc_count): New function.
4586 (Incremental_inputs::set_reloc_count): New function.
4587 (Incremental_inputs::create_data_sections): New function.
4588 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4589 (Incremental_inputs::inputs_section): New function.
4590 (Incremental_inputs::symtab_section): New function.
4591 (Incremental_inputs::relocs_section): New function.
4592 (Incremental_inputs::get_stringpool): Add const.
4593 (Incremental_inputs::command_line): Add const.
4594 (Incremental_inputs::inputs): Remove.
4595 (Incremental_inputs::command_line_key): New function.
4596 (Incremental_inputs::input_file_count): New function.
4597 (Incremental_inputs::input_files): New function.
4598 (Incremental_inputs::relocs_entsize): New function.
4599 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4600 (Incremental_inputs::finalize_inputs): Remove.
4601 (Incremental_inputs::Input_info): Remove.
4602 (Incremental_inputs::lock_): Remove.
4603 (Incremental_inputs::inputs_): Change type.
4604 (Incremental_inputs::inputs_map_): Remove.
4605 (Incremental_inputs::current_object_entry_): New data member.
4606 (Incremental_inputs::inputs_section_): New data member.
4607 (Incremental_inputs::symtab_section_): New data member.
4608 (Incremental_inputs::relocs_section_): New data member.
4609 (Incremental_inputs::reloc_count_): New data member.
4610 (Incremental_inputs_reader): New class.
4611 (Incremental_symtab_reader): New class.
4612 (Incremental_relocs_reader): New class.
4613 * layout.cc (Layout::finalize): Move finalization of incremental info
4614 and creation of incremental info sections to follow finalization of
4615 symbol table. Set offsets for postprocessing sections.
4616 (Layout::create_incremental_info_sections): Call
4617 Incremental_inputs::create_data_sections. Add incremental symtab
4618 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4619 sections to layout after input sections.
4620 * layout.h (struct Timespec): Forward declaration.
4621 (Layout::incremental_inputs): Add const.
4622 (Layout::create_incremental_info_sections): Add parameter.
4623 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4624 * object.cc: Include incremental.h.
4625 (Relobj::finalize_incremental_relocs): New function.
4626 (Sized_relobj::do_layout): Record input sections in incremental info.
4627 * object.h (Object::output_section): New function.
4628 (Object::output_section_offset): Moved from Relobj.
4629 (Object::get_incremental_reloc_base): New function.
4630 (Object::get_incremental_reloc_count): New function.
4631 (Object::do_output_section): New function.
4632 (Object::do_output_section_offset): Moved from Relobj.
4633 (Object::do_get_incremental_reloc_base): New function.
4634 (Object::do_get_incremental_reloc_count): New function.
4635 (Object::Object): Initialize new data members.
4636 (Relobj::output_section): Renamed do_output_section and moved to
4637 protected.
4638 (Relobj::output_section_offset): Moved to Object.
4639 (Relobj::do_get_incremental_reloc_base): New function.
4640 (Relobj::do_get_incremental_reloc_count): New function.
4641 (Relobj::allocate_incremental_reloc_counts): New function.
4642 (Relobj::count_incremental_reloc): New function.
4643 (Relobj::finalize_incremental_relocs): New function.
4644 (Relobj::next_incremental_reloc_index): New function.
4645 (Relobj::reloc_counts_): New data member.
4646 (Relobj::reloc_bases_): New data member.
4647 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4648 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4649 (Sized_relobj::incremental_relocs_scan): New function.
4650 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4651 (Sized_relobj::incremental_relocs_write): New function.
4652 (Sized_relobj::incremental_relocs_write_reltype): New function.
4653 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4654 incremental link.
4655 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4656 archives and object files elsewhere.
4657 (Add_symbols::run): Report object files here.
4658 (Finish_group::run): Report end of archive at end of group.
4659 * reloc.cc: Include layout.h, incremental.h.
4660 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4661 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4662 (Sized_relobj::incremental_relocs_scan): New function.
4663 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4664 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4665 (Sized_relobj::incremental_relocs_write): New function.
4666 (Sized_relobj::incremental_relocs_write_reltype): New function.
4667 * script.cc (read_input_script): Rewrite test for incremental link.
4668 Change call to Incremental_inputs::report_script.
4669 * symtab.h (Symbol_table::first_global_index): New function.
4670 (Symbol_table::output_count): New function.
4671
4672 2010-08-12 Doug Kwan <dougkwan@google.com>
4673
4674 * arm.cc (Target_arm::merge_object_attributes): Check command line
4675 options --no-wchar-size-warning and --no-enum-size-warning.
4676 * options.h (General_options): Add ld-compatible options
4677 --no-enum-size-warning and --no-wchar-size-warning.
4678
4679 2010-08-04 Ian Lance Taylor <iant@google.com>
4680
4681 * x86_64.cc (Target_x86_64::Scan::local): Use
4682 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4683 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4684 (Target_x86_64::Scan::global): Likewise.
4685 (Target_x86_64::Relocate::relocate): Likewise.
4686 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4687 Likewise.
4688
4689 2010-08-03 Cary Coutant <ccoutant@google.com>
4690
4691 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4692 to reserve space in merged_strings vector. Keep total input size
4693 for stats.
4694 (Output_merge_string::do_print_merge_stats): Print total input size.
4695 * merge.h (Output_merge_string): Add input_size_ field.
4696 * stringpool.cc (Stringpool_template::string_length): Move
4697 implementations out of Stringpool_template class and place in
4698 stringpool.h.
4699 * stringpool.h (string_length): Move out of Stringpool_template.
4700
4701 2010-08-03 Ian Lance Taylor <iant@google.com>
4702
4703 PR 11712
4704 * layout.cc (relaxation_loop_body): If address of load segment is
4705 set, adjust address to include headers if possible.
4706
4707 2010-08-03 Ian Lance Taylor <iant@google.com>
4708
4709 * version.cc (version_string): Bump to 1.10.
4710
4711 2010-08-03 Ian Lance Taylor <iant@google.com>
4712
4713 PR 11805
4714 * layout.h (enum Output_section_order): Define.
4715 (class Layout): Update declarations.
4716 * layout.cc (Layout::get_output_section): Add order parameter.
4717 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4718 is_first_non_relro parameters. Change all callers.
4719 (Layout::choose_output_section): Likewise.
4720 (Layout::add_output_section_data): Likewise.
4721 (Layout::make_output_section): Likewise. Set order.
4722 (Layout::default_section_order): New function.
4723 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4724 * output.cc (Output_section::Output_section): Initialize order_.
4725 Don't initialize deleted fields.
4726 (Output_segment::Output_segment): Don't initialize deleted
4727 fields.
4728 (Output_segment::add_output_section_to_load): New function
4729 replacing add_output_section. Change all callers to call this or
4730 add_output_section_to_nonload.
4731 (Output_segment::add_output_section_to_nonload): New function.
4732 (Output_segment::remove_output_section): Rewrite.
4733 (Output_segment::add_initial_output_data): Likewise.
4734 (Output_segment::has_any_data_sections): Likewise.
4735 (Output_segment::is_first_section_relro): Likewise.
4736 (Output_segment::maximum_alignment): Likewise.
4737 (Output_segment::has_dynamic_reloc): New function replacing
4738 dynamic_reloc_count. Change all callers.
4739 (Output_segment::has_dynamic_reloc_list): New function replacing
4740 dynamic_reloc_count_list. Change all callers.
4741 (Output_segment::set_section_addresses): Rewrite.
4742 (Output_segment::set_offset): Rewrite.
4743 (Output_segment::find_first_and_last_list): Remove.
4744 (Output_segment::set_tls_offsets): Rewrite.
4745 (Output_segment::first_section_load_address): Likewise.
4746 (Output_segment::output_section_count): Likewise.
4747 (Output_segment::section_with_lowest_load_address): Likewise.
4748 (Output_segment::write_section_headers): Likewise.
4749 (Output_segment::print_sections_to_map): Likewise.
4750 * output.h (class Output_data): Remove dynamic_reloc_count_
4751 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4752 (Output_data::add_dynamic_reloc): Rewrite.
4753 (Output_data::has_dynamic_reloc): New function.
4754 (Output_data::dynamic_reloc_count): Remove.
4755 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4756 is_last_relro_, is_first_non_relro_, is_interp_,
4757 is_dynamic_linker_section_ fields. Add order and set_order
4758 functions. Remove is_relro_local, set_is_relro_local,
4759 is_last_relro, set_is_last_relro, is_first_non_relro,
4760 set_is_first_non_relro functions, is_interp, set_is_interp,
4761 is_dynamic_linker_section, and set_is_dynamic_linker_section
4762 functions.
4763 (class Output_segment): Change Output_data_list from std::list to
4764 std:;vector. Add output_lists_ field. Remove output_data_ and
4765 output_bss_ fields. Update declarations.
4766
4767 2010-08-02 Ian Lance Taylor <iant@google.com>
4768
4769 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4770 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4771 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4772
4773 2010-08-02 Ian Lance Taylor <iant@google.com>
4774
4775 PR 11855
4776 * script.cc (Script_options::Script_options): Initialize
4777 symbol_definitions_ and symbol_references_.
4778 (Script_options::add_symbol_assignment): Update
4779 symbol_definitions_ and symbol_references_.
4780 (Script_options::add_symbol_reference): New function.
4781 (script_symbol): New function.
4782 * script.h (class Script_options): Add symbol_definitions_ and
4783 symbol_references_ fields.
4784 (Script_options::referenced_const_iterator): New type.
4785 (Script_options::referenced_begin): New function.
4786 (Script_options::referenced_end): New function.
4787 (Script_options::is_referenced): New function.
4788 (Script_options::any_unreferenced): New function.
4789 * script-c.h (script_symbol): Declare.
4790 * yyscript.y (exp): Call script_symbol.
4791 * symtab.cc: Include "script.h".
4792 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4793 Change all callers. Check symbols referenced by scripts.
4794 (Symbol_table::add_undefined_symbols_from_command_line): Add
4795 layout parameter. Change all callers.
4796 (Symbol_table::do_add_undefined_symbols_from_command_line):
4797 Likewise. Break out loop body. Check symbols referenced by
4798 scripts.
4799 (Symbol_table::add_undefined_symbol_from_command_line): New
4800 function broken out of
4801 do_add_undefined_symbols_from_command_line.
4802 * symtab.h (class Symbol_table): Update declarations.
4803 * archive.cc: Include "layout.h".
4804 (Archive::should_include_member): Add layout parameter. Change
4805 all callers. Check for symbol mentioned in expression.
4806 * archive.h (class Archive): Update declaration.
4807 * object.cc (Sized_relobj::do_should_include_member): Add layout
4808 parameter.
4809 * object.h (Object::should_include_member): Add layout parameter.
4810 Change all callers.
4811 (Object::do_should_include_member): Add layout parameter.
4812 (class Sized_relobj): Update declaration.
4813 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4814 parameter.
4815 * dynobj.h (class Sized_dynobj): Update declaration.
4816 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4817 layout parameter.
4818 * plugin.h (class Sized_pluginobj): Update declaration.
4819
4820 2010-08-02 Ian Lance Taylor <iant@google.com>
4821
4822 PR 11866
4823 * output.cc (Output_segment::set_offset): Search for the first and
4824 last sections rather than assuming that the list is in order.
4825 (Output_segment::find_first_and_last_list): New function.
4826 * output.h (class Output_segment): Update declarations.
4827 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4828 (relro_strip_test_SOURCES): New variable.
4829 (relro_strip_test_DEPENDENCIES): New variable.
4830 (relro_strip_test_LDFLAGS): New variable.
4831 (relro_strip_test_LDADD): New variable.
4832 (relro_strip_test.so): New target.
4833
4834 2010-08-02 Ian Lance Taylor <iant@google.com>
4835
4836 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4837 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4838 (Target_i386::got_tlsdesc_section): New function.
4839 (Target_i386::got_section): Create space for GOT entries for
4840 TLSDESC relocations.
4841 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4842 R_386_TLS_GOTDESC.
4843 (Target_i386::Scan::global): Likewise.
4844 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4845 using TLSDESC GOT.
4846 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4847 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4848 (Target_x86_64::got_tlsdesc_section): New function.
4849 (Target_x86_64::got_section): Create space for GOT entries for
4850 TLSDESC relocations.
4851 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4852 R_386_TLS_GOTDESC.
4853 (Target_x86_64::Scan::global): Likewise.
4854 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4855 using TLSDESC GOT.
4856
4857 2010-08-02 Ian Lance Taylor <iant@google.com>
4858
4859 * testsuite/final_layout.sh: Use dc to convert from hex to
4860 decimal.
4861
4862 2010-07-29 Sriraman Tallam <tmsriram@google.com>
4863
4864 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4865 paramter to the call to gold::gc_process_relocs.
4866 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4867 paramter to the call to gold::gc_process_relocs.
4868 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4869 parameter to the call to gold::gc_process_relocs.
4870 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4871 template parameter to the call to gold::gc_process_relocs.
4872 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4873 paramter to the call to gold::gc_process_relocs.
4874 * gc.h (get_embedded_addend_size): New function.
4875 (gc_process_relocs): Save the size of the reloc for use by ICF.
4876 * icf.cc (get_section_contents): Get the addend from the text section
4877 for SHT_REL relocation sections.
4878 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4879 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4880 * int_encoding.h (read_from_pointer): New overloaded function.
4881 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4882 * testsuite/icf_sht_rel_addend_test.sh: New file.
4883 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4884 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4885
4886 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4887
4888 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4889 * Makefile.in: Regenerate.
4890 * testsuite/Makefile.in: Regenerate.
4891
4892 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4893
4894 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4895 * gold/testsuite/debug_msg.cc: Likewise.
4896 * gold/testsuite/odr_violation1.cc
4897 * gold/testsuite/odr_violation2.cc
4898
4899 2010-07-21 Cary Coutant <ccoutant@google.com>
4900
4901 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4902 string, and length fields.
4903 (Output_merge_string::Merged_strings_list): New type.
4904 (Output_merge_string::Merged_strings_lists): New typedef.
4905 (Output_merge_string): Replace merged_strings_ with
4906 merged_strings_lists_.
4907 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4908 Merged_strings_list per input object and section. Don't store pointer
4909 to the string. Don't store length with each merged string entry.
4910 (Output_merge_string::finalize_merged_data): Loop over list of merged
4911 strings lists. Recompute length of each merged string.
4912
4913 2010-07-15 Cary Coutant <ccoutant@google.com>
4914
4915 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4916 here.
4917
4918 2010-07-14 Ian Lance Taylor <iant@google.com>
4919
4920 * descriptors.cc (Descriptors::open): Report correct name in error
4921 message.
4922
4923 2010-07-13 Doug Kwan <dougkwan@google.com>
4924
4925 * arm.cc (Arm_input_section::Arm_input_section): For a
4926 SHT_ARM_EXIDX section, always keeps the input sections.
4927 (Arm_input_section::set_exidx_section_link): New method.
4928 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4929 has_errors_ to false.
4930 (Arm_exidx_input_section::has_errors,
4931 Arm_exidx_input_section::set_has_errors): New methods.
4932 (Arm_exidx_input_section::has_errors_): New data member.
4933 (Arm_relobj::get_exidx_shndx_list): New method.
4934 (Arm_output_section::append_text_sections_to_list): Do not skip
4935 section without SHF_EXECINSTR.
4936 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4937 errors.
4938 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4939 section header. Make error messages more verbose. Check for
4940 a non-executable section linked to an EXIDX section.
4941 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4942 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4943 check that there is no deferred EXIDX section if we exit early.
4944 Instead of not making an EXIDX section in case of an error, make one
4945 and set the has_errors flag of it.
4946 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4947 in a relocatable link.
4948 (Target_arm::do_relax): Look for the EXIDX output section instead of
4949 assuming that it is called .ARM.exidx.
4950 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4951 section list. Do not check for SHF_EXECINSTR section flags but
4952 skip any input section with errors.
4953 * output.cc (Output_section::Output_section): Initialize
4954 always_keeps_input_sections_ to false.
4955 (Output_section::add_input_section): Check for
4956 always_keeps_input_sections_.
4957 * output.h (Output_section::always_keeps_input_sections,
4958 Output_section::set_always_keeps_input_sections): New methods.
4959 (Output_section::always_keeps_input_sections): New data member.
4960
4961 2010-07-13 Rafael Espindola <espindola@google.com>
4962
4963 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4964 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4965
4966 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4967 Ian Lance Taylor <iant@google.com>
4968
4969 * output.h (Output_section_lookup_maps::add_merge_section):
4970 Correct check of whether value was inserted.
4971 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4972 (Output_section_lookup_maps::add_relaxed_input_section):
4973 Likewise.
4974 * arm.cc (Target_arm::got_section): Remove used local os.
4975 * i386.cc (Target_i386::got_section): Likewise.
4976 * x86_64.cc (Target_x86_64::got_section): Likewise.
4977 * sparc.cc (Target_sparc::got_section): Likewise.
4978 (Target_sparc::relocate): Remove unused local have_got_offset.
4979 * powerpc.cc (Target_powerpc::relocate): Likewise.
4980
4981 2010-07-13 Ian Lance Taylor <iant@google.com>
4982
4983 * compressed_output.cc (zlib_decompress): Fix signature in
4984 !HAVE_ZLIB_H case.
4985
4986 * archive.cc (Archive::include_member): Unlock an external member
4987 of a thin archive. Don't bother to delete an object we know is
4988 NULL.
4989
4990 2010-07-12 Cary Coutant <ccoutant@google.com>
4991
4992 * compressed_output.cc (zlib_decompress): New function.
4993 (get_uncompressed_size): New function.
4994 (decompress_input_section): New function.
4995 * compressed_output.h (get_uncompressed_size): New function.
4996 (decompress_input_section): New function.
4997 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4998 Handle compressed debug sections.
4999 * layout.cc (is_compressed_debug_section): New function.
5000 (Layout::output_section_name): Map compressed section names to
5001 canonical names.
5002 * layout.h (is_compressed_debug_section): New function.
5003 (is_debug_info_section): Recognize compressed debug sections.
5004 * merge.cc: Include compressed_output.h.
5005 (Output_merge_data::do_add_input_section): Handle compressed
5006 debug sections.
5007 (Output_merge_string::do_add_input_section): Handle compressed
5008 debug sections.
5009 * object.cc: Include compressed_output.h.
5010 (Sized_relobj::Sized_relobj): Initialize new data members.
5011 (build_compressed_section_map): New function.
5012 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5013 * object.h (Object::section_is_compressed): New method.
5014 (Object::do_section_is_compressed): New method.
5015 (Sized_relobj::Compressed_section_map): New type.
5016 (Sized_relobj::do_section_is_compressed): New method.
5017 (Sized_relobj::compressed_sections_): New data member.
5018 * output.cc (Output_section::add_input_section): Handle compressed
5019 debug sections.
5020 * reloc.cc: Include compressed_output.h.
5021 (Sized_relobj::write_sections): Handle compressed debug sections.
5022
5023 2010-07-08 Cary Coutant <ccoutant@google.com>
5024
5025 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5026 weak when resolving to a dynamic def.
5027 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5028 for weak undef/dynamic def cases. Adjust callers.
5029 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5030 undef_binding_weak_.
5031 (Symbol_table::sized_write_globals): Adjust symbol binding.
5032 (Symbol_table::sized_write_symbol): Add binding parameter.
5033 * symtab.h (Symbol::set_undef_binding): New method.
5034 (Symbol::is_undef_binding_weak): New method.
5035 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5036 (Symbol_table::should_override): Add new parameter.
5037 (Symbol_table::sized_write_symbol): Add new parameter.
5038
5039 * testsuite/weak_undef_file1.cc: Add new test case.
5040 * testsuite/weak_undef_file2.cc: Fix header comment.
5041 * testsuite/weak_undef_test.cc: Add new test case.
5042
5043 2010-06-29 Doug Kwan <dougkwan@google.com>
5044
5045 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5046 Initialize USE_SYMBOL_.
5047 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5048 definition.
5049 (Arm_reloc_property::uses_symbol_): New data member declaration.
5050 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5051 uses symbol value and symbol is undefined but not weakly undefined.
5052
5053 2010-06-28 Rafael Espindola <espindola@google.com>
5054
5055 * plugin.cc (Plugin::load): Use dlerror.
5056
5057 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5058
5059 * symtab.cc (detect_odr_violations): When reporting an ODR
5060 violation, report an object where the symbol is defined.
5061
5062 2010-06-25 Doug Kwan <dougkwan@google.com>
5063
5064 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5065 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5066 definition.
5067 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5068 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5069 target hook to detect function points.
5070 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5071 * icf.h (Icf::check_section_for_function_pointers): Change type of
5072 parameter SECTION_NAME to const reference to std::string. Use
5073 target hook to determine if section may have unsafe pointers.
5074 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5075 method definition.
5076
5077 2010-06-21 Rafael Espindola <espindola@google.com>
5078
5079 * fileread.cc (Input_file::find_fie): New
5080 (Input_file::open): Use Input_file::find_fie.
5081 * fileread.h (Input_file::find_fie): New
5082 * plugin.cc (set_extra_library_path): New.
5083 (Plugin::load): Add set_extra_library_path to the transfer vector.
5084 (Plugin_manager::set_extra_library_path): New.
5085 (Plugin_manager::add_input_file): Use the extra search path if set.
5086 (set_extra_library_path(): New.
5087 * plugin.h (Plugin_manager): Add set_extra_library_path and
5088 extra_search_path_.
5089
5090 2010-06-19 Cary Coutant <ccoutant@google.com>
5091
5092 * layout.cc (gdb_sections): Add .debug_types.
5093 (lines_only_debug_sections): Likewise.
5094
5095 2010-06-18 Rafael Espindola <espindola@google.com>
5096
5097 * plugin.cc (add_input_file,add_input_library)
5098 (Plugin_manager::add_input_file): Make filename arguments const.
5099 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5100 const.
5101
5102 2010-06-16 Doug Kwan <dougkwan@google.com>
5103
5104 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5105 .ARM.attributes section if we have not merged any input
5106 attributes sections.
5107
5108 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5109
5110 * arm.cc: Allow combining objects with no EABI version
5111 information.
5112
5113 2010-06-15 Rafael Espindola <espindola@google.com>
5114
5115 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5116
5117 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5118
5119 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5120 (struct iovec): Correct !HAVE_READV definition.
5121
5122 2010-06-10 Cary Coutant <ccoutant@google.com>
5123
5124 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5125 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5126 reloc sections.
5127 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5128
5129 PR 11683
5130 * symtab.h (Symbol::is_placeholder): New member function.
5131 * target-reloc.h (relocate_section): Check for placeholder symbols.
5132
5133 * testsuite/Makefile.am (plugin_test_8): New test.
5134 (plugin_test_9): New test.
5135 * testsuite/Makefile.in: Regenerate.
5136
5137 2010-06-09 Nick Clifton <nickc@redhat.com>
5138
5139 * yyscript.y (input_list_element): Allow strings prefixed with
5140 the '-' character. Treat these as libraries.
5141 * script.cc (script_add_library): New function. Adds a library
5142 specified by "-l<name>" found in an input script.
5143 * script-c.h: Add prototype for script_add_library.
5144
5145 2010-06-07 Doug Kwan <dougkwan@google.com>
5146
5147 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5148 Restrict stub-group size to be within long conditional branch
5149 range when working around cortex-A8 erratum.
5150
5151 2010-06-07 Damien Diederen <dd@crosstwine.com>
5152
5153 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5154 #ifdef typo.
5155
5156 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5157
5158 PR gold/11658
5159 * output.cc
5160 (Output_section::Input_section_sort_entry::compare_section_ordering):
5161 Change to return non-zero correctly.
5162 (Output_section::Input_section_sort_section_order_index_compare
5163 ::operator()): Change to fix ambiguity in comparisons.
5164
5165 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5166
5167 * gold.h (is_wildcard_string): New function.
5168 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5169 (Layout::layout_eh_frame): Ditto.
5170 (Layout::find_section_order_index): New method.
5171 (Layout::read_layout_from_file): New method.
5172 * layout.h (Layout::find_section_order_index): New method.
5173 (Layout::read_layout_from_file): New method.
5174 (Layout::input_section_position_): New private member.
5175 (Layout::input_section_glob_): New private member.
5176 * main.cc (main): Call read_layout_from_file here.
5177 * options.h (--section-ordering-file): New option.
5178 * output.cc (Output_section::input_section_order_specified_): New
5179 member.
5180 (Output_section::Output_section): Initialize new member.
5181 (Output_section::add_input_section): Add new parameter.
5182 Keep input sections when --section-ordering-file is used.
5183 (Output_section::set_final_data_size): Sort input sections when
5184 section ordering file is specified.
5185 (Output_section::Input_section_sort_entry): Add new parameter.
5186 Check sorting type.
5187 (Output_section::Input_section_sort_entry::compare_section_ordering):
5188 New method.
5189 (Output_section::Input_section_sort_compare::operator()): Change to
5190 consider section_order_index.
5191 (Output_section::Input_section_sort_init_fini_compare::operator()):
5192 Change to consider section_order_index.
5193 (Output_section::Input_section_sort_section_order_index_compare
5194 ::operator()): New method.
5195 (Output_section::sort_attached_input_sections): Change to sort
5196 according to section order when specified.
5197 (Output_section::add_input_section<32, true>): Add new parameter.
5198 (Output_section::add_input_section<64, true>): Add new parameter.
5199 (Output_section::add_input_section<32, false>): Add new parameter.
5200 (Output_section::add_input_section<64, false>): Add new parameter.
5201 * output.h (Output_section::add_input_section): Add new parameter.
5202 (Output_section::input_section_order_specified): New
5203 method.
5204 (Output_section::set_input_section_order_specified): New method.
5205 (Input_section::Input_section): Initialize section_order_index_.
5206 (Input_section::section_order_index): New method.
5207 (Input_section::set_section_order_index): New method.
5208 (Input_section::section_order_index_): New member.
5209 (Input_section::Input_section_sort_section_order_index_compare): New
5210 struct.
5211 (Output_section::input_section_order_specified_): New member.
5212 * script-sections.cc (is_wildcard_string): Delete and move modified
5213 method to gold.h.
5214 (Output_section_element_input::Output_section_element_input): Modify
5215 call to is_wildcard_string.
5216 (Output_section_element_input::Input_section_pattern
5217 ::Input_section_pattern): Ditto.
5218 (Output_section_element_input::Output_section_element_input): Ditto.
5219 * testsuite/Makefile.am (final_layout): New test case.
5220 * testsuite/Makefile.in: Regenerate.
5221 * testsuite/final_layout.cc: New file.
5222 * testsuite/final_layout.sh: New file.
5223
5224 2010-06-01 Rafael Espindola <espindola@google.com>
5225
5226 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5227
5228 2010-06-01 Rafael Espindola <espindola@google.com>
5229
5230 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5231 visibility of symbols.
5232
5233 2010-05-27 Doug Kwan <dougkwan@google.com>
5234
5235 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5236 from start of output section instead of address for a local symbol
5237 in a merged or relaxed section when doing a relocatable link.
5238
5239 2010-05-26 Rafael Espindola <espindola@google.com>
5240
5241 PR 11604
5242 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5243 adding sections the garbage collector removed.
5244 * gold/testsuite/Makefile.am: Add test.
5245 * gold/testsuite/Makefile.in: Regenerate.
5246 * gold/testsuite/plugin_test_7.sh: New.
5247 * gold/testsuite/plugin_test_7_1.c: New.
5248 * gold/testsuite/plugin_test_7_2.c: New.
5249
5250 2010-05-26 Rafael Espindola <espindola@google.com>
5251
5252 * script-sections.cc (Output_section_definition::set_section_addresses):
5253 Check for --section-start.
5254
5255 2010-05-26 Doug Kwan <dougkwan@google.com>
5256
5257 * arm.cc (Arm_scan_relocatable_relocs): New class.
5258 (Target_arm::relocate_special_relocatable): New method.
5259 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5260 (Arm_relocate_functions::thumb_branch_common): Same.
5261 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5262 instead of Default_scan_relocatable_relocs.
5263 * target-reloc.h (relocate_for_relocatable): Let target handle
5264 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5265 * target.h (Sized_target::relocate_special_relocatable): New method.
5266
5267 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5268
5269 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5270
5271 2010-05-23 Doug Kwan <dougkwan@google.com>
5272
5273 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5274 instead of a cast.
5275 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5276 with a direct branch, not a conditional branch, to a stub.
5277 * merge.cc (Output_merge_base::record_input_section): New method
5278 defintion.
5279 (Output_merge_data::do_add_input_section): Record input section if
5280 keeps-input-sections flag is set.
5281 (Output_merge_string::do_add_input_section): Ditto.
5282 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5283 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5284 INPUT_SECTIONS_.
5285 (Output_merge_base::keeps_input_sections,
5286 Output_merge_base::set_keeps_input_sections,
5287 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5288 method definitions.
5289 (Output_merge_base::Input_sections): New type declaration.
5290 (Output_merge_base::input_sections_begin,
5291 Output_merge_base::input_sections_end,
5292 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5293 (Output_merge_base::bool keeps_input_sections_,
5294 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5295 Output_merge_base::input_sections_): New data members.
5296 (Output_merge_data::do_set_keeps_input_sections): New method
5297 defintion.
5298 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5299 * output.cc (Output_section::Input_section::relobj): Move method
5300 defintion from class declaration to here and handle merge sections.
5301 (Output_section::Input_section::shndx): Ditto.
5302 (Output_section::Output_section): Remove initializations of removed
5303 data members and initialize new data member LOOKUP_MAPS_.
5304 (Output_section::add_input_section): Set keeps-input-sections flag
5305 for a newly created merge output section as appropriate. Adjust code
5306 to use Output_section_lookup_maps class.
5307 (Output_section::add_relaxed_input_section): Adjst code for lookup
5308 maps code refactoring.
5309 (Output_section::add_merge_input_section): Add a new parameter
5310 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5311 class. If adding input section to a newly created merge output
5312 section fails, remove the new merge section.
5313 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5314 Adjust code for use of the Output_section_lookup_maps class.
5315 (Output_section::find_merge_section): Ditto.
5316 (Output_section::build_lookup_maps): New method defintion.
5317 (Output_section::find_relaxed_input_section): Adjust code to use
5318 Output_section_lookup_maps class.
5319 (Output_section::get_input_sections): Export merge sections. Adjust
5320 code to use Output_section_lookup_maps class.
5321 (Output_section:::add_script_input_section): Adjust code to use
5322 Output_section_lookup_maps class. Update lookup maps for merge
5323 sections also.
5324 (Output_section::discard_states): Use Output_section_lookup_maps.
5325 (Output_section::restore_states): Same.
5326 * output.h (Merge_section_properties): Move class defintion out of
5327 Output_section.
5328 (Output_section_lookup_maps): New class.
5329 (Output_section::Input_section::is_merge_section): New method
5330 defintion.
5331 (Output_section::Input_section::relobj): Move defintion out of class
5332 defintion. Declare method only.
5333 (Output_section::Input_section::shndx): Ditto.
5334 (Output_section::Input_section::output_merge_base): New method defintion.
5335 (Output_section::Input_section::u2_.pomb): New union field.
5336 (Output_section::Merge_section_by_properties_map,
5337 Output_section::Output_section_data_by_input_section_map,
5338 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5339 Remove types.
5340 (Output_section::add_merge_input_section): Add new parameter
5341 KEEPS_INPUT_SECTIONS.
5342 (Output_section::build_lookup_maps): New method declaration.
5343 (Output_section::merge_section_map_,
5344 Output_section::merge_section_by_properties_map_,
5345 Output_section::relaxed_input_section_map_,
5346 Output_section::is_relaxed_input_section_map_valid_): Remove data
5347 members.
5348 (Output_section::lookup_maps_): New data member.
5349
5350 2010-05-21 Doug Kwan <dougkwan@google.com>
5351
5352 PR gold/11619
5353 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5354 avoid a compilation error.
5355
5356 2010-05-19 Rafael Espindola <espindola@google.com>
5357
5358 * script-sections.cc (Output_section_definition::allocate_to_segment):
5359 Update the phdrs_list even when the output section is NULL.
5360 * testsuite/Makefile.am: Add test.
5361 * testsuite/Makefile.in: Regenerate.
5362 * testsuite/script_test_9.cc: New.
5363 * testsuite/script_test_9.sh: New.
5364 * testsuite/script_test_9.t: New.
5365
5366 2010-05-19 Doug Kwan <dougkwan@google.com>
5367
5368 * arm.cc (Arm_input_section::original_size): New method.
5369 (Arm_input_section::do_addralign): Add a cast.
5370 (Arm_input_section::do_output_offset): Remove static cast.
5371 (Arm_input_section::original_addralign,
5372 Arm_input_section::original_size_): Change type to uint32_t.
5373 (Arm_input_section::init): Add safe casts for section alignment
5374 and size.
5375 (Arm_input_section::set_final_data_size): Do not set address and
5376 offset of stub table.
5377 (Arm_output_section::fix_exidx_coverage): Change use of of
5378 Output_section::Simple_input_section to that of
5379 Output_section::Input_section.
5380 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5381 except for the first pass.
5382 * output.cc (Output_section::get_input_sections): Change type of
5383 input_sections to std::list<Input_section>.
5384 (Output_section::add_script_input_section): Rename from
5385 Output_section::add_simple_input_section. Change type of SIS
5386 parameter from Simple_input_section to Input_section.
5387 * output.h (Output_section::Simple_input_section): Remove class.
5388 (Output_section::Input_section): Change class visibility to public.
5389 (Output_section::Input_section::addralign): Use stored alignments
5390 for special input sections if set.
5391 (Output_section::Input_section::set_addralign): New method.
5392 (Output_section::get_input_sections): Change parameter type from
5393 list of Simple_input_section to list of Input_section.
5394 (Output_section::add_script_input_section): Rename from
5395 Output_section::add_simple_input_section. Change first parameter's
5396 type from Simple_input_section to Input_section and remove the
5397 second and third parameters.
5398 * script-sections.cc (Input_section::Input_section_list): Change
5399 type to list of Output_section::Input_section/
5400 (Input_section_info::Input_section_info): Change parameter type of
5401 INPUT_SECTION to Output_section::Input_section.
5402 (Input_section_info::input_section): Change return type.
5403 (Input_section_info::input_section_): Change type to
5404 Output_section::Input_section.
5405 (Output_section_element_input::set_section_addresses): Adjust code
5406 to use Output_section::Input_section instead of
5407 Output_section::Simple_input_section. Adjust code for renaming
5408 of Output_section::add_simple_input_section.
5409 (Orphan_output_section::set_section_addresses): Ditto.
5410
5411 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5412
5413 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5414 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5415
5416 2010-05-18 Rafael Espindola <espindola@google.com>
5417
5418 * options.cc (General_options::finalize): Handle -nostdlib.
5419 * options.h (nostdlib): New option.
5420 * script.cc (script_add_search_dir): Handle -nostdlib.
5421
5422 2010-05-12 Doug Kwan <dougkwan@google.com>
5423
5424 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5425 attributes section only if there no attributes section after merging.
5426 (Target_arm::merge_object_attributes): Move value of
5427 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5428 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5429 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5430 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5431 and arm_attr_merge_7.stdout.
5432 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5433 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5434 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5435 arm_attr_merge_7b.o): New rules.
5436 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5437 arm_attr_merge_7
5438 * testsuite/Makefile.in: Regenerate.
5439 * testsuite/arm_attr_merge.sh: New file.
5440 * testsuite/arm_attr_merge_[67][ab].s: Same.
5441
5442 2010-05-05 Nick Clifton <nickc@redhat.com>
5443
5444 * po/es.po: Updated Spanish translation.
5445
5446 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5447
5448 * Makefile.am (install-exec-local): Properly install gold as
5449 default cross linker.
5450 * Makefile.in: Regenerated.
5451
5452 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5453 Nick Clifton <nickc@redhat.com>
5454
5455 * configure.ac (install_as_default): Define and set to false
5456 unless --enable-gold or --enable-gold=both/gold has been
5457 specified.
5458 * configure: Regenerate.
5459
5460 * Makefile.am (install-exec-local): Install the executable as
5461 'ld.gold'. If install_as_default is true then also install it as
5462 'ld'.
5463 * Makefile.in: Regenerated.
5464
5465 2010-04-24 Ian Lance Taylor <iant@google.com>
5466
5467 * layout.cc (Layout::layout_reloc): In relocatable link don't
5468 combine reloc sections for grouped sections.
5469
5470 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5471
5472 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5473 sections that are not ordinary to icf.
5474 * icf.cc (get_section_contents): Handle relocation pointing to section
5475 with no object or shndx information.
5476 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5477 * testsuite/Makefile.in: Regenerate.
5478 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5479 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5480
5481 2010-04-22 Ian Lance Taylor <iant@google.com>
5482
5483 * expression.cc (Expression::Expression_eval_info): Add
5484 result_alignment_pointer field.
5485 (Expression::eval_with_dot): Add result_alignment_pointer
5486 parameter. Change all callers.
5487 (Expression::eval_maybe_dot): Likewise.
5488 (class Binary_expression): Add alignment_pointer parameter to
5489 left_value and right_value. Change all callers.
5490 (BINARY_EXPRESSION): Set result alignment.
5491 (class Trinary_expression): Add alignment_pointer parameter to
5492 arg2_value and arg3_value. Change all callers.
5493 (Trinary_cond::value): Set result alignment.
5494 (Max_expression::value, Min_expression::value): Likewise.
5495 (Align_expression::value): Likewise.
5496 * script-sections.cc (class Sections_element): Add dot_alignment
5497 parameter to set_section_addresses virtual function. Update
5498 instantiations.
5499 (class Output_section_element): Likewise.
5500 (Script_sections::create_segments): Add dot_alignment parameter.
5501 Change all callers.
5502 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5503 (Script_sections::set_phdrs_clause_addresses): Likewise.
5504 * script-sections.h: Update declarations.
5505 * script.h: Update declarations.
5506 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5507 min_p_align.
5508 * testsuite/script_test_3.t: Set large alignment.
5509 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5510 segment has expected alignment.
5511
5512 2010-04-22 Nick Clifton <nickc@redhat.com>
5513
5514 * po/gold.pot: Updated by the Translation project.
5515 * po/vi.po: Updated Vietnamese translation.
5516
5517 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5518
5519 * testsuite/Makefile.am (check_PROGRAMS): Add
5520 icf_virtual_function_folding_test.
5521 * testsuite/Makefile.in: Regenerated.
5522
5523 2010-04-15 Andrew Haley <aph@redhat.com>
5524
5525 * options.h (merge_exidx_entries): New option.
5526 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5527 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5528 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5529 (Target_arm::merge_exidx_entries): New function.
5530 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5531 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5532 to Arm_exidx_fixup constructor.
5533 Add new arg, merge_exidx_entries.
5534 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5535 Arm_output_section::fix_exidx_coverage.
5536
5537 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5538
5539 * icf.cc (get_section_contents): Check for preemptible functions.
5540 Ignore addend when appropriate.
5541 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5542 section folded.
5543 (add_from_relobj): Check for section folded.
5544 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5545 * symtab.h (should_add_dynsym_entry): Add new parameter.
5546 * target-reloc.h (scan_relocs): Check for section folded.
5547 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5548 Check reloc types for function pointers in shared objects.
5549 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5550 case.
5551 (icf_preemptible_functions_test): New test case.
5552 (icf_string_merge_test): New test case.
5553 * testsuite.Makefile.in: Regenerate.
5554 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5555 bar_glob. Refactor code.
5556 * testsuite/icf_preemptible_functions_test.cc: New file.
5557 * testsuite/icf_preemptible_functions_test.sh: New file.
5558 * testsuite/icf_string_merge_test.cc: New file.
5559 * testsuite/icf_string_merge_test.sh: New file.
5560 * testsuite/icf_virtual_function_folding_test.cc: New file.
5561 * testsuite/icf_virtual_function_folding_test.sh: New file.
5562
5563 2010-04-14 Doug Kwan <dougkwan@google.com>
5564
5565 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5566 for local symbol recounting if we remove a section due to ICF.
5567 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5568 there are no regular objects in input.
5569
5570 2010-04-13 Doug Kwan <dougkwan@google.com>
5571
5572 * arm.cc (Arm_input_section::set_final_data_size): Compute
5573 accurate final data size instead of using current data size.
5574
5575 2010-04-09 Doug Kwan <dougkwan@google.com>
5576
5577 * layout.cc (Layout::choose_output_section): Handle script section
5578 types.
5579 (Layout::make_output_section_for_script): Add section type parameter.
5580 Handle script section types.
5581 * layout.h (Layout::make_output_section_for_script): Add section
5582 type parameter.
5583 * output.cc (Output_section::Output_section): Initialize data member
5584 is_noload_.
5585 (Output_section::do_reset_address_and_file_offset): Do not set address
5586 to 0 if section is a NOLOAD section.
5587 * output.h (Output_section::is_noload): New method.
5588 (Output_section::set_is_noload): Ditto.
5589 (Output_section::is_noload_): New data member.
5590 * script-c.h (Script_section_type): New enum type.
5591 (struct Parser_output_section_header): Add new file section_type.
5592 * script-sections.cc (Sections_element::output_section_name): Add
5593 parameter for returning script section type.
5594 (Output_section_definition::output_section_name): Ditto.
5595 (Output_section_definition::section_type)P; New method.
5596 (Output_section_definiton::script_section_type_name): Ditto.
5597 (Output_section_definition::script_section_type_): New data member.
5598 (Output_section_definition::Output_section_definition): Initialize
5599 data member Output_section_definition::script_section_type_.
5600 (Output_section_definition::create_sections): Pass script section type
5601 to Layout::make_output_section_for_script.
5602 (Output_section_definition::output_section_name): Return script
5603 section type to caller.
5604 (Output_section_definition::set_section_address): Do not advance
5605 dot value and load address if section type is NOLOAD. Set address
5606 of NOLOAD sections regardless of section flags.
5607 (Output_section_definition::print): Print section type if it is
5608 not SCRIPT_SECTION_TYPE_NONE.
5609 (Output_section_definition::section_type): New method.
5610 (Output_section_definition::script_section_type_name): Ditto.
5611 (Script_sections::output_section_name): Add new parameter
5612 PSECTION_TYPE for returning script section type. Pass it to
5613 section elements. Handle discard sections.
5614 (Sort_output_sections::operator()): Handle NOLOAD sections.
5615 * script-sections.h (Script_sections::Section_type): New enum type.
5616 (Script_sections::output_section_name): Add a new parameter for
5617 returning script section type.
5618 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5619 INFO and NOLOAD.
5620 * yyscript.y (union): Add new field SECTION_TYPE.
5621 (COPY, DSECT, INFO, NOLOAD): New tokens.
5622 (opt_address_and_section_type): Change type to output_section_header.
5623 (section_type): New non-terminal
5624 (section_header): Handle section type.
5625 (opt_address_and_section_type): Return section type value.
5626
5627 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5628
5629 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5630 * testsuite/plugin_common_test_2.c (foo): Likewise.
5631
5632 2010-04-08 Doug Kwan <dougkwan@google.com>
5633
5634 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5635 Output_merge_data.
5636 * output.cc (Output_section::add_merge_input_section): Simplify
5637 code and return status of Output_merge_base::add_input_section.
5638 Update merge section map only if Output_merge_base::add_input_section
5639 returns true.
5640
5641 2010-04-07 Doug Kwan <dougkwan@google.com>
5642
5643 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5644 if section is marked as containing instructions but has no mapping
5645 symbols.
5646 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5647 correct section index.
5648 (Arm_relobj::find_linked_text_section): Ditto.
5649
5650 2010-04-07 Cary Coutant <ccoutant@google.com>
5651
5652 * archive.cc (include_member): Destroy Read_symbols_data object before
5653 releasing file.
5654 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5655 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5656 (Read_symbols_data::~Read_symbols_data) New destructor.
5657 (Section_relocs::Section_relocs) New constructor.
5658 (Section_relocs::~Section_relocs) New destructor.
5659 (Read_relocs_data::Read_relocs_data) New constructor.
5660 (Read_relocs_data::~Read_relocs_data) New destructor.
5661 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5662 pointers to NULL after deleting.
5663
5664 2010-04-07 Doug Kwan <dougkwan@google.com>
5665
5666 * arm.cc: Replace "endianity" with "endianness" in comments.
5667 (Arm_exidx_cantunwind): Ditto.
5668 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5669 (Arm_relobj::merge_flags_and_attributes): New method.
5670 (Arm_relobj::merge_flags_and_attributes_): New data member.
5671 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5672 (Arm_relobj::scan_sections_for_stubs): Ditto.
5673 (Arm_relobj::do_read_symbols): Check to see if we really want to
5674 merge processor-specific flags and attributes. Exit early if
5675 an object is empty except for section names and the undefined symbol.
5676 (Target_arm::do_finalize_sections): Move check for ELF format to
5677 Arm_relobj::do_read_symbols. Merge processor specific flags and
5678 attributes from a regular object only when we have determined that
5679 it is aapropriate. Do not create an .ARM.attributes section in
5680 output if there is no regular input object.
5681 (Target_arm::merge_processor_specific_flags): Check
5682 --warn-mismatch before printing any error.
5683 (Target_arm::merge_object_attributes): Ditto.
5684 * gold.cc (queue_middle_tasks): Handle the case in which there is
5685 no regular object in input.
5686 * options.cc (General_options::parse_EB): New method.
5687 (General_options::parse_EL): Same.
5688 (General_options::General_options): Initialize endianness_.
5689 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5690 New options.
5691 (General_options::Endianness): New enum.
5692 (General_options::endianness): New method.
5693 (General_options::endianness_): New data member.
5694 * parameters.cc (Parameters::set_options): Check target endianness.
5695 (Parameters::set_target_once): Ditto.
5696 (Parameters::check_target_endianness): New method.
5697 (parameters_force_valid_target): If either -EL or -EB is specified,
5698 use it to define endianness of default target.
5699 * parameters.h (Parameters::check_target_endianness): New method
5700 declaration.
5701 * target.h (class Target): Change "endianity" to "endianness"
5702 in comments.
5703
5704 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5705
5706 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5707 * configure: Regenerate.
5708 * Makefile.in: Regenerate.
5709 * testsuite/Makefile.in: Regenerate.
5710
5711 2010-04-06 Cary Coutant <ccoutant@google.com>
5712
5713 gcc PR lto/42757
5714 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5715 prevailing definitions of common symbols.
5716 * testsuite/plugin_test_6.sh: New test case.
5717 * testsuite/plugin_common_test_1.c: New test case.
5718 * testsuite/plugin_common_test_2.c: New test case.
5719 * testsuite/Makefile.am (plugin_test_6): New test case.
5720 * testsuite/Makefile.in: Regenerate.
5721
5722 2010-04-06 Nick Clifton <nickc@redhat.com>
5723
5724 * po/vi.po: New Vietnamese translation.
5725
5726 2010-03-30 Doug Kwan <dougkwan@google.com>
5727
5728 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5729
5730 2010-03-25 Doug Kwan <dougkwan@google.com>
5731
5732 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5733 to avoid a conversion warning on a 32-bit host.
5734
5735 2010-03-24 Ian Lance Taylor <iant@google.com>
5736
5737 * testsuite/script_test_3.t: Add a TLS segment.
5738 * testsuite/Makefile.am (check_PROGRAMS): Add
5739 tls_phdrs_script_test.
5740 (tls_phdrs_script_test_SOURCES): Define.
5741 (tls_phdrs_script_test_DEPENDENCIES): Define.
5742 (tls_phdrs_script_test_LDFLAGS): Define.
5743 (tls_phdrs_script_test_LDADD): Define.
5744 * testsuite/Makefile.in: Rebuild.
5745
5746 2010-03-23 Cary Coutant <ccoutant@google.com>
5747
5748 * fileread.cc (find_or_make_view): Fix comment.
5749
5750 2010-03-23 Ian Lance Taylor <iant@google.com>
5751
5752 * script-sections.cc (class Orphan_section_placement): Define
5753 PLACE_TLS and PLACE_TLS_BSS.
5754 (Orphan_section_placement::Orphan_section_placement): Initialize
5755 new places.
5756 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5757 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5758 (tls_script_test_SOURCES): Define.
5759 (tls_script_test_DEPENDENCIES): Define.
5760 (tls_script_test_LDFLAGS): Define.
5761 (tls_script_test_LDADD): Define.
5762 * testsuite/Makefile.in: Rebuild.
5763
5764 2010-03-22 Doug Kwan <dougkwan@google.com>
5765
5766 * arm.cc (Arm_relocate_functions::abs8,
5767 Arm_relocate_functions::abs16): Use correct check for overflow
5768 specified in the ARM ELF specs.
5769 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5770 target of a BLX instruction specially.
5771 (Reloc_stub::stub_type_for_reloc): Ditto.
5772 (Relocate::relocate): Use symbolic names instead of numeric relocation
5773 codes to report error.
5774 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5775 workaround.
5776 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5777 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5778 thumb2_blx_out_of_range.stdout
5779 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5780 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5781 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5782 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5783 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5784 thumb2_blx_in_range, thumb2_blx_in_range.o,
5785 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5786 thumb2_blx_out_of_range.o): New rules.
5787 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5788 thumb2_blx_in_range and thumb2_blx_out_of_range.
5789 * testsuite/Makefile.in: Regenerate.
5790 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5791 * testsuite/thumb_blx_in_range.s: New file.
5792 * testsuite/thumb_blx_out_of_range.s: New file.
5793
5794 2010-03-22 Rafael Espindola <espindola@google.com>
5795
5796 * archive.cc (Should_include): Move to archive.h.
5797 (should_include_member): Make it a member of Archive.
5798 (Lib_group): New.
5799 (Add_lib_group_symbols): New.
5800 * archive.h: Include options.h.
5801 (Archive_member): Moved from Archive.
5802 (Should_include): Moved from archive.cc.
5803 (Lib_group): New.
5804 (Add_lib_group_symbols): New.
5805 * dynobj.cc (do_should_include_member): New.
5806 * dynobj.h (do_should_include_member): New.
5807 * gold.cc (queue_initial_tasks): Update call to queue.
5808 * main.cc (main): Print lib group stats.
5809 * object.cc (do_should_include_member): New.
5810 * object.h: Include archive.h.
5811 (Object::should_include_member): New.
5812 (Object::do_should_include_member): New.
5813 (Sized_relobj::do_should_include_member): New.
5814 * options.cc (General_options::parse_start_lib): New.
5815 (General_options::parse_end_lib): New.
5816 (Input_arguments::add_file): Handle lib groups.
5817 (Input_arguments::start_group): Check we are not in a lib.
5818 (Input_arguments::start_lib): New.
5819 (Input_arguments::end_lib): New.
5820 * options.h (General_options): Add start_lib and end_lib.
5821 (Input_argument::lib_): New.
5822 (Input_argument::lib): New.
5823 (Input_argument::is_lib): New.
5824 (Input_file_lib): New.
5825 (Input_arguments::in_lib_): New.
5826 (Input_arguments::in_lib): New.
5827 (Input_arguments::start_lib): New.
5828 (Input_arguments::end_lib_): New.
5829 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5830 in unused members as preempted.
5831 (Sized_pluginobj::do_should_include_member): New.
5832 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5833 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5834 return the blocker.
5835 (Read_symbols::do_whole_lib_group): New.
5836 (Read_symbols::do_lib_group): New.
5837 (Read_symbols::do_read_symbols): Handle lib groups.
5838 (Read_symbols::get_name): Handle lib groups.
5839 * readsyms.h (Read_symbols): Add an archive member pointer.
5840 (Read_symbols::do_whole_lib_group): New.
5841 (Read_symbols::do_lib_group): New.
5842 (Read_symbols::member_): New.
5843 * script.cc (read_input_script): Update call to queue_soon.
5844
5845 2010-03-19 Doug Kwan <dougkwan@google.com>
5846
5847 * arm.cc (Stub_table::Stub_table): Initialize new data members
5848 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5849 (Stub_table::add_reloc_stub): Assign stub offset and update
5850 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5851 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5852 New data members.
5853 (Stub_table::update_data_size_and_addralign): Use
5854 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5855 instead of going over all reloc stubs.
5856 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5857 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5858 Stringpool_template::offset_ to size of Stringpool_char.
5859 (Stringpool_template::new_key_offset): Remove code to initialize
5860 Stringpool_template::offset_.
5861 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5862 Stringpool_template::offset_ to zero.
5863
5864 2010-03-15 Doug Kwan <dougkwan@google.com>
5865
5866 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5867 offset_.
5868 (Stringpool_template::new_key_offset): New method.
5869 (Stringpool_template::add_string): Assign offsets when adding new
5870 strings.
5871 (Stringpool_template::set_string_offsets): Do not set string offsets
5872 when not optimizing.
5873 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5874 member size_.
5875 (Chunked_vector::clear): Clear size_.
5876 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5877 (Chunked_vector::size): Return size_.
5878 (Chunked_vector::push_back): Use size_ to find insert position.
5879 (Chunked_vector::size_): New data member.
5880 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5881 (Stringpool_template::new_key_offset): New method declaration.
5882 (Stringpool_template::offset_): New data member.
5883
5884 2010-03-15 Rafael Espindola <espindola@google.com>
5885
5886 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5887 Add_symbols' constructor.
5888 * readsyms.h (Add_symbols): Remove the input_group member.
5889
5890 2010-03-10 Ian Lance Taylor <iant@google.com>
5891
5892 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5893 target to ask whether a reference to a symbol requires a stack
5894 split.
5895 * target.h (Target::is_call_to_non_split): New function.
5896 (Target::do_is_call_to_non_split): Declare virtual function.
5897 * target.cc: Include "symtab.h".
5898 (Target::do_is_call_to_non_split): New function.
5899 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5900
5901 2010-03-10 Cary Coutant <ccoutant@google.com>
5902
5903 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5904 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5905 (File_read::open[2]): Add whole_file_view_ to list of views.
5906 (File_read::make_view): Remove test of whole_file_view_.
5907 (File_read::find_or_make_view): Create whole_file_view_ if
5908 necessary.
5909 (File_read::clear_views): Replace bool parameter with enum;
5910 adjust all callers. Don't delete views with permanent data;
5911 do delete cached views and views from archives if
5912 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5913 if clearing the corresponding view.
5914 * fileread.h (File_read::Clear_views_mode): New enum.
5915 (File_read::View::is_permanent_view): New method.
5916 (File_read::clear_views): Replace bool parameter
5917 with enum; adjust all callers.
5918 * options.h (General_options): Change keep_files_mapped option;
5919 add map_whole_files.
5920 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5921 releasing the file.
5922 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5923 the file.
5924
5925 2010-03-10 David S. Miller <davem@davemloft.net>
5926
5927 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5928
5929 2010-03-09 Sriraman Tallam <tmsriram@google.com>
5930
5931 * icf.cc (get_section_contents): Add '@' marker after processing the
5932 merge reloc.
5933
5934 2010-03-08 Doug Kwan <dougkwan@google.com>
5935
5936 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5937 due to a conversion warning.
5938 (Arm_relobj::update_output_local_symbol_count): Check for local
5939 symbol with unset output index.
5940
5941 2010-03-05 Ian Lance Taylor <iant@google.com>
5942
5943 * options.h (class General_options): Add --spare-dynamic-tags.
5944 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5945 --spare-dynamic-tags.
5946
5947 2010-03-05 Ian Lance Taylor <iant@google.com>
5948
5949 * incremental.cc: Include "libiberty.h".
5950
5951 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5952
5953 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5954 function, is_info_ member.
5955 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5956 (Versions::Versions): Update caller.
5957 (Versions::define_base_version): Likewise.
5958 (Versions::add_def): Likewise.
5959
5960 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5961
5962 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5963 (Scan::possible_function_pointer_reloc): New function.
5964 (Scan::local_reloc_may_be_function_pointer): Change to call
5965 possible_function_pointer_reloc.
5966 (Scan::global_reloc_may_be_function_pointer): Ditto.
5967 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5968 relocations in ".data.rel.ro._ZTV" section.
5969 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5970 * testsuite/icf_safe_so_test.cc: Ditto.
5971 * testsuite/icf_safe_test.cc: Ditto.
5972 * testsuite/icf_safe_test.sh: Ditto.
5973
5974 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5975 Ian Lance Taylor <iant@google.com>
5976
5977 * target-reloc.h (relocate_section): Check the symbol table index
5978 for -1U before setting the local symbol index.
5979 (scan_relocatable_relocs): If copying the relocation, record that
5980 the local symbol is required.
5981 * object.h (Symbol_value::is_output_symtab_index_set): New
5982 function.
5983 (Symbol_value::may_be_discarded_from_output_symtab): New
5984 function.
5985 (Symbol_value::has_output_symtab_entry): New function.
5986 (Symbol_value::needs_output_symtab_entry): Remove.
5987 (Symbol_value::output_symtab_index): Make sure the symbol index is
5988 set.
5989 (Symbol_value::set_output_symtab_index): Make sure the symbol
5990 index is not set. Make sure the new index is valid.
5991 (Symbol_value::set_must_have_output_symtab_entry): New function.
5992 (Symbol_value::has_output_dynsym_entry): New function.
5993 (Symbol_value::set_output_dynsym_index): Make sure the new index
5994 is valid.
5995 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5996 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5997 local symbol if permitted.
5998 (Sized_relobj::do_finalize_local_symbols): Call
5999 is_output_symtab_index_set rather than needs_output_symtab_entry.
6000 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6001 rather than needs_output_symtab_entry. Call
6002 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6003 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6004 is_output_symtab_index_set rather than needs_output_symtab_entry.
6005 * testsuite/discard_locals_relocatable_test.c: New file.
6006 * testsuite/discard_locals_test.sh: Test -r.
6007 * testsuite/Makefile.am (check_DATA): Add
6008 discard_locals_relocatable_test1.syms,
6009 discard_local_relocatable_test2.syms.
6010 (MOSTLYCLEANFILES): Likewise. Also add
6011 discard_locals_relocatable_test1.lout and
6012 discard_locals_relocatable_test2.out.
6013 (discard_locals_relocatable_test1.syms): New target.
6014 (discard_locals_relocatable_test.o): New target.
6015 (discard_locals_relocatable_test1.out): New target.
6016 (discard_locals_relocatable_test2.syms): New target.
6017 (discard_locals_relocatable_test2.out): New target.
6018 (various): Add missing ../ld-new dependencies.
6019 * testsuite/Makefile.in: Rebuild.
6020
6021 2010-03-03 Nick Clifton <nickc@redhat.com>
6022
6023 * po/fi.po: New Finnish translation.
6024
6025 2010-03-01 Doug Kwan <dougkwan@google.com>
6026
6027 * layout.cc (Layout::Layout): Force section types of .init_array*,
6028 .preinit_array* and .fini_array* sections.
6029 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6030 Fix check of return value of std::string::find.().
6031 (Output_section::Input_section_sort_compare::operator()): Remove
6032 comment about .init_array.
6033 (Output_section::Input_section_sort_init_fini_compare::operator()):
6034 New method.
6035 (Output_section::sort_attached_input_sections): Handle .init_array
6036 and .fini_array specially.
6037 * output.h (Output_section::Inut_section_sort_compare): Update
6038 comment.
6039 (Output_section::Input_section_sort_init_fini_compare): New struct.
6040
6041 2010-02-26 Doug Kwan <dougkwan@google.com>
6042
6043 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6044 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6045 * testsuite/debug_msg.sh: Avoid matching source line number for
6046 use of global variable undef_int.
6047
6048 2010-02-26 Doug Kwan <dougkwan@google.com>
6049
6050 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6051 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6052 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6053 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6054 * options.cc (General_options::General_options): Initialize member
6055 fix_v4bx_.
6056 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6057 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6058 and rm_no_fix_v4bx.stdout
6059 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6060 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6061 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6062 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6063 and arm_no_fix_v4bx.
6064 * Makefile.in: Regenerate.
6065 * testsuite/arm_fix_v4bx.s: New file.
6066 * testsuite/arm_fix_v4bx.sh: Ditto.
6067
6068 2010-02-24 Doug Kwan <dougkwan@google.com>
6069
6070 * arm.cc (Target_arm::got_section): Make the .got section the first
6071 non RELRO section in the data segment.
6072 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6073 suffixes of section names.
6074
6075 2010-02-24 Doug Kwan <dougkwan@google.com>
6076
6077 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6078 flags and attributes merging if an input file is a binary file.
6079 * fileread.cc (Input_file::open): Record format of original file.
6080 * fileread.h (Input_file::Format): New enum type.
6081 (Input_file::Input_file): Initialize data member format_.
6082 (Input_file::format): New method definition.
6083 (Input_file::format_):: New data member.
6084
6085 2010-02-24 Doug Kwan <dougkwan@google.com>
6086
6087 * arm.cc (Arm_output_data_got): New class.
6088 (ARM_TCB_SIZE): New constant
6089 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6090 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6091 If user uses a script with a SECTIONS clause, issue only a warning
6092 for a misplaced EXIDX input section. Otherwise, issue an error.
6093 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6094 garbage collection.
6095 (Target_arm::got_mode_index_entry): Handle static linking.
6096 (Target_arm::Scan::local): Ditto.
6097 (Target_arm::Scan::global): Ditto.
6098 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6099 all incorrectly implemented relocations.
6100 (Target_arm::fix_exidx_coverage): Pass layout to
6101 Arm_output_section::fix_exidx_coverage.
6102 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6103 from ".ARM.exidx." and ".ARM.extab.".
6104
6105 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6106
6107 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6108 section if it does not already exist.
6109 * attributes.cc (Attributes_section_data::Attributes_section_data):
6110 Don't crash if size is zero.
6111
6112 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6113 Ian Lance Taylor <iant@google.com>
6114
6115 * gold.cc (queue_middle_tasks): If no input files were opened,
6116 exit.
6117 * workqueue.h (Task_function::Task_function): Assert that there is
6118 a blocker.
6119
6120 2010-02-22 Doug Kwan <dougkwan@google.com>
6121
6122 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6123 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6124 types to avoid warnings due to different uint64_t implementations
6125 on different hosts.
6126
6127 2010-02-21 Doug Kwan <dougkwan@google.com>
6128
6129 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6130 handling of the maximum backward branch offset.
6131 (Arm_relocate_functions::thumb_branch_common): Ditto.
6132 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6133 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6134 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6135 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6136 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6137 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6138 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6139 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6140 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6141 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6142 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6143 thumb2_bl_out_of_range.o): New rules.
6144 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6145 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6146 thumb2_bl_out_of_range
6147 * testsuite/Makefile.in: Regenerate.
6148 * testsuite/arm_bl_in_range.s: New file.
6149 * testsuite/arm_bl_out_of_range.s: Ditto.
6150 * testsuite/arm_branch_in_range.sh: Ditto.
6151 * testsuite/arm_branch_range.t: Ditto.
6152 * testsuite/thumb2_branch_range.t: Ditto.
6153 * testsuite/thumb_bl_in_range.s: Ditto.
6154 * testsuite/thumb_bl_out_of_range.s: Ditto.
6155 * testsuite/thumb_branch_range.t: Ditto.
6156
6157 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6158
6159 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6160 Add reloc offset information.
6161 * icf.cc (get_section_contents): Change iterators to point to the new
6162 vectors. Add reloc offset information to the contents.
6163 * icf.h (Icf::Sections_reachable_info): New typedef.
6164 (Icf::Sections_reachable_list): New typedef.
6165 (Icf::Offset_info): New typedef.
6166 (Icf::Reloc_info): New struct typedef.
6167 (Icf::Reloc_info_list): New typedef.
6168 (Icf::symbol_reloc_list): Delete method.
6169 (Icf::addend_reloc_list): Delete method.
6170 (Icf::section_reloc_list): Delete method.
6171 (Icf::reloc_info_list): New method.
6172 (Icf::reloc_info_list_): New member.
6173
6174 2010-02-19 Doug Kwan <dougkwan@google.com>
6175
6176 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6177 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6178 * arm.cc (Arm_relocation_functions): New forward declaration.
6179 (Target_arm::Target_arm): Initialize new data members
6180 got_mod_index_offset_ and tls_base_symbol_defined_.
6181 (Target_arm::Relocate::relocate_tls): New method.
6182 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6183 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6184 New methods.
6185 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6186 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6187 (Target_arm::got_mod_index_offset_,
6188 Target_arm::tls_base_symbol_defined_): New data members.
6189 (Target_arm::Scan::local, Target::Scan::global,
6190 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6191 relocations.
6192
6193 2010-02-18 Doug Kwan <dougkwan@google.com>
6194
6195 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6196 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6197 text section as a parameter becuase some broken tools may not set
6198 the link in section header.
6199 (Target_arm::has_got_section): New method.
6200 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6201 without any mapping symbol as data only. Remove warning.
6202 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6203 link in its section header, try to discover the link by inspecting the
6204 REL31 relocation at the beginning of the section.
6205 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6206 in error message.
6207 (Target_arm::Scan::global): Treat any reference to the symbol
6208 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6209
6210 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6211
6212 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6213 (Scan::global_reloc_may_be_function_pointer): New function.
6214 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6215 (Scan::global_reloc_may_be_function_pointer): New function.
6216 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6217 (Scan::global_reloc_may_be_function_pointer): New function.
6218 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6219 (Scan::global_reloc_may_be_function_pointer): New function.
6220 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6221 (Scan::global_reloc_may_be_function_pointer): New function.
6222 (Scan::possible_function_pointer_reloc): New function.
6223 (Target_x86_64::can_check_for_function_pointers): New function.
6224 * gc.h (gc_process_relocs): Scan relocation types to determine if
6225 function pointers were taken for targets that support it.
6226 * icf.cc (Icf::find_identical_sections): Include functions for
6227 folding in safe ICF whose pointer is not taken.
6228 * icf.h (Secn_fptr_taken_set): New typedef.
6229 (fptr_section_id_): New member.
6230 (section_has_function_pointers): New function.
6231 (set_section_has_function_pointers): New function.
6232 (check_section_for_function_pointers): New function.
6233 * options.h: Fix comment for safe ICF option.
6234 * target.h (can_check_for_function_pointers): New function.
6235 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6236 Modify icf_safe_test for X86-64.
6237 * testsuite/Makefile.in: Regenerate.
6238 * testsuite/icf_safe_so_test.cc: New file.
6239 * testsuite/icf_safe_so_test.sh: New file.
6240 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6241 (main): Change to take pointer to function kept_func_3.
6242 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6243 folding is done correctly for X86-64.
6244
6245 2010-02-12 David S. Miller <davem@davemloft.net>
6246
6247 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6248 is_symbolless parameter.
6249 (Output_reloc<SHT_REL>::is_symbolless): New.
6250 (Output_reloc<SHT_REL>::is_symbolless_): New.
6251 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6252 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6253 (Output_reloc<SHT_RELA>::is_symbolless): New.
6254 (Output_data_reloc::add_global): Handle is_symbolless.
6255 (Output_data_reloc::add_global_relative): Likewise.
6256 (Output_data_reloc::add_local): Likewise.
6257 (Output_data_reloc::add_local_relative): Likewise.
6258 (Output_data_reloc::add_symbolless_global_addend): New.
6259 (Output_data_reloc::add_symbolless_local_addend): New.
6260 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6261 is_symbolless.
6262 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6263 instead of ->is_relative_
6264 (Output_reloc::write): Likewise.
6265 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6266 (Output_reloc::write_rel): Simplify.
6267
6268 * sparc.cc (Target_sparc::Scan::local): Use
6269 ->add_symbolless_local_addend as needed.
6270 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6271 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6272 based upon relocation offset.
6273
6274 2010-02-11 Doug Kwan <dougkwan@google.com>
6275
6276 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6277 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6278 beginning of function.
6279 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6280 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6281 parameter is_32bit in calls to should_apply_static_reloc.
6282 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6283 (check_DATA): Add arm_abs_global.stdout.
6284 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6285 arm_abs_global.stdout): New rules.
6286 (MOSTLLYCLEANFILES): Add arm_abs_global
6287 * Makefile.in: Regenerate.
6288 * testsuite/arm_abs_global.s: New file.
6289 * testsuite/arm_abs_global.sh: Ditto.
6290 * testsuite/arm_abs_lib.s: Ditto.
6291
6292 2010-02-11 Ian Lance Taylor <iant@google.com>
6293
6294 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6295 Read_relocs task.
6296 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6297 Allocate_commons_task first.
6298 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6299 task, rather than symtab_lock_.
6300 (Gc_process_relocs::~Gc_process_relocs): New function.
6301 (Gc_process_relocs::is_runnable): Check this_blocker_.
6302 (Gc_process_relocs::locks): Use next_blocker_ rather than
6303 blocker_.
6304 (Scan_relocs::~Scan_relocs): New function.
6305 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6306 symtab_lock_.
6307 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6308 next_blocker_.
6309 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6310 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6311 constructor accordingly.
6312 (class Gc_process_relocs): Likewise.
6313 (class Scan_relocs): Likewise.
6314 * common.h (class Allocate_commons_task): Remove symtab_lock_
6315 field, and corresponding constructor parameter.
6316 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6317 symtab_lock_.
6318 (Allocate_commons_task::locks): Likewise.
6319
6320 2010-02-11 Ian Lance Taylor <iant@google.com>
6321
6322 * gold-threads.h (class Once): Define.
6323 (class Initialize_lock): Rewrite as child of Once.
6324 * gold-threads.cc (class Once_initialize): Define.
6325 (once_pointer_control): New static variable.
6326 (once_pointer, once_arg): New static variables.
6327 (c_run_once): New static function.
6328 (Once::Once, Once::run_once, Once::internal_run): New functions.
6329 (class Initialize_lock_once): Remove.
6330 (initialize_lock_control): Remove.
6331 (initialize_lock_pointer): Remove.
6332 (initialize_lock_once): Remove.
6333 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6334 (Initialize_lock::initialize): Rewrite.
6335 (Initialize_lock::do_run_once): New function.
6336 * archive.cc (Archive::interpret_header): Only clear name if it is
6337 not already empty.
6338 * fileread.cc: Include "gold-threads.h"
6339 (file_counts_lock): New static variable.
6340 (file_counts_initialize_lock): Likewise.
6341 (File_read::release): Only increment counts when using --stats.
6342 Use a lock around the increment.
6343 * parameters.cc (class Set_parameters_target_once): Define.
6344 (set_parameters_target_once): New static variable.
6345 (Parameters::Parameters): Move here from parameters.h.
6346 (Parameters::set_target): Rewrite.
6347 (Parameters::set_target_once): New function.
6348 (Parameters::clear_target): Move here and rewrite.
6349 * parameters.h (class Parameters): Update declarations. Add
6350 set_parameters_target_once_ field.
6351 (Parameters::Parameters): Move to parameters.cc.
6352 (Parameters::clear_target): Likewise.
6353 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6354 task.
6355 (Start_group::~Start_group): New function.
6356 (Start_group::is_runnable): New function.
6357 (Start_group::locks, Start_group::run): New functions.
6358 (Finish_group::run): Change saw_undefined to size_t.
6359 * readsyms.h (class Start_group): Define.
6360 (class Finish_group): Change saw_undefined_ field to size_t.
6361 (Finish_group::Finish_group): Remove saw_undefined and
6362 this_blocker parameters. Change all callers.
6363 (Finish_group::set_saw_undefined): New function.
6364 (Finish_group::set_blocker): New function.
6365 * symtab.h (class Symbol_table): Change saw_undefined to return
6366 size_t. Change saw_undefined_ field to size_t.
6367 * target-select.cc (Set_target_once::do_run_once): New function.
6368 (Target_selector::Target_selector): Initialize set_target_once_
6369 field. Don't initialize lock_ and initialize_lock_ fields.
6370 (Target_selector::instantiate_target): Rewrite.
6371 (Target_selector::set_target): New function.
6372 * target-select.h (class Set_target_once): Define.
6373 (class Target_selector): Update declarations. Make
6374 Set_target_once a friend. Remove lock_ and initialize_lock_
6375 fields. Add set_target_once_ field.
6376
6377 2010-02-10 Ian Lance Taylor <iant@google.com>
6378
6379 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6380 queueing any tasks.
6381 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6382 (queue_middle_tasks): Add all blockers before queueing any tasks.
6383 (queue_final_tasks): Likewise.
6384 * token.h (Task_token::add_blockers): New function.
6385 * object.h (Input_objects::number_of_relobjs): New function.
6386
6387 2010-02-10 Ian Lance Taylor <iant@google.com>
6388
6389 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6390 shared, not if not position independent.
6391 * x86_64.cc (Relocate::relocate_tls): Likewise.
6392 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6393 (tls_pie_pic_test): New target.
6394 * testsuite/Makefile.in: Rebuild.
6395
6396 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6397 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6398 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6399 * testsuite/Makefile.in: Rebuild.
6400
6401 2010-02-09 David S. Miller <davem@davemloft.net>
6402
6403 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6404 R_SPARC_RELATIVE using ->add_local_relative().
6405 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6406
6407 * output.h (Output_data_dynamic::add_section_size): New method
6408 that takes two Output_data objects.
6409 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6410 entry param. Handle it in initializers.
6411 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6412 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6413 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6414 arg.
6415 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6416 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6417 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6418 for dynrel_includes_plt.
6419 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6420 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6421 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6422 before .rela.plt
6423 (Target_sparc::do_finalize_sections): Update to pass true for
6424 dynrel_includes_plt.
6425 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6426 output before .rela.plt
6427 (Target_powerpc::do_finalize_sections): Update to pass true for
6428 dynrel_includes_plt when 32-bit.
6429
6430 2010-02-08 Doug Kwan <dougkwan@google.com>
6431
6432 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6433 method.
6434 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6435 Arm_relobj::scan_section_for_cortex_a8_stubs,
6436 Arm_relobj::do_relocation_section): Instead of calling
6437 Output_section::output_address, use faster
6438 Arm_relobj::simple_input_section_output_address.
6439
6440 2010-02-08 David S. Miller <davem@davemloft.net>
6441
6442 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6443 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6444 relocation helper function.
6445
6446 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6447 just like R_SPARC_GOT{10,13,22}.
6448 (Target_sparc::Scan::local): Likewise.
6449 (Target_sparc::Relocate:relocate): Likewise.
6450
6451 2010-02-06 Ian Lance Taylor <iant@google.com>
6452
6453 * configure.ac: Rewrite targetobjs duplicate removal code to use
6454 only shell constructs.
6455 * configure: Rebuild.
6456
6457 2010-02-05 Doug Kwan <dougkwan@google.com>
6458
6459 PR 11247
6460 * arm.cc (Arm_relobj::section_is_scannable): New method.
6461 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6462 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6463
6464 2010-02-04 Doug Kwan <dougkwan@google.com>
6465
6466 PR 11247
6467 * arm-reloc-property.cc (cstdio): Include.
6468 * configure.ac (targetobjs): Remove duplicates.
6469 * configure: Regenerate.
6470 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6471 big and little endian version for a given address size.
6472
6473 2010-02-03 Doug Kwan <dougkwan@google.com>
6474
6475 * arm-reloc-property.cc
6476 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6477 definition.
6478 * arm-reloc-property.h
6479 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6480 New method definition.
6481 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6482 declaration.
6483 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6484 overflow to N.
6485 (GOT_PREL): Change implemented to Y.
6486 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6487 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6488 (Arm_relocate_functions::movw_abs_nc): Remove method.
6489 (Arm_relocate_functions::movt_abs): Ditto.
6490 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6491 (Arm_relocate_functions::thm_movt_abs): Ditto.
6492 (Arm_relocate_functions::movw_rel_nc): Ditto.
6493 (Arm_relocate_functions::movw_rel): Ditto.
6494 (Arm_relocate_functions::movt_rel): Ditto.
6495 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6496 (Arm_relocate_functions:thm_movw_rel): Ditto.
6497 (Arm_relocate_functions:thm_movt_rel): Ditto.
6498 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6499 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6500 New method definitions.
6501 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6502 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6503 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6504 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6505 (Target_arm::Relocate::relocate): Check for non-static or
6506 unimplemented relocation code and exit early. Change calls to
6507 Target_arm::reloc_uses_thumb_bit and
6508 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6509 instead. Refactor code to handle similar relocations to increase
6510 code sharing. Remove check for unsupported relocation code in switch
6511 statement.
6512 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6513 relocation property table to find out size. Change error message to
6514 print out the name of a relocation code instead of the numeric value.
6515 (Target_arm::scan_reloc_for_stub): Use relocation property table
6516 instead of calling Target_arm::reloc_uses_thumb_bit().
6517
6518 2010-02-02 Doug Kwan <dougkwan@google.com>
6519
6520 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6521 types of relaxed input section.
6522
6523 2010-02-02 Doug Kwan <dougkwan@google.com>
6524
6525 * Makefile.am (HFILES): Add arm-reloc-property.h.
6526 (DEFFILES): New.
6527 (TARGETSOURCES): Add arm-reloc-property.cc
6528 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6529 (libgold_a_SOURCES): $(DEFFILES)
6530 * Makefile.in: Regenerate.
6531 * arm-reloc-property.cc: New file.
6532 * arm-reloc-property.h: New file.
6533 * arm-reloc.def: New file.
6534 * arm.cc: Update comments.
6535 (arm-reloc-property.h): New included header.
6536 (arm_reloc_property_table): New global variable.
6537 (Target_arm::do_select_as_default_target): New method definition.
6538 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6539 arm-reloc-property to targ_extra_obj.
6540 * parameters.cc (set_parameters_target): Call
6541 Target::select_as_default_target().
6542 * target.h (Target::select_as_default_target): New method definition.
6543 (Target::do_select_as_default_target): Same.
6544
6545 2010-02-01 Doug Kwan <dougkwan@google.com>
6546
6547 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6548 first_output_text_section_.
6549 (Arm_exidx_fixup::first_output_text_section): New method definition.
6550 (Arm_exidx_fixup::first_output_text_section_): New data member.
6551 (Arm_exidx_fixup::process_exidx_section): Record the first text
6552 output section seen.
6553 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6554 and entsize in output section header.
6555
6556 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6557
6558 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6559 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6560 (Arm_relocate_functions::thm_alu11): New Method.
6561 (Arm_relocate_functions::thm_pc8): New Method.
6562 (Arm_relocate_functions::thm_pc12): New Method.
6563 (Target_arm::Scan::local): Handle the relocations.
6564 (Target_arm::Scan::global): Likewise.
6565 (Target_arm::Relocate::relocate): Likewise.
6566 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6567
6568 2010-01-29 Doug Kwan <dougkwan@google.com>
6569
6570 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6571 of relocation types as ld.
6572
6573 2010-01-29 Doug Kwan <dougkwan@google.com>
6574
6575 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6576 to public.
6577 (Arm_relocate_functions::thumb_branch_common): Ditto.
6578 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6579 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6580 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6581 Arm_relocate_functions::jump24): Remove.
6582 (Target_arm::Relocate::relocate): Adjust code to call
6583 Arm_relocation_functions::arm_branch_common and
6584 Arm_relocation_functions::thumb_branch_common instead of their removed
6585 wrappers. Merge switch-cases together to reduce source code size.
6586
6587 2010-01-29 Doug Kwan <dougkwan@google.com>
6588
6589 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6590 output_local_symbol_count_needs_update_.
6591 (Arm_relobj::output_local_symbol_count_needs_update,
6592 Arm_relobj::set_output_local_symbol_count_needs_update,
6593 Arm_relobj::update_output_local_symbol_count): New methods.
6594 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6595 member.
6596 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6597 of pointed function as in a R_ARM_PREL31 relocation.
6598 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6599 for output local symbol count updating.
6600 (Target_arm::do_relax): Update output local symbol counts in objects
6601 if necessary.
6602 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6603
6604 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6605
6606 * arm.cc: Added support for the ARM relocations:
6607 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6608 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6609 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6610 movw_prel_nc).
6611 (Arm_relocate_functions::movw_rel): New method.
6612 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6613 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6614 thm_movw_prel_nc).
6615 (Arm_relocate_functions::thm_movw_rel): New method.
6616 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6617 thm_movt_prel).
6618 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6619 relocations.
6620 (Target_arm::Scan::global): Likewise.
6621 (Target_arm::Relocate::relocate): Likewise.
6622 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6623 Likewise.
6624
6625 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6626
6627 * arm.cc: Added support for ARM group relocations.
6628 (Target_arm::reloc_needs_sym_origin): New method.
6629 (Arm_relocate_functions::calc_grp_kn): New method.
6630 (Arm_relocate_functions::calc_grp_residual): New method.
6631 (Arm_relocate_functions::calc_grp_gn): New method.
6632 (Arm_relocate_functions::arm_grp_alu): New Method.
6633 (Arm_relocate_functions::arm_grp_ldr): New Method.
6634 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6635 (Arm_relocate_functions::arm_grp_ldc): New Method.
6636 (Target_arm::Scan::local): Handle the ARM group relocations.
6637 (Target_arm::Scan::global): Likewise.
6638 (Target_arm::Relocate::relocate): Likewise.
6639 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6640 Likewise.
6641
6642 2010-01-26 Doug Kwan <dougkwan@google.com>
6643
6644 * arm.cc (set): Include.
6645 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6646 pointer type.
6647 (Arm_output_section::Text_section_list): New type.
6648 (Arm_output_section::append_text_sections_to_list): New method.
6649 (Arm_output_section::fix_exidx_coverage): Ditto.
6650 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6651 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6652 Relobj::set_section_offset() instead of
6653 Sized_relobj::invalidate_section_offset().
6654 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6655 parameter for section headers. Ignore relocation sections for
6656 unallocated sections and EXIDX sections.
6657 (Target_arm::fix_exidx_coverage): New method.
6658 (Target_arm::output_section_address_less_than): New type.
6659 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6660 linked text section instead of the EXIDX section.
6661 (Arm_output_section::create_stub_group): Add an assertion to check
6662 that this is not an EXIDX output section.
6663 (Arm_output_section::append_text_sections_to_list): New method.
6664 (Arm_output_section::fix_exidx_coverage): Ditto.
6665 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6666 Arm_relobj::section_needs_reloc_stub_scanning.
6667 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6668 first pass.
6669 (Target_arm::fix_exidx_coverage): New method.
6670 * object.h (Relobj::set_output_section): New method.
6671 (Sized_relobj::invalidate_section_offset): Remove method.
6672 (Sized_relobj::do_invalidate_section_offset): Remove method.
6673 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6674
6675 2010-01-25 Doug Kwan <dougkwan@google.com>
6676
6677 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6678 Fix warning due to signed and unsigned comparison on a 32-bit host.
6679
6680 2010-01-22 Doug Kwan <dougkwan@google.com>
6681
6682 * arm.cc (Target_arm::do_relax): Record an output section for section
6683 offset adjustment it contains any stub table that has changed.
6684 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6685 offsets in an output section if necessary.
6686 * output.cc (Output_section::Output_section): Initialize
6687 section_offsets_need_adjustments_.
6688 (Output_section::add_input_section_for_script): Renamed to
6689 Output_section::add_simple_input_section.
6690 (Output_section::save_states): Add a comment.
6691 (Output_section::discard_states): New method defintion.
6692 (Output_section::adjust_section_offsets): Same.
6693 * output.h (Output_section::add_input_section_for_script): Renamed to
6694 Output_section::add_simple_input_section.
6695 (Output_section::discard_states): New method declaration.
6696 (Output_section::adjust_section_offsets): Same.
6697 (Output_section::section_offsets_need_adjustment,
6698 Output_section::set_section_offsets_need_adjustment): New method
6699 definitions.
6700 (Output_section::section_offsets_need_adjustment_): New data member.
6701 * script-sections.cc
6702 (Output_section_element_input::set_section_address): Adjust code for
6703 renaming of Output_section::add_input_section_for_script.
6704 (Orphan_output_section::set_section_address): Same.
6705
6706 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6707
6708 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6709 Fix_v4bx enum values .
6710 * gold/options.h (General_options): New option definitions.
6711 (General_options::fix_v4bx): New method.
6712 (General_options::Fix_v4bx): New enum.
6713 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6714 (General_options::parse_fix_v4bx_interworking): New method.
6715
6716 2010-01-22 Doug Kwan <dougkwan@google.com>
6717
6718 * arm.cc (Arm_exidx_fixup): New class.
6719
6720 2010-01-21 Doug Kwan <dougkwan@google.com>
6721
6722 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6723 classes.
6724 (Arm_exidx_section_offset_map): New type.
6725
6726 2010-01-21 Doug Kwan <dougkwan@google.com>
6727
6728 * arm.cc (Arm_exidx_input_section): New class.
6729 (Arm_relobj::exidx_input_section_by_link,
6730 Arm_relobj::exidx_input_section_by_shndx,
6731 Arm_relobj::make_exidx_input_section): New methods.
6732 (read_arm_attributes_section): Remove.
6733 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6734 information about them.
6735 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6736 to here.
6737
6738 2010-01-20 Doug Kwan <dougkwan@google.com>
6739
6740 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6741 Input_section_specifier to Section_id.
6742 (Target_arm::new_arm_input_section: Adjust code for change of key
6743 type.
6744 (Target_arm::find_arm_input_section): Ditto.
6745 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6746 (Section_id): Remove.
6747 (Garbage_collection::Section_id_hash): Remove.
6748 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6749 (Section_id): Remove.
6750 (Icf::Section_id_hash): Remove.
6751 * object.h (Section_id, Const_section_id, Section_id_hash,
6752 Const_section_id_hash): New type definitions.
6753 * output.cc (Output_section::add_relaxed_input_section): Change to
6754 use Const_section_id instead of Input_section_specifier as key type.
6755 (Output_section::add_merge_input_section): Ditto.
6756 (Output_section::build_relaxation_map): Change to use Section_id
6757 instead of Input_section_specifier as key type.
6758 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6759 Ditto.
6760 (Output_section::convert_input_sections_to_relaxed_sections): Change
6761 to use Const_section_id instead of Input_section_specifier as key type.
6762 (Output_section::find_merge_section): Ditto.
6763 (Output_section::find_relaxed_input_section): Ditto.
6764 * output.h (Input_section_specifier): Remove class.
6765 (Output_section::Output_section_data_by_input_section_map): Change
6766 key type to Const_section_id.
6767 (Output_section::Output_relaxed_input_section_by_input_section_map):
6768 Ditto.
6769 (Output_section::Relaxation_map): Change key type to Section_id.
6770
6771 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6772
6773 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6774 (class Arm_v4bx_stub): New class.
6775 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6776 (Stub_factory::make_arm_v4bx_stub): New method.
6777 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6778 (Stub_table::empty): Handle v4bx stubs.
6779 (Stub_table::add_arm_v4bx_stub): New method.
6780 (Stub_table::find_arm_v4bx_stub): New method.
6781 (Arm_relocate_functions::v4bx): New method.
6782 (Target_arm::fix_v4bx): New method.
6783 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6784 (Stub_table::relocate_stubs): Likewise.
6785 (Stub_table::do_write): Likewise.
6786 (Stub_table::update_data_size_and_addralign): Likewise.
6787 (Stub_table::finalize_stubs): Likewise.
6788 (Target_arm::Scan::local): Likewise.
6789 (Target_arm::Scan::global): Likewise.
6790 (Target_arm::do_finalize_sections): Likewise.
6791 (Target_arm::Relocate::relocate): Likewise.
6792 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6793 Likewise.
6794 (Target_arm::scan_reloc_for_stub): Likewise.
6795 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6796
6797 2010-01-19 Ian Lance Taylor <iant@google.com>
6798
6799 * output.cc (Output_section_headers::do_sized_write): Write large
6800 segment count to sh_info field.
6801 (Output_file_header::do_sized_write): For large segment count,
6802 write PN_XNUM to e_phnum field.
6803
6804 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6805
6806 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6807 (Arm_relocate_functions::thm_jump8): New function.
6808 (Arm_relocate_functions::thm_jump11): New function.
6809 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6810 R_ARM_THM_JUMP11.
6811 (Target_arm::Scan::global): Likewise.
6812 (Target_arm::Relocate::relocate): Likewise.
6813 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6814 Likewise.
6815
6816 2010-01-14 Doug Kwan <dougkwan@google.com>
6817
6818 * arm.cc (map, utility): Include headers.
6819 (Target_arm::apply_cortex_a8_workaround): New method.
6820 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6821 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6822 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6823 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6824 the --[no-]fix-cortex-a8 command line options.
6825 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6826 (Target_arm::relocate_stub): Use addend in instruction template.
6827 * options.h (DEFINE_bool): Set the user-set flag.
6828 (General_options): Add --[no-]-fix-cortex options.
6829 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6830 : Update fast look-up map after conversion.
6831
6832 2010-01-14 Sriraman Tallam <tmsriram@google.com>
6833
6834 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6835 in the first pass of do_layout.
6836
6837 2010-01-13 Doug Kwan <dougkwan@google.com>
6838
6839 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6840 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6841 apparent compiler problem of not folding static constant integral
6842 data members of elfcpp::Elf_sizes<32>.
6843
6844 2010-01-13 Doug Kwan <dougkwan@google.com>
6845
6846 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6847 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6848 Arm_relobj::scan_section_for_cortex_a8_erratum,
6849 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6850 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6851 sections to scan for relocation stubs into a new method
6852 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6853 relocation and Cortex-A8 stub scanning.
6854 (Target_arm::do_relax): Force stubs to be after stubbed sections
6855 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6856 the beginning of a new relaxation pass. Update a comment.
6857 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6858
6859 2010-01-12 Ian Lance Taylor <iant@google.com>
6860
6861 * target-reloc.h (visibility_error): New inline function.
6862 (relocate_section): Call visibility_error.
6863 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6864 (MOSTLYCLEANFILES): Likewise.
6865 (protected_4_pic.o, protected_3.err): New targets.
6866 * testsuite/protected_4.cc: New file.
6867
6868 2010-01-12 Doug Kwan <dougkwan@google.com>
6869
6870 * arm.cc (Cortex_a8_reloc): New class.
6871 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6872 and cortex_a8_relocs_info_.
6873 (Target_arm::fix_cortex_a8): New method definition.
6874 (Target_arm::Cortex_a8_relocs_info): New type.
6875 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6876 New data member declarations.
6877 (Target_arm::scan_reloc_for_stub): Record information about
6878 relocations for THUMB branches that might be exempted from the
6879 Cortex-A8 workaround.
6880 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6881 at the beginning of a relaxation pass.
6882
6883 2010-01-12 Doug Kwan <dougkwan@google.com>
6884
6885 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6886 (Arm_relobj::Mapping_symbol_position,
6887 Arm_reloj::Mapping_symbol_position_less,
6888 Arm_relobj::Mapping_symbols_info): New types.
6889 (Target_arm::is_mapping_symbol_name): New method definition.
6890 (Arm_relobj::do_count_local_symbols): Save information about mapping
6891 symbols.
6892
6893 2010-01-11 Doug Kwan <dougkwan@google.com>
6894
6895 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6896 Arm_relocate_functions::thumb32_branch_upper,
6897 Arm_relocate_functions::thumb32_branch_lower,
6898 Arm_relocate_functions::thumb32_cond_branch_offset,
6899 Arm_relocate_functions::thumb32_cond_branch_upper,
6900 Arm_relocate_functions::thumb32_cond_branch_lower,
6901 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6902 branch offset encoding.
6903 (Arm_relocate_functions::thumb_branch_common): Use new branch
6904 offset encoding methods to avoid code duplication.
6905 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6906 (Stub_addend_reader::operator()): Use new branch encoding method
6907 to avoid code duplication.
6908
6909 2010-01-11 Doug Kwan <dougkwan@google.com>
6910
6911 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6912 (Target_arm::do_finalize_sections): Define special EXIDX section
6913 symbols only if referenced.
6914 * gc.h (Garbage_collection::add_reference): New method.
6915 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6916 code duplication.
6917
6918 2010-01-11 Ian Lance Taylor <iant@google.com>
6919
6920 * script.cc (Version_script_info::build_expression_list_lookup):
6921 Change complaing about duplicate wildcard match from error to
6922 warning.
6923
6924 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6925 of 2009-12-30.
6926 (Version_script_info::Version_script_info): Initialize globs_,
6927 default_version_, default_is_global_, and exact_. Don't
6928 initialize globals_ or locals_.
6929 (Version_script_info::build_lookup_tables): Build local symbols
6930 first.
6931 (Version_script_info::unquote): New function.
6932 (Version_script_info::add_exact_match): New function.
6933 (Version_script_info::build_expression_list_lookup): Remove lookup
6934 parameter. Add is_global parameter. Change all callers. Handle
6935 wildcard pattern specially. Unquote pattern. Call
6936 add_exact_match.
6937 (Version_script_info::get_name_to_match): New function.
6938 (Version_script_info::get_symbol_version): New function.
6939 (Version_script_info::get_symbol_version_helper): Remove.
6940 (Version_script_info::check_unmatched_names): Call unquote.
6941 * script.h (class Version_script_info): Change get_symbol_version
6942 to be non-inline and add is_global parameter; change all callers.
6943 Rewrite symbol_is_local. Update declarations. Define struct
6944 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6945 Remove globals_ and locals_ members. Add exact_, globs_,
6946 default_version_, is_global_.
6947 (Version_script_info::Glob): Remove pattern, add expression and
6948 is_global. Update constructor. Change all callers.
6949 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6950 default version.
6951 (Versions::symbol_section_contents): If a symbol is undefined, or
6952 defined in a dynamic object, set the version index to
6953 VER_NDX_LOCAL.
6954 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6955 symbol_is_local.
6956 (Symbol_table::add_from_pluginobj): Likewise.
6957 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6958
6959 2010-01-11 Doug Kwan <dougkwan@google.com>
6960
6961 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6962 (incremental_dump_LDADD): Add linking option for libintl.
6963 * Makefile.in: Regenerate.
6964
6965 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6966
6967 PR gold/11144
6968 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6969 instead of -Ds.
6970 * testsuite/Makefile.in: Regenerated.
6971
6972 2010-01-10 Doug Kwan <dougkwan@google.com>
6973
6974 * options.h (DEFINE_var): Use parentheses around argument varname__
6975 in macro body to avoid any unintended subsequent substitutions.
6976
6977 2010-01-10 Ian Lance Taylor <iant@google.com>
6978
6979 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6980 candidates before doing symbol resolution.
6981
6982 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6983 ODR candidates if only one is weak.
6984
6985 2010-01-08 Ian Lance Taylor <iant@google.com>
6986
6987 * script.cc (Version_script_info::build_expression_list_lookup):
6988 Don't warn about ambiguous version, just record the ambiguity.
6989 (Version_script_info::get_symbol_version_helper): Give error if
6990 version is ambiguous.
6991
6992 2010-01-08 Doug Kwan <dougkwan@google.com>
6993
6994 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6995 prev_data_size_ and prev_addralign_. Remove initializer for
6996 deleted data member has_been_changed_.
6997 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6998 to determine if the table is empty.
6999 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7000 Remove.
7001 (Stub_table::add_reloc_stub): Define method in class definition
7002 instead of just declaring it there.
7003 (Stub_table::add_cortex_a8_stub): New method definition.
7004 (Stub_table::update_data_size_and_addralign): Ditto.
7005 (Stub_table::finalize_stubs): Ditto.
7006 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7007 (Stub_table::do_addralign_): Return address alignment in the
7008 (Stub_table::do_reset_address_and_file_offset): Define method in
7009 class definition instead of declaring it there. Set current data
7010 size to be the data size of the previous pass.
7011 (Stub_table::set_final_data_size): Use current data size as the
7012 final data size.
7013 (Stub_table::relocate_stub): Change parameter type of stub from
7014 Reloc_stub pointer to Stub pointer.
7015 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7016 (Stub_table::Cortex_a8_stub_list): New typedef.
7017 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7018 Stub_table::prev_addralign_): New data member.
7019 (Arm_relobj::Arm_relobj): Initialize data member
7020 section_has_cortex_a8_workaround_.
7021 (Arm_relobj::section_has_cortex_a8_workaround,
7022 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7023 definitions.
7024 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7025 declarations.
7026 (Target_arm::relocate_stub): Change parameter type of stub from
7027 Reloc_stub pointer to Stub pointer.
7028 (Insn_template::size, Insn_template::alignment): Handle
7029 THUMB16_SPECIAL_TYPE.
7030 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7031 Stub_table::update_data_size_and_addralign,
7032 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7033 definitions.
7034 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7035 (Stub_table::do_write): Ditto.
7036 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7037
7038 2010-01-08 Ian Lance Taylor <iant@google.com>
7039
7040 PR 11108
7041 * symtab.h (class Symbol): Remove fields is_target_special_ and
7042 has_plt_offset_. Add field is_defined_in_discarded_section_.
7043 (Symbol::is_defined_in_discarded_section): New function.
7044 (Symbol::set_is_defined_in_discarded_section): New function.
7045 (Symbol::has_plt_offset): Rewrite.
7046 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7047 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7048 Don't initialize is_target_special_ or has_plt_offset_.
7049 Initialize is_defined_in_discarded_section_.
7050 (Symbol_table::add_from_relobj): If appropriate, set
7051 is_defined_in_discarded_section.
7052 * resolve.cc (Symbol::override_base_with_special): Don't test
7053 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7054 * target-reloc.h (relocate_section): Do special handling for
7055 symbols defined in discarded sections for global symbols as well
7056 as local symbols.
7057
7058 2010-01-08 Ian Lance Taylor <iant@google.com>
7059
7060 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7061 the SHT_SYMTAB case.
7062
7063 2010-01-08 Ian Lance Taylor <iant@google.com>
7064
7065 * object.cc (Sized_relobj::do_layout): Don't get confused if
7066 layout_eh_frame returns NULL.
7067
7068 2010-01-08 Ian Lance Taylor <iant@google.com>
7069
7070 PR 11084
7071 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7072 dynamic symbol table, use the normal symbol table.
7073 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7074 symbol table.
7075
7076 2010-01-08 Ian Lance Taylor <iant@google.com>
7077
7078 PR 11072
7079 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7080 sections.
7081
7082 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7083
7084 * version.cc (print_version): Change to "Copyright 2010".
7085
7086 2010-01-08 Ian Lance Taylor <iant@google.com>
7087
7088 PR 10287
7089 PR 11063
7090 * i386.cc (class Target_i386): Change return type of plt_section
7091 to be non-const.
7092 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7093 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7094 tls_desc_rel_ field.
7095 (Output_data_plt_i386::rel_tls_desc): New function.
7096 (Target_i386::rel_tls_desc_section): New function.
7097 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7098 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7099 R_386_TLS_DESC reloc in rel_tls_desc_section.
7100 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7101 Define struct Tlsdesc_info.
7102 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7103 (Target_x86_64::do_reloc_symbol_index): New function.
7104 (Target_x86_64::add_tlsdesc_info): New function.
7105 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7106 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7107 tlsdesc_rel_ field.
7108 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7109 all callers.
7110 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7111 (Target_x86_64::rela_tlsdesc_section): New function.
7112 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7113 handling.
7114 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7115 (Target_x86_64::do_reloc_addend): New function.
7116 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7117 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7118 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7119 (Output_reloc::type): New function.
7120 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7121 (Output_reloc::is_target_specific): New function.
7122 (Output_reloc::target_arg): New function.
7123 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7124 absolute relocs and target specific relocs.
7125 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7126 add_target_specific.
7127 (class Output_data_reloc) [SHT_RELA]: Likewise.
7128 * output.cc (Output_reloc::Output_reloc): Add four new versions
7129 for absolute relocs and target specific relocs.
7130 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7131 (Output_reloc::get_symbol_index): Likewise.
7132 (Output_reloc::local_section_offset): Check that local_sym_index_
7133 is not TARGET_CODE or 0.
7134 (Output_reloc::symbol_value): Likewise.
7135 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7136 reloc.
7137 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7138 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7139 functions.
7140 * layout.cc (add_target_dynamic_tags): Use output section for
7141 DT_PLTRELSZ and DT_JMPREL.
7142
7143 2010-01-07 Ian Lance Taylor <iant@google.com>
7144
7145 PR 11061
7146 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7147 function.
7148 (class Output_data_reloc_generic): Define.
7149 (class Output_data_reloc_base): Change base class to
7150 Output_data_reloc_generic. Change add() method to call
7151 bump_relative_reloc_count for a relative reloc. Remove
7152 sort_relocs_ field.
7153 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7154 to sort_relocs().
7155 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7156 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7157 appropriate.
7158 * layout.h (class Layout): Update declaration.
7159
7160 2010-01-07 Ian Lance Taylor <iant@google.com>
7161
7162 * output.h (class Output_data): Add const version of
7163 output_section and do_output_section.
7164 (class Output_section_data): Add const version of
7165 do_output_section.
7166 (class Output_section): Likewise.
7167 * layout.cc (Layout::add_target_dynamic_tags): New function.
7168 * layout.h (class Layout): Update declarations.
7169 * arm.cc (Target_arm::do_finalize_sections): Use
7170 add_target_dynamic_tags.
7171 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7172 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7173 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7174 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7175
7176 2010-01-07 Ian Lance Taylor <iant@google.com>
7177
7178 PR 11042
7179 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7180 object as needed.
7181
7182 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7183 Ian Lance Taylor <iant@google.com>
7184
7185 PR 11019
7186 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7187 Xindex::read_symtab_xindex.
7188
7189 2010-01-07 Doug Kwan <dougkwan@google.com>
7190
7191 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7192 (Insn_template::thumb16_bcond_insn): New method declaration.
7193 (Insn_template): Fix spelling.
7194 (Stub::thumb16_special): New method declaration.
7195 (Stub::do_write): Define virtual method which was previously pure
7196 virtual.
7197 (Stub::do_thumb16_special): New method declaration.
7198 (Stub::do_fixed_endian_write): New template member.
7199 (Reloc_stub::do_write): Remove.
7200 (Reloc_stub::do_fixed_endian_write): Remove.
7201 (Cortex_a8_stub): New class definition.
7202 (Stub_factory::make_cortex_a8_stub): New method definition.
7203 (Stub_factory::Stub_factory): Add missing static storage class
7204 qualifier for elf32_arm_stub_a8_veneer_blx.
7205
7206 2010-01-07 Ian Lance Taylor <iant@google.com>
7207
7208 PR 10980
7209 * options.h (class General_options): Add --warn-unresolved-symbols
7210 and --error-unresolved-symbols.
7211 * errors.cc (Errors::undefined_symbol): Implement
7212 --warn-unresolved-symbols.
7213
7214 * options.h (class General_options): Add -z text and -z textoff.
7215 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7216
7217 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7218
7219 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7220 (Garbage_collection::cident_sections): New function.
7221 (Garbage_collection::add_cident_section): New function.
7222 (Garbage_collection::cident_sections_): New member.
7223 (gc_process_relocs): Add references to sections whose names are C
7224 identifiers.
7225 * gold.h (cident_section_start_prefix): New constant.
7226 (cident_section_stop_prefix): New constant.
7227 (is_cident): New function.
7228 * layout.cc (Layout::define_section_symbols): Replace string constants
7229 with the newly defined constants.
7230 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7231 C identifiers.
7232 * testsuite/Makefile.am: Add gc_orphan_section_test.
7233 * testsuite/Makefile.in: Regenerate.
7234 * testsuite/gc_orphan_section_test.cc: New file.
7235 * testsuite/gc_orphan_section_test.sh: New file.
7236
7237 2010-01-06 Ian Lance Taylor <iant@google.com>
7238
7239 PR 10980
7240 * options.h (class General_options): Add --warn-shared-textrel.
7241 * layout.cc (Layout::finish_dynamic_section): Implement
7242 --warn-shared-textrel.
7243
7244 PR 10980
7245 * options.h (class General_options): Add --warn-multiple-gp.
7246
7247 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7248
7249 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7250 $(THREADSLIB) and $(LIBDL).
7251 * Makefile.in: Rebuild.
7252
7253 2010-01-06 Ian Lance Taylor <iant@google.com>
7254
7255 PR 10980
7256 * options.cc (General_options::parse_section_start): New function.
7257 (General_options::section_start): New function.
7258 (General_options::General_options): Initialize all members.
7259 * options.h: Include <map>
7260 (class General_options): Add --section-start. Add section_starts_
7261 member.
7262 * layout.cc (Layout::attach_allocated_section_to_segment): If
7263 --section-start was used, set the address of the segment. Remove
7264 local sort_sections.
7265 (Layout::relaxation_loop_body): If the address of the load segment
7266 has been set by --section-start, don't use it.
7267 * output.h (Output_segment::update_flags_for_output_section): New
7268 function.
7269 * output.cc (Output_segment::add_output_section): Call
7270 update_flags_for_output_section.
7271
7272 2010-01-05 Ian Lance Taylor <iant@google.com>
7273
7274 PR 10980
7275 * options.h (class General_options): Add --undefined-version.
7276 * script.cc (struct Version_expression): Add was_matched_by_symbol
7277 field.
7278 (Version_script_info::matched_symbol): New function.
7279 (Version_script_info::get_symbol_version_helper): Call
7280 matched_symbol.
7281 (Version_script_info::check_unmatched_names): New function.
7282 * script.h (class Version_script_info): Update declarations.
7283 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7284
7285 * options.h (class General_options): Use DEFINE_bool_alias for
7286 allow_multiple_definition.
7287 * resolve.cc (Symbol_table::should_override): Don't test
7288 allow_multiple_definition.
7289
7290 PR 10980
7291 * options.h (class General_options): Add --cref.
7292 * main.cc (main): Print cref table if --cref. Don't close mapfile
7293 until after printing cref table.
7294 * cref.cc: Include "symtab.h".
7295 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7296 (Cref_table_compare::operator()): New function.
7297 (Cref_inputs::gather_cref): New function.
7298 (filecol): New static const.
7299 (Cref_inputs::print_cref): New function.
7300 (Cref::print_cref): New function.
7301 * cref.h: Include <cstdio>.
7302 (class Cref): Update declarations.
7303 * mapfile.h (Mapfile::file): New function.
7304 * object.h (class Object): Define Symbols. Declare virtual
7305 do_get_global_symbols.
7306 (Object::get_global_symbols): New function.
7307 * object.cc (Input_objects::add_object): Pass object to cref_ if
7308 --cref.
7309 (Input_objects::archive_start): Likewise.
7310 (Input_objects::archive_stop): Likewise.
7311 (Input_objects::print_cref): New function.
7312 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7313 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7314 --cref.
7315 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7316 function.
7317 * plugin.h (class Sized_pluginobj): Update declarations.
7318
7319 2010-01-05 Ian Lance Taylor <iant@google.com>
7320
7321 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7322 to is_default_version. Rename insdef to insdefault.
7323 (Symbol_table::add_from_relobj): Rename def to is_default_version
7324 and local to is_forced_local.
7325 (Symbol_table::add_from_pluginobj): Likewise.
7326 (Symbol_table::add_from_dynobj): Likewise.
7327 (Symbol_table::define_special_symbol): Rename insdef to
7328 insdefault.
7329
7330 2010-01-04 Ian Lance Taylor <iant@google.com>
7331
7332 PR 10980
7333 * options.h (class General_options): Add
7334 --allow-multiple-definition and -z muldefs.
7335 * resolve.cc (Symbol_table::should_override): Don't warn about a
7336 multiple symbol definition if --allow-multiple-definition or -z
7337 muldefs.
7338
7339 PR 10980
7340 * options.h (class General_options): Add --add-needed and
7341 --copy-dt-needed-entries. Tweak --as-needed help entry.
7342 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7343 error if --copy-dt-needed-entries aka --add-needed is used and
7344 would cause a change in behaviour.
7345
7346 PR 10980
7347 * options.h (class General_options): Add -G as a short version of
7348 --shared. Add no-op options -assert, -g, and -i.
7349
7350 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7351
7352 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7353 check for .text or .gnu.linkonce.t sections.
7354 * icf.cc (Icf::find_identical_sections): Ditto.
7355 Change the detection for mangled function name within the section
7356 name.
7357 * icf.h (is_section_foldable_candidate): New function.
7358
7359 2009-12-30 Ian Lance Taylor <iant@google.com>
7360
7361 PR 10980
7362 * options.h (class General_options): Permit two dashes with
7363 --retain-symbols-file.
7364
7365 2009-12-30 Ian Lance Taylor <iant@google.com>
7366
7367 PR 10979
7368 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7369 don't put the file header and segment headers in the text
7370 segment.
7371
7372 PR 10979
7373 * common.cc (Sort_commons::operator()): Stabilize sort when both
7374 entries are NULL.
7375 (Symbol_table::do_allocate_commons_list): When allocating common
7376 symbols, skip a symbol which is no longer common.
7377 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7378 an object before checking its type.
7379 * testsuite/common_test_2.c: New file.
7380 * testsuite/common_test_3.c: New file.
7381 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7382 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7383 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7384 (common_test_2_pic.o, common_test_2.so): New targets.
7385 (common_test_3_pic.o, common_test_3.so): New targets.
7386 * testsuite/Makefile.in: Rebuild.
7387
7388 PR 10979
7389 * script.cc (read_input_script): If we see a new SECTIONS clause,
7390 and we have added an input section, give an error.
7391 * layout.h (class Layout): Add have_added_input_section function.
7392 Add have_added_input_section_ field.
7393 * layout.cc (Layout::Layout): Initialize
7394 have_added_input_section_.
7395 (Layout::layout): Set have_added_input_section_.
7396 (Layout::layout_eh_frame): Likewise.
7397
7398 2009-12-30 Ian Lance Taylor <iant@google.com>
7399
7400 PR 10931
7401 * options.h (class General_options): Add --sort-common option.
7402 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7403 * common.cc (Sort_common): Add sort_order parameter to
7404 constructor. Add sort_order_ field.
7405 (Sort_commons::operator): Check sort_order_.
7406 (Symbol_table::allocate_commons): Determine the sort order.
7407 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7408 Change all callers.
7409 (Symbol_table::do_allocate_commons_list): Likewise.
7410
7411 2009-12-30 Ian Lance Taylor <iant@google.com>
7412
7413 PR 10916
7414 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7415 symbols from this object, don't change the visibility of an
7416 undefined symbol.
7417 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7418
7419 2009-12-30 Ian Lance Taylor <iant@google.com>
7420
7421 PR 10861
7422 * script.h (class Version_script_info): Define Language enum.
7423 Update declarations. Define Glob, Exact, and Lookup types. Add
7424 new fields globals_, locals_, and is_finalized_.
7425 * script.cc: Various formatting fixes.
7426 (class Parser_closure): Change language_stack_ from a vector of
7427 std::string to one of Version_script_info::Language. Adjust all
7428 uses accordingly.
7429 (class Lazy_demangler): Remove.
7430 (struct Version_expression): Change language from std::string to
7431 Version_script_info::Language.
7432 (Version_script_info::Version_script_info): New function.
7433 (Version_script_info::~Version_script_info): Don't call clear.
7434 (Version_script_info::finalize): New function.
7435 (Version_script_info::build_lookup_tables): New function.
7436 (Version_script_info::build_expression_list_lookup): New
7437 function.
7438 (Version_script_info::get_symbol_version_helper): Rewrite to use
7439 lookup tables.
7440 (Version_script_info::print_expression_list): Adjust to use
7441 Version_script_info::Language.
7442 (script_push_lex_into_version_mode): Check that the version script
7443 has not been finalized.
7444 (version_script_push_lang): Change language string to
7445 Version_script_info::Language.
7446 * options.cc (Command_line::version_script): New function.
7447 * options.h (class General_options): Add finalize_dynamic_list
7448 function. Change version_script from declaration to definition.
7449 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7450 * testsuite/version_script.map: Remove duplicate def of foo.
7451 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7452 version_script.map.
7453 * testsuite/Makefile.in: Rebuild.
7454
7455 2009-12-30 Ian Lance Taylor <iant@google.com>
7456
7457 PR 10843
7458 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7459 if the input symbol index is 0, make the output symbol index 0.
7460
7461 2009-12-30 Ian Lance Taylor <iant@google.com>
7462
7463 PR 10670
7464 * options.h (class General_options): Add -x/--discard-all.
7465 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7466 --discard-all. If the local symbol needs a dynamic entry, check
7467 that before handling --discard-locals.
7468
7469 2009-12-30 Ian Lance Taylor <iant@google.com>
7470
7471 PR 10450
7472 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7473 flags to PF_R.
7474 (Output_segment::add_output_section): Don't change the flags if
7475 the type is PT_TLS.
7476
7477 PR 10450
7478 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7479 GNU hash table if they need a dynamic value. Otherwise, don't add
7480 them if they are defined in a dynamic object or are forced local.
7481
7482 2009-12-29 Ian Lance Taylor <iant@google.com>
7483
7484 PR 10450
7485 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7486 .gnu.hash table for a 32-bit target.
7487
7488 PR 10450
7489 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7490 regular and a dynamic object only needs a dynamic symbol table
7491 entry if it is externally visible.
7492
7493 PR 10450
7494 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7495 constructor. Add global_offset_table_ field.
7496 (Target_i386::got_section): Set global_offset_table_.
7497 (Target_i386::do_finalize_sections): Set global_offset_table_
7498 size.
7499 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7500 in constructor. Add global_offset_table_ field.
7501 (Target_x86_64::got_section): Set global_offset_table_.
7502 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7503 size.
7504
7505 * layout.cc (Layout::Layout): Initialize increase_relro_.
7506 (Layout::get_output_section): Add is_relro, is_last_relro, and
7507 is_first_non_relro parameters. Change all callers.
7508 (Layout::choose_output_section): Likewise.
7509 (Layout::add_output_section_data): Likewise.
7510 (Layout::make_output_section): Likewise.
7511 (Layout::set_segment_offsets): Clear increase_relro when using a
7512 linker script.
7513 * layout.h (class Layout): Add increase_relro method. Add
7514 increase_relro_ field. Update declarations.
7515 * output.cc (Output_section::Output_section): Initialize
7516 is_last_relro_ and is_first_non_relro_.
7517 (Output_segment::add_output_section): Group relro sections is
7518 do_sort is true. Handle is_last_relro and is_first_non_relro.
7519 (Output_segment::maximum_alignment): Remove relro handling.
7520 (Output_segment::set_section_addresses): Add increase_relro
7521 parameter. Change all callers. Add initial alignment to align
7522 relro sections on separate page. Remove old relro handling.
7523 (Output_segment::set_section_list_addresses): Remove in_relro
7524 parameter. Change all callers.
7525 (Output_segment::set_offset): Add increase parameter. Change all
7526 callers. Remove old relro handling.
7527 * output.h (class Output_section): Add new methods: is_last_relro,
7528 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7529 Add is_last_relro_ and is_first_non_relro_ fields.
7530 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7531 Create separate .got.plt section. Call increase_relro.
7532 * x86_64.cc (Target_x86_64::got_section): Likewise.
7533 * testsuite/relro_script_test.t: Add .got.plt.
7534
7535 PR 10450
7536 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7537 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7538 (Layout::finalize): Call set_dynamic_symbol_size.
7539 (Layout::set_dynamic_symbol_size): New function.
7540 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7541 set_dynamic_symbol_size.
7542
7543 PR 10450
7544 * output.h (class Output_section): Add is_entsize_zero_ field.
7545 * output.cc (Output_section::Output_section): Initialize
7546 is_entsize_zero_.
7547 (Output_section::set_entsize): If two different entsizes are
7548 requested, force it to zero.
7549 (Output_section::add_input_section): Set flags for .debug_str
7550 before updating section flags. Set entsize.
7551 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7552 and SHF_STRING if all input sections have those flags.
7553
7554 2009-12-29 Rafael Espindola <espindola@google.com>
7555
7556 * main.cc (main): Fix the sys time reporting.
7557 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7558 reporting.
7559
7560 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7561
7562 * options.cc (General_options::parse_version): Allow -v to exit
7563 without an error if there is nothing to link.
7564
7565 2009-12-29 Ian Lance Taylor <iant@google.com>
7566
7567 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7568 using a version of gcc before 4.1.
7569 * configure: Rebuild.
7570
7571 2009-12-28 Chris Demetriou <cgd@google.com>
7572
7573 * attributes.cc (Output_attributes_section_data::do_write): Use
7574 std::vector::front rather than std::vector::data.
7575
7576 2009-12-28 Ian Lance Taylor <iant@google.com>
7577
7578 * symtab.h (class Symbol_table): Add enum Defined.
7579 * resolve.cc (Symbol_table::should_override): Add defined
7580 parameter. Change all callers. Test whether object is NULL
7581 before calling a method on it.
7582 (Symbol_table::report_resolve_problem): Add defined parameter.
7583 Change all callers.
7584 (Symbol_table::should_override_with_special): Likewise.
7585 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7586 parameter. Change all callers.
7587 (Symbol_table::do_define_in_output_data): Likewise.
7588 (Symbol_table::define_in_output_segment): Likewise.
7589 (Symbol_table::do_define_in_output_segment): Likewise.
7590 (Symbol_table::define_as_constant): Likewise.
7591 (Symbol_table::do_define_as_constant): Likewise.
7592 * script.h (class Symbol_assignment): Add is_defsym parameter to
7593 constructor; change all callers.
7594 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7595 parameter. Change all callers. Add is_defsym_ field.
7596 (class Parser_closure): Add parsing_defsym parameter to
7597 constructor; change all callers. Add parsing_defsym accessor
7598 function. Add parsing_defsym_ field.
7599
7600 2009-12-28 Ian Lance Taylor <iant@google.com>
7601
7602 * gold.cc (queue_middle_tasks): Fix formatting.
7603 * object.cc (Relobj::is_section_name_included): Likewise.
7604
7605 2009-12-23 Ian Lance Taylor <iant@google.com>
7606
7607 * i386.cc (Target_i386::do_calls_non_split): Recognize
7608 -fsplit-stack prologue for a function with a static chain.
7609 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7610 -fsplit-stack prologue when using %r11.
7611
7612 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7613
7614 * options.cc (General_options::parse_version): Make -v continue and do
7615 the link like GNU ld does.
7616
7617 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7618
7619 * Makefile.am (CCFILES): Add timer.cc.
7620 (HFILES): Add timer.h.
7621 * configure.ac: Check for sysconf and times.
7622 * main.cc: include timer.h.
7623 (main): Use Timer instead of get_run_time.
7624 * timer.cc: New.
7625 * timer.h: New.
7626 * workqueue.cc: include timer.h.
7627 (Workqueue::find_and_run_task):
7628 Report user, sys and wall time.
7629 * Makefile.in: Regenerate.
7630 * config.in: Regenerate.
7631 * configure: Regenerate.
7632
7633 2009-12-16 Doug Kwan <dougkwan@google.com>
7634
7635 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7636 sections.
7637 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7638 relaxed input sections.
7639 * output.cc (Output_section::find_relaxed_input_section): Change
7640 return type to Output_relaxed_input_section pointer. Adjust code
7641 for new type of relaxed_input_section_map_.
7642 * output.h (Output_section::find_relaxed_input_section): Change
7643 return type to Output_relaxed_input_section pointer.
7644 (Output_section::Output_relaxed_input_section_by_input_section_map):
7645 New type.
7646 (Output_section::relaxed_input_section_map_): Change type to
7647 Output_section::Output_relaxed_input_section_by_input_section_map.
7648 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7649 input section.
7650
7651 2009-12-15 Ian Lance Taylor <iant@google.com>
7652
7653 * layout.cc (Layout::create_shstrtab): Only write out after input
7654 sections if we are compressing debug sections.
7655
7656 2009-12-15 Ian Lance Taylor <iant@google.com>
7657
7658 * archive.cc (Archive::add_symbols): Only look up a symbol without
7659 a version if there is, in fact, a version.
7660
7661 2009-12-14 Ian Lance Taylor <iant@google.com>
7662
7663 Revert -Wshadow changes, all changes from:
7664 2009-12-11 Doug Kwan <dougkwan@google.com>
7665 2009-12-11 Nick Clifton <nickc@redhat.com>
7666 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7667
7668 2009-12-11 Doug Kwan <dougkwan@google.com>
7669
7670 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7671 due to -Wshadow.
7672 * attributes.cc (Object_attribute::size): Ditto.
7673 (Attributes_section_data::size): Ditto.
7674 (Attributes_section_data::Attributes_section_data): Ditto.
7675 (Output_attributes_section_data::do_write): Ditto.
7676 * attributes.h (Object_attribute::set_type): Ditto.
7677 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7678
7679 2009-12-11 Nick Clifton <nickc@redhat.com>
7680
7681 * archive.cc: Fix shadowed variable warnings.
7682 * arm.cc: Likewise.
7683 * compressed_output.cc: Likewise.
7684 * compressed_output.h: Likewise.
7685 * configure: Likewise.
7686 * dwarf_reader.cc: Likewise.
7687 * dynobj.cc: Likewise.
7688 * dynobj.h: Likewise.
7689 * ehframe.cc: Likewise.
7690 * ehframe.h: Likewise.
7691 * errors.cc: Likewise.
7692 * expression.cc: Likewise.
7693 * fileread.cc: Likewise.
7694 * fileread.h: Likewise.
7695 * freebsd.h: Likewise.
7696 * i386.cc: Likewise.
7697 * icf.cc: Likewise.
7698 * incremental.h: Likewise.
7699 * layout.cc: Likewise.
7700 * layout.h: Likewise.
7701 * mapfile.cc: Likewise.
7702 * merge.cc: Likewise.
7703 * merge.h: Likewise.
7704 * object.cc: Likewise.
7705 * object.h: Likewise.
7706 * options.h: Likewise.
7707 * output.cc: Likewise.
7708 * output.h: Likewise.
7709 * parameters.cc: Likewise.
7710 * plugin.cc: Likewise.
7711 * powerpc.cc: Likewise.
7712 * reduced_debug_output.cc: Likewise.
7713 * reduced_debug_output.h: Likewise.
7714 * reloc.cc: Likewise.
7715 * reloc.h: Likewise.
7716 * resolve.cc: Likewise.
7717 * script-sections.cc: Likewise.
7718 * script.cc: Likewise.
7719 * script.h: Likewise.
7720 * sparc.cc: Likewise.
7721 * symtab.cc: Likewise.
7722 * symtab.h: Likewise.
7723 * target-select.cc: Likewise.
7724 * target-select.h: Likewise.
7725 * token.h: Likewise.
7726 * workqueue.cc: Likewise.
7727 * workqueue.h: Likewise.
7728 * x86_64.cc: Likewise.
7729
7730 2009-12-10 Doug Kwan <dougkwan@google.com>
7731
7732 * arm.cc (attributes.h): New include.
7733 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7734 (Arm_relobj::~Arm_relobj): Delete object pointed by
7735 attributes_section_data_.
7736 (Arm_relobj::attributes_section_data): New method definition.
7737 (Arm_relobj::attributes_section_data_): New data member declaration.
7738 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7739 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7740 attributes_section_data_.
7741 (Arm_dynobj::attributes_section_data): New method definition.
7742 (Arm_dynobj::attributes_section_data_): New data member declaration.
7743 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7744 initialization value of may_use_blx_ to false.
7745 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7746 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7747 object attributes to compute results instead of hard-coding.
7748 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7749 Target_arm::get_secondary_compatible_arch,
7750 Target_arm::set_secondary_compatible_arch
7751 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7752 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7753 New method declarations.
7754 (Target_arm::get_aeabi_object_attribute): New method definition.
7755 (Target_arm::attributes_section_data_): New data member declaration.
7756 (read_arm_attributes_section): New template definition.
7757 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7758 (Arm_dynobj::do_read_symbols): Ditto.
7759 (Target_arm::do_finalize_sections): Merge attributes sections from
7760 input. Check for BLX use after attributes section merging.
7761 Fix __exidx_start and __exidx_end visibility. Create an
7762 .ARM.attributes section if necessary.
7763 (Target_arm::get_secondary_compatible_arch,
7764 Target_arm::set_secondary_compatible_arch,
7765 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7766 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7767 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7768 New method definitions.
7769
7770 2009-12-09 Ian Lance Taylor <iant@google.com>
7771
7772 * plugin.cc (Plugin::load): Don't cast from void* to a function
7773 pointer.
7774
7775 2009-12-09 Ian Lance Taylor <iant@google.com>
7776
7777 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7778 information fields.
7779
7780 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7781
7782 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7783 Replace two_file_shared_1.so with two_file_shared_2.so.
7784 * testsuite/Makefile.in: Regenerated.
7785
7786 2009-12-08 Doug Kwan <dougkwan@google.com>
7787
7788 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7789 (HFILES): Add attributes.h and int_encoding.h.
7790 * Makefile.in: Regenerate.
7791 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7792 function definitions to int_encoding.cc
7793 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7794 prototypes to int_encoding.h
7795 * reduced_debug_output.cc (int_encoding.h): New include.
7796 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7797 function definitions to int_encoding.cc
7798 (insert_into_vector, read_from_pointer): Move template definitions to
7799 int_encoding.h
7800 * attributes.cc: New file.
7801 * attributes.h: New file.
7802 * int_encoding.cc: New file.
7803 * int_encoding.h: New file.
7804
7805 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
7806
7807 PR gold/11055
7808 * incremental-dump.cc (dump_incremental_inputs): New.
7809 (main): Use dump_incremental_inputs.
7810
7811 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7812
7813 PR gold/10893
7814 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7815 checking elfcpp::STT_FUNC.
7816 (Target_i386::Relocate::relocate): Likewise.
7817 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7818
7819 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7820 symbols from shared libraries into normal FUNC symbols.
7821
7822 * symtab.h (Symbol): Add is_func and use it.
7823
7824 2009-12-05 Doug Kwan <dougkwan@google.com>
7825
7826 * arm.cc (Target_arm::arm_info): Initialize new fields
7827 attributes_section and attributes_vendor.
7828 * i386.cc (Target_i386::i386_info): Same.
7829 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7830 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7831 fields attributes_section and attributes_vendor.
7832 * sparc.cc (Target_sparc::sparc_info): Same.
7833 * target.h (Target::attributes_section, Target::attributes_vendor,
7834 Target::is_attributes_section, Target::attribute_arg_type,
7835 Target::attributes_order): New method definitions.
7836 (Target::Target_info::attributes_section,
7837 Target::Target_info::attributes_vendor): New fields.
7838 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7839 virtual method definitions.
7840 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7841 attributes_section and attributes_vendor.
7842 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7843
7844 2009-12-05 Doug Kwan <dougkwan@google.com>
7845
7846 * arm.cc: Update comments about interworking and stub generation.
7847 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7848 considered as non-PIC.
7849 (Arm_relocate_functions::base_abs): Fix formatting.
7850 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7851 of function to use GOT entry address instead of offset.
7852 (Target_arm::Scan::global): Issue an error if a symbol would need a
7853 PLT does not get one because it is untyped. Remove code to create
7854 dynamic symbols for relative branches.
7855 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7856 takes unsigned integer instead of boolean.
7857
7858 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7859
7860 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7861 (two_file_test_LDADD): Likewise.
7862 (common_test_1_LDADD): Likewise.
7863 (exception_test_LDADD) Likewise.
7864 (weak_test_LDADD): Likewise.
7865 (many_sections_test_LDADD): Likewise.
7866 (initpri1_LDADD): Likewise.
7867 (script_test_1_LDADD): Likewise.
7868 (script_test_2_LDADD): Likewise.
7869 (justsyms_LDADD): Likewise.
7870 (binary_test_LDADD): Likewise.
7871 (large_LDADD): Likewise.
7872 * testsuite/Makefile.in: Regenerated.
7873
7874 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
7875
7876 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7877 (Symbol_table::override_with_special): Likewise.
7878 (Symbol_table::add_from_object): Likewise.
7879
7880 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7881
7882 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7883 Don't set the data_offset twice.
7884
7885 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
7886
7887 * testsuite/Makefile.in: Regenerate.
7888
7889 2009-12-03 Doug Kwan <dougkwan@google.com>
7890
7891 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7892 (Target_arm::do_finalize_sections): Add parameter for symbol table
7893 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7894 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7895 parameter for symbol table pointer.
7896 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7897 an additional parameter for a pointer to symbol table.
7898 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7899 parameter for a symbol table pointer.
7900 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7901 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7902 Ditto.
7903 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7904 parameter for a symbol table pointer.
7905
7906 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
7907
7908 * incremental.cc (Incremental_inputs_header)
7909 (Incremental_inputs_header_write, Incremental_inputs_entry)
7910 (Incremental_inputs_entry_write): Move ...
7911 * incremental.h (Incremental_inputs_header)
7912 (Incremental_inputs_header_write, Incremental_inputs_entry)
7913 (Incremental_inputs_entry_write): here.
7914
7915 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7916
7917 * incremental.cc (make_sized_incremental_binary): Set the target.
7918 Error if it is incompatible.
7919 * output.h (Output_file): Add filename method.
7920
7921 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7922
7923 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7924 from the get_* methods.
7925
7926 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7927
7928 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7929 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7930 Write 0 for the data_offset of scripts.
7931
7932 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
7933
7934 * testsuite/Makefile.am: Add the incremental_test.sh test.
7935 * testsuite/incremental_test.sh: New.
7936 * testsuite/incremental_test_1.c: New.
7937 * testsuite/incremental_test_2.c: New.
7938
7939 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
7940
7941 * incremental-dump.cc (main): Fix typos.
7942
7943 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7944
7945 PR gold/11025
7946 * incremental-dump.cc (main): Use llu to print 64 bit values.
7947
7948 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7949 H.J. Lu <hongjiu.lu@intel.com>
7950
7951 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7952 $(LIBDL).
7953 (incremental_dump_LDADD): Likewise.
7954 * Makefile.in: Regenerated.
7955
7956 2009-11-25 Doug Kwan <dougkwan@google.com>
7957
7958 Revert:
7959
7960 2009-11-25 Doug Kwan <dougkwan@google.com>
7961
7962 * arm.cc (Target_arm::Target_arm): Move method definition
7963 outside of class definition. Add code to handle
7964 --target1-rel, --target1-abs and --target2= options.
7965 (Target_arm::get_reloc_reloc_type): Change method to be
7966 non-static and const.
7967 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7968 New data member declaration.
7969 (Target_arm::Scan::local, Target_arm::Scan::global,
7970 Target_arm::Relocate::relocate,
7971 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7972 Adjust call to Target_arm::get_real_reloc_type.
7973 (Target_arm::get_real_reloc_type): Use command line options
7974 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7975 * options.h (--target1-rel, --target1-abs, --target2): New
7976 ARM-only options.
7977
7978 2009-11-25 Doug Kwan <dougkwan@google.com>
7979
7980 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7981 class definition. Add code to handle --target1-rel, --target1-abs
7982 and --target2= options.
7983 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7984 and const.
7985 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7986 member declaration.
7987 (Target_arm::Scan::local, Target_arm::Scan::global,
7988 Target_arm::Relocate::relocate,
7989 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7990 call to Target_arm::get_real_reloc_type.
7991 (Target_arm::get_real_reloc_type): Use command line options to
7992 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7993 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7994 options.
7995
7996 2009-11-25 Doug Kwan <dougkwan@google.com>
7997
7998 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7999 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8000 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8001 formatting.
8002 (Arm_relocate_functions::thm_call): Replace body with a call to
8003 Arm_relocate_functions::thumb_branch_common.
8004 (Arm_relocate_functions::thm_jump24,
8005 Arm_relocate_functions::thm_xpc22): New method definitions.
8006 (Arm_relocate_functions::thumb_branch_common): New method definition.
8007 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8008 operator.
8009 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8010 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8011
8012 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8013
8014 * Makefile.am: Build incremental-dump
8015 * Makefile.in: Regenerate.
8016 * incremental-dump.cc: New.
8017 * incremental.cc (Incremental_inputs_header_data,
8018 Incremental_inputs_entry_data): Move to incremental.h
8019 * incremental.h: (Incremental_inputs_header_data,
8020 Incremental_inputs_entry_data): Move from incremental.cc
8021
8022 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8023
8024 * incremental.cc (Incremental_inputs_header,
8025 Incremental_inputs_header_write, Incremental_inputs_entry,
8026 Incremental_inputs_entry_write): Add a typedef with the data type.
8027
8028 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8029
8030 * incremental.cc (Incremental_inputs_header,
8031 Incremental_inputs_header_write, Incremental_inputs_entry,
8032 Incremental_inputs_entry_write): Update comment about which
8033 type has the filed descriptions.
8034
8035 2009-11-15 Doug Kwan <dougkwan@google.com>
8036
8037 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8038 (Arm_relocate_functions::arm_branch_common): Change method defintion
8039 in class definition to a method declaration and update list of formal
8040 parameters.
8041 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8042 Arm_relocation_functions::jump24): Adjust call to
8043 Arm_relocate_functions::arm_branch_common. Update list of formal
8044 parameters.
8045 (Arm_relocate_functions::xpc25): New method definition.
8046 (Arm_relocate_functions::arm_branch_common): Move method defintion
8047 out from class definition. Use stubs for mode-switching and extending
8048 branch ranges.
8049 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8050 specially. Change code to enable use of stubs in ARM branches.
8051
8052 2009-11-10 Doug Kwan <dougkwan@google.com>
8053
8054 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8055 in method declaration.
8056 (Target_arm::relocate_stub): New method declaration.
8057 (Target_arm::default_target): Change to return a pointer instead of
8058 a const reference.
8059 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8060 Target_arm::default_target.
8061 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8062 method definition.
8063 (Target_arm::relocate_section): Adjust view.
8064 (Target_arm::relocate_stub): New method definition.
8065
8066 2009-11-10 Doug Kwan <dougkwan@google.com>
8067
8068 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8069 a format warning.
8070 * incremental.cc (open_incremental_binary): Initialized local
8071 variables to avoid warnings.
8072 * object.cc (make_elf_object): Ditto.
8073 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8074 a format warning.
8075
8076 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8077
8078 PR gold/10930
8079 * testsuite/plugin_test.c: Include "config.h".
8080
8081 2009-11-09 Doug Kwan <dougkwan@google.com>
8082
8083 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8084 (arm_symbol_value): Remove.
8085 (Arm_relocate_functions::arm_branch_common,
8086 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8087 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8088 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8089 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8090 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8091 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8092 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8093 Arm_relocate_functions::thm_mobw_abs_nc,
8094 Arm_relocate_functions::thm_mov_abs,
8095 Arm_relocate_functions::movw_prel_nc,
8096 Arm_relocate_functions::thm_movt_abs,
8097 Arm_relocate_functions::movt_prel,
8098 Arm_relocate_functions::thm_movw_prel_nc,
8099 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8100 (Target_arm::Relocate::relocate): Only decompose address into two
8101 parts if relocation type uses the thumb-bit and pass the actual
8102 bit instead of a flag indicating that the thumb-bit is used. Adjust
8103 calls to methods in Arm_relocate_functions for this change.
8104
8105 2009-11-08 Ian Lance Taylor <iant@google.com>
8106
8107 PR 10925
8108 * reloc.cc: Instantiate
8109 Sized_relobj::initialize_input_to_output_maps and
8110 Sized_relobj:free_input_to_output_maps.
8111
8112 2009-11-06 Ian Lance Taylor <iant@google.com>
8113
8114 PR 10876
8115 * defstd.cc (in_segment): Set only_if_ref true for "end".
8116
8117 2009-11-06 Doug Kwan <dougkwan@google.com>
8118
8119 * arm.cc (class Reloc_stub): Correct a comment.
8120 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8121 (Target_arm::scan_section_for_stubs): New method declaration.
8122 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8123 Change methods from private to protected.
8124 (Target_arm::do_may_relax): New method definition.
8125 (Target_arm::do_relax, Target_arm::group_sections,
8126 Target_arm::scan_reloc_for_stub,
8127 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8128 (Target_arm::arm_input_section_map_): New data member declaration.
8129 (Target_arm::scan_reloc_for_stub,
8130 Target_arm::scan_reloc_section_for_stubs,
8131 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8132 Target_arm::do_relax): New method definitions.
8133
8134 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8135
8136 * configure.ac: Check for (struct stat)::st_mtim
8137 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8138 * config.in: Regenerate.
8139 * configure: Regenerate.
8140
8141 2009-11-05 Ian Lance Taylor <iant@google.com>
8142
8143 PR 10910
8144 * output.cc (Output_segment::add_output_section): Add missing
8145 return statement.
8146
8147 2009-11-04 Ian Lance Taylor <iant@google.com>
8148
8149 PR 10880
8150 * object.h (class Object): Add is_needed and set_is_needed
8151 methods. Add is_needed_ field. Make bool fields into bitfields.
8152 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8153 defined in a dynamic object and referenced by a regular object,
8154 set is_needed for the dynamic object.
8155 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8156 if the file is marked with as_needed and it is not needed.
8157
8158 2009-11-04 Ian Lance Taylor <iant@google.com>
8159
8160 PR 10887
8161 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8162 tags if data is discarded by linker script.
8163 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8164 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8165 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8166 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8167
8168 2009-11-04 Ian Lance Taylor <iant@google.com>
8169
8170 * layout.cc (Layout::get_output_section): Add is_interp and
8171 is_dynamic_linker_section parameters. Change all callers.
8172 (Layout::choose_output_section): Likewise.
8173 (Layout::make_output_section): Likewise.
8174 (Layout::add_output_section_data): Add is_dynamic_linker_section
8175 parameter. Change all callers.
8176 * layout.h (class Layout): Update declarations.
8177 * output.h (class Output_section): Add is_interp, set_is_interp,
8178 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8179 Add is_interp_, is_dynamic_linker_section_ fields. Change
8180 generate_code_fills_at_write_ to a bitfield.
8181 * output.cc (Output_section::Output_sections): Initialize new
8182 fields.
8183 (Output_segment::add_output_section): Add do_sort parameter.
8184 Change all callers.
8185
8186 2009-11-03 Ian Lance Taylor <iant@google.com>
8187
8188 PR 10860
8189 * options.h (class General_options): Add --warn-common.
8190 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8191 merging two common symbols.
8192 (Symbol_table::should_override): Handle --warn-common when merging
8193 a common symbol with a defined symbol. Use report_resolve_problem
8194 for multiple definitions.
8195 (Symbol_table::report_resolve_problem): New function.
8196 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8197
8198 2009-11-03 Doug Kwan <dougkwan@google.com>
8199
8200 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8201 stub_factory_.
8202 (Target_arm::stub_factory): New method definition.
8203 (Target_arm::new_arm_input_section,
8204 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8205 Target_arm::reloc_uses_thumb_bit): New method declarations.
8206 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8207 New type definitions.
8208 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8209 member declarations.
8210 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8211 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8212 New method definitions.
8213
8214 2009-11-03 Ian Lance Taylor <iant@google.com>
8215
8216 * options.h (class General_options): Add --warn_constructors.
8217
8218 2009-11-03 Ian Lance Taylor <iant@google.com>
8219
8220 PR 10893
8221 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8222 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8223
8224 2009-11-03 Ian Lance Taylor <iant@google.com>
8225
8226 PR 10895
8227 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8228 --msgid-bugs-address.
8229 (install-pdf): New target.
8230 (install-data_yes): Look up one directory to find mkinstalldirs.
8231
8232 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8233
8234 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8235 tree.
8236
8237 2009-10-30 Doug Kwan <dougkwan@google.com>
8238
8239 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8240
8241 2009-10-30 Doug Kwan <dougkwan@google.com>
8242
8243 * arm.cc (Stub_addend_reader): New struct template definition
8244 and partial specializations.
8245 (Stub_addend_reader::operator()): New method definition for a
8246 partially specialized template.
8247
8248 2009-10-30 Doug Kwan <dougkwan@google.com>
8249
8250 * arm.cc (Arm_relobj::processor_specific_flags): New method
8251 definition.
8252 (Arm_relobj::do_read_symbols): New method declaration.
8253 (Arm_relobj::processor_specific_flags_): New data member declaration.
8254 (Arm_dynobj): New class definition.
8255 (Target_arm::do_finalize_sections): Add input_objects parameter.
8256 (Target_arm::do_adjust_elf_header): New method declaration.
8257 (Target_arm::are_eabi_versions_compatible,
8258 (Target_arm::merge_processor_specific_flags): New method declaration.
8259 (Target_arm::do_make_elf_object): New overloaded method definitions
8260 and declaration.
8261 (Arm_relobj::do_read_symbols): New method definition.
8262 (Arm_dynobj::do_read_symbols): Ditto.
8263 (Target_arm::do_finalize_sections): Add input_objects parameters.
8264 Merge processor-specific flags from all input objects.
8265 (Target_arm::are_eabi_versions_compatible,
8266 Target_arm::merge_processor_specific_flags,
8267 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8268 New method definitions.
8269 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8270 Input_objects pointer type parameter.
8271 * layout.cc (Layout::finalize): Pass input objects to target's.
8272 finalize_sections function.
8273 * output.cc (Output_file_header::do_sized_write): Set ELF file
8274 header's processor-specific flags.
8275 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8276 Input_objects pointer type parameter.
8277 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8278 * target.h (Input_objects): New forward class declaration.
8279 (Target::processor_specific_flags,
8280 Target::are_processor_specific_flags_sect): New method definitions.
8281 (Target::finalize_sections): Add input_objects parameter.
8282 (Target::Target): Initialize processor_specific_flags_ and
8283 are_processor_specific_flags_set_.
8284 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8285 parameter.
8286 (Target::set_processor_specific_flags): New method definition.
8287 (Target::processor_specific_flags_,
8288 Target::are_processor_specific_flags_set_): New data member
8289 declarations.
8290 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8291 Input_objects pointer type parameter.
8292
8293 2009-10-30 Doug Kwan <dougkwan@google.com>
8294
8295 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8296
8297 2009-10-28 Ian Lance Taylor <iant@google.com>
8298
8299 * object.h (class Relobj): Drop options parameter from
8300 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8301 do_scan_relocs, do_relocate. Change all callers.
8302 (class Sized_relobj): Drop options parameters from
8303 do_gc_process_relocs, do_scan_relocs, do_relocate,
8304 do_relocate_sections, relocate_sections, emit_relocs_scan,
8305 emit_relocs_scan_reltype. Change all callers.
8306 (struct Relocate_info): Remove options field and all references to
8307 it.
8308 * reloc.h (class Read_relocs): Remove options constructor
8309 parameter and options_ field. Change all callers.
8310 (class Gc_process_relocs, class Scan_relocs): Likewise.
8311 (class Relocate_task): Likewise.
8312 * target-reloc.h (scan_relocs): Remove options parameter. Change
8313 all callers.
8314 (scan_relocatable_relocs): Likewise.
8315 * target.h (class Sized_target): Remove options parameter from
8316 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8317 all callers.
8318 * gc.h (gc_process_relocs): Remove options parameter. Change all
8319 callers.
8320 * arm.cc: Update functions to remove options parameters.
8321 * i386.cc: Likewise.
8322 * powerpc.cc: Likewise.
8323 * sparc.cc: Likewise.
8324 * x86_64.cc: Likewise.
8325 * testsuite/testfile.cc: Likewise.
8326
8327 2009-10-28 Doug Kwan <dougkwan@google.com>
8328
8329 * arm.cc (Arm_relobj): New class definition.
8330 (Arm_relobj::scan_sections_for_stubs,
8331 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8332 New method definitions.
8333
8334 2009-10-28 Cary Coutant <ccoutant@google.com>
8335
8336 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8337 (Plugin::cleanup_done_): New member.
8338 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8339 (Plugin_manager::cleanup_done_): Remove.
8340 (Plugin_manager::add_input_file): Edit error message.
8341 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8342 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8343
8344 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8345
8346 * fileread.cc: (File_read::View::~View): Use the new
8347 data_ownership_ filed.
8348 (File_read::~File_read): Dispose the new whole_file_view_.
8349 (File_read::open): Mmap the whole file if needed.
8350 (File_read::open): Use whole_file_view_ instead of contents_.
8351 (File_read::find_view): Use whole_file_view_ if applicable.
8352 (File_read::do_read): Use whole_file_view_ instead of contents_.
8353 (File_read::make_view): Use whole_file_view_ instead of contents_,
8354 update File_read::View::View call.
8355 (File_read::find_or_make_view): Update File_read::View::View
8356 call.
8357 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8358 remove contents_
8359 (File_read::View::Data_ownership): New enum.
8360 (File_read::View::View): Replace bool mapped_ with Data_ownership
8361 argument.
8362 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8363 (File_read::View::data_ownership_): New field.
8364 (File_read::contents_): Remove (replaced by whole_file_view_).
8365 (File_read::whole_file_view_): New field.
8366 * options.h (class General_options): Add --keep-files-mapped.
8367
8368 2009-10-27 Cary Coutant <ccoutant@google.com>
8369
8370 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8371 * testsuite/Makefile.am (plugin_test_5): New test case.
8372 * testsuite/Makefile.in: Regenerate.
8373
8374 2009-10-25 Doug Kwan <dougkwan@google.com>
8375
8376 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8377 from private to protected to allow access by child class.
8378 (Sized_relobj::do_relocate_sections): New method declaration.
8379 (Sized_relobj::relocate_sections): Virtualize.
8380 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8381 Sized_relobj::relocate_sections. Instantiate template explicitly
8382 for different target sizes and endianity.
8383
8384 2009-10-24 Doug Kwan <dougkwan@google.com>
8385
8386 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8387 (Arm_input_section::as_arm_input_section): New method.
8388 (Arm_output_section): New class definition.
8389 (Arm_output_section::create_stub_group,
8390 Arm_output_section::group_sections): New method definitions.
8391
8392 2009-10-22 Doug Kwan <dougkwan@google.com>
8393
8394 * arm.cc (Arm_input_section): New class definition.
8395 (Arm_input_section::init, Arm_input_section:do_write,
8396 Arm_input_section::set_final_data_size,
8397 Arm_input_section::do_reset_address_and_file_offset): New method
8398 definitions.
8399
8400 2009-10-21 Doug Kwan <dougkwan@google.com>
8401
8402 * arm.cc (Stub_table, Arm_input_section): New forward class
8403 declarations.
8404 (Stub_table): New class defintion.
8405 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8406 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8407 New method definition.
8408
8409 2009-10-21 Doug Kwan <dougkwan@google.com>
8410
8411 * arm.cc: Update copyright comments.
8412 (Target_arm): New forward class template declaration.
8413 (Arm_address): New type.
8414 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8415 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8416 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8417 constants.
8418 (Insn_template): Same.
8419 (DEF_STUBS): New macro.
8420 (Stub_type): New enum type.
8421 (Stub_template): New class definition.
8422 (Stub): Same.
8423 (Reloc_stub): Same.
8424 (Stub_factory): Same.
8425 (Target_arm::Target_arm): Initialize may_use_blx_ and
8426 should_force_pic_veneer_.
8427 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8428 Target_arm::should_force_pic_veneer,
8429 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8430 Target_arm::using_thumb_only, Target_arm:;default_target): New
8431 method defintions.
8432 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8433 New data member declarations.
8434 (Insn_template::size, Insn_template::alignment): New method defintions.
8435 (Stub_template::Stub_template): New method definition.
8436 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8437 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8438 (Stub_factory::Stub_factory): New method definition.
8439 * gold.h (string_hash): New template.
8440 * output.h (Input_section_specifier::hash_value): Use
8441 gold::string_hash.
8442 (Input_section_specifier::string_hash): Remove.
8443 * stringpool.cc (Stringpool_template::string_hash): Use
8444 gold::string_hash.
8445
8446 2009-10-20 Doug Kwan <dougkwan@google.com>
8447
8448 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8449 symbols of relaxed input sections.
8450 * output.h (Output_section::find_relaxed_input_section): Make
8451 method public.
8452
8453 2009-10-16 Doug Kwan <dougkwan@google.com>
8454
8455 * dynobj.cc (Versions::Versions): Initialize version_script_.
8456 Only insert base version symbol definition for a shared object
8457 if version script defines any version versions.
8458 (Versions::define_base_version): New method definition.
8459 (Versions::add_def): Check that base version is not needed.
8460 (Versions::add_need): Define base version lazily.
8461 * dynobj.h (Versions::define_base_version): New method declaration.
8462 (Versions::needs_base_version_): New data member declaration.
8463 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8464 (check_DATA): Add no_version_test.stdout.
8465 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8466 New make rules.
8467 * testsuite/Makefile.in: Regenerate.
8468 * testsuite/no_version_test.c: New file.
8469 * testsuite/no_version_test.sh: Ditto.
8470
8471 2009-10-16 Doug Kwan <dougkwan@google.com>
8472
8473 * expression.cc (class Segment_start_expression): New class definition.
8474 (Segment_start_expression::value): New method definition.
8475 (script_exp_function_segment_start): Return a new
8476 Segment_start_expression.
8477 * gold/script-c.h (script_saw_segment_start_expression): New function
8478 prototype.
8479 * script-sections.cc (Script_sections::Script_sections): Initialize
8480 SAW_SEGMENT_START_EXPRESSION_ to false.
8481 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8482 and -Tbbs options to specify section addresses if given in
8483 command line and no SEGMENT_START expression is seen in a script.
8484 * script-sections.h (Script_sections::saw_segment_start_expression,
8485 Script_sections::set_saw_segment_start_expression): New method
8486 definition.
8487 (Script_sections::saw_segment_start_expression_): New data member
8488 declaration.
8489 * script.cc (script_saw_segment_start_expression): New function.
8490 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8491 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8492 script_test_7.sh and script_test_8.sh.
8493 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8494 script_test_8.stdout.
8495 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8496 (script_test_6, script_test_6.stdout, script_test_7,
8497 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8498 * Makefile.in: Regenerate.
8499 * testsuite/script_test_6.sh: New file.
8500 * testsuite/script_test_6.t: Same.
8501 * testsuite/script_test_7.sh: Same.
8502 * testsuite/script_test_7.t: Same.
8503 * testsuite/script_test_8.sh: Same.
8504
8505 2009-10-16 Doug Kwan <dougkwan@google.com>
8506
8507 * output.cc (Output_segment::set_section_list_address): Cast
8508 expressions to unsigned long long type to avoid format warnings.
8509
8510 2009-10-15 Ian Lance Taylor <iant@google.com>
8511
8512 * script.cc (Script_options::add_symbol_assignment): Always add a
8513 dot assignment to script_sections_.
8514 * script-sections.cc (Script_sections::add_dot_assignment):
8515 Initialize if necessary.
8516
8517 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8518 program headers with no load segment if there is a linker script.
8519
8520 * layout.cc (Layout::set_segment_offsets): Align the file offset
8521 to the segment aligment for -N or -n with no load segment.
8522 * output.cc (Output_segment::add_output_section): Don't crash if
8523 the first section is a TLS section.
8524 (Output_segment::set_section_list_addresses): Print an error
8525 message if the address moves backward in a linker script.
8526 * script-sections.cc
8527 (Output_section_element_input::set_section_addresses): Don't
8528 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8529 (Orphan_output_section::set_section_addresses): Likewise.
8530
8531 2009-10-15 Doug Kwan <dougkwan@google.com>
8532
8533 * layout.cc (Layout::finish_dynamic_section): Generate tags
8534 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8535 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8536 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8537
8538 2009-10-14 Ian Lance Taylor <iant@google.com>
8539
8540 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8541 fields.
8542 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8543 data_shdr fields of relinfo.
8544 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8545 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8546 R_386_TLS_LDO_32, adjust based on section flags.
8547 (Target_i386::Relocate::fix_up_ldo): Remove.
8548
8549 2009-10-13 Ian Lance Taylor <iant@google.com>
8550
8551 Add support for -pie.
8552 * options.h (class General_options): Add -pie and
8553 --pic-executable.
8554 (General_options::output_is_position_independent): Test -pie.
8555 (General_options::output_is_executable): Return true if not shared
8556 and not relocatable.
8557 (General_options::output_is_pie): Remove.
8558 * options.cc (General_options::finalize): Reject incompatible uses
8559 of -pie.
8560 * gold.cc (queue_middle_tasks): A -pie link is not static.
8561 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8562 * symtab.cc (Symbol::final_value_is_known): Return false if
8563 output_is_position_independent.
8564 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8565 output_is_position_independent.
8566 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8567 output_is_position_independent.
8568 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8569 output_is_position_independent.
8570 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8571 two_file_pie_test.
8572 (basic_pie_test.o, basic_pie_test): New targets.
8573 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8574 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8575 (two_file_pie_test): New target.
8576 * testsuite/Makefile.in: Rebuild.
8577 * README: Remove note saying that -pie is not supported.
8578
8579 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8580
8581 * options.h (class General_options): Add -init and -fini.
8582 * layout.cc (Layout::finish_dynamic_section): Emit
8583 given init and fini functions.
8584
8585 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8586
8587 * gc.h (gc_process_relocs): Check if icf is enabled using new
8588 function.
8589 * gold.cc (queue_initial_tasks): Likewise.
8590 (queue_middle_tasks): Likewise.
8591 * object.cc (do_layout): Likewise.
8592 * symtab.cc (is_section_folded): Likewise.
8593 * main.cc (main): Likewise.
8594 * reloc.cc (Read_relocs::run): Likewise.
8595 (Sized_relobj::do_scan_relocs): Likewise.
8596 * icf.cc (is_function_ctor_or_dtor): New function.
8597 (Icf::find_identical_sections): Check if function is ctor or dtor when
8598 safe icf is chosen.
8599 * options.h (General_options::icf): Change option to be an enum.
8600 (Icf_status): New enum.
8601 (icf_enabled): New method.
8602 (icf_safe_folding): New method.
8603 (set_icf_status): New method.
8604 (icf_status_): New variable.
8605 * (options.cc) (General_options::finalize): Set icf_status_.
8606 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8607 icf_test and icf_keep_unique_test to use the --icf enum flag.
8608 * testsuite/icf_safe_test.sh: New file.
8609 * testsuite/icf_safe_test.cc: New file.
8610
8611 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8612
8613 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8614 includes to gc.h and icf.h.
8615 * arm.cc: Include gc.h.
8616 * gold.cc: Likewise.
8617 * i386.cc: Likewise.
8618 * powerpc.cc: Likewise.
8619 * sparc.cc: Likewise.
8620 * x86_64.cc: Likewise.
8621 * gc.h: Include icf.h.
8622
8623 2009-10-11 Ian Lance Taylor <iant@google.com>
8624
8625 * plugin.cc: Include "gold.h" before other header files.
8626
8627 2009-10-10 Chris Demetriou <cgd@google.com>
8628
8629 * options.h (Input_file_argument::Input_file_type): New enum.
8630 (Input_file_argument::is_lib_): Replace with...
8631 (Input_file_argument::type_): New member.
8632 (Input_file_argument::Input_file_argument): Take Input_file_type
8633 'type' rather than boolean 'is_lib' as second argument.
8634 (Input_file_argument::is_lib): Use type_.
8635 (Input_file_argument::is_searched_file): New function.
8636 (Input_file_argument::may_need_search): Handle is_searched_file.
8637 * options.cc (General_options::parse_library): Support -l:filename.
8638 (General_options::parse_just_symbols): Update for Input_file_argument
8639 changes.
8640 (Command_line::process): Likewise.
8641 * archive.cc (Archive::get_file_and_offset): Likewise.
8642 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8643 * script.cc (read_script_file, script_add_file): Likewise.
8644 * fileread.cc (Input_file::Input_file): Likewise.
8645 (Input_file::will_search_for): Handle is_searched_file.
8646 (Input_file::open): Likewise.
8647 * readsyms.cc (Read_symbols::get_name): Likewise.
8648 * testsuite/Makefile.am (searched_file_test): New test.
8649 * testsuite/Makefile.in: Regenerate.
8650 * testsuite/searched_file_test.cc: New file.
8651 * testsuite/searched_file_test_lib.cc: New file.
8652
8653 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8654 Ian Lance Taylor <iant@google.com>
8655
8656 * descriptor.cc: Include <cstdio> and "binary-io.h".
8657 (Descriptors::open): Open the files in binary mode always.
8658 * script.cc (Lex::get_token): Treat \r as whitespace.
8659
8660 2009-10-09 Ian Lance Taylor <iant@google.com>
8661
8662 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8663
8664 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8665 Ian Lance Taylor <iant@google.com>
8666
8667 * configure.ac: Check for readv function also.
8668 * fileread.cc (readv): Define if not HAVE_READV.
8669 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8670 does not exist.
8671 * config.in: Regenerate.
8672 * configure: Regenerate.
8673
8674 2009-10-09 Doug Kwan <dougkwan@google.com>
8675
8676 * layout.cc (Layout::make_output_section): Call target hook to make
8677 ordinary output section.
8678 (Layout::finalize): Adjust parameter list of call the
8679 Target::may_relax().
8680 * layout.h (class Layout::section_list): New method.
8681 * merge.h (Output_merge_base::entsize): Change visibility to public.
8682 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8683 New methods.
8684 (Output_merge_string::do_is_string): New method.
8685 * object.cc (Sized_relobj::do_setup): renamed from
8686 Sized_relobj::set_up.
8687 * object.h (Sized_relobj::adjust_shndx,
8688 Sized_relobj::initializ_input_to_output_maps,
8689 Sized_relobj::free_input_to_output_maps): Change visibilities to
8690 protected.
8691 (Sized_relobj::setup): Virtualize.
8692 (Sized_relobj::do_setup): New method declaration.
8693 (Sized_relobj::invalidate_section_offset,
8694 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8695 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8696 * options.cc (parse_int): New function.
8697 * options.h (parse_int): New declaration.
8698 (DEFINE_int): New macro.
8699 (stub_group_size): New option.
8700 * output.cc (Output_section::Output_section): Initialize memebers
8701 merge_section_map_, merge_section_by_properties_map_,
8702 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8703 (Output_section::add_input_section): Handled deferred code-fill
8704 generation and remove an old comment.
8705 (Output_section::add_relaxed_input_section): New method definition.
8706 (Output_section::add_merge_input_section): Use merge section by
8707 properties map to speed to search. Update merge section maps
8708 as appropriate.
8709 (Output_section::build_relaxation_map): New method definition.
8710 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8711 Same.
8712 (Output_section::relax_input_section): Renamed to
8713 Output_section::convert_input_sections_to_relaxed_sections and change
8714 interface to take a vector of pointers to relaxed sections.
8715 (Output_section::find_merge_section,
8716 Output_section::find_relaxed_input_section): New method definitions.
8717 (Output_section::is_input_address_mapped,
8718 Output_section::output_offset, Output_section::output_address):
8719 Use output section data maps to speed up searching.
8720 (Output_section::find_starting_output_address): Add comments.
8721 (Output_section::do_write,
8722 Output_section::write_to_postprocessing_buffer): Do code-fill
8723 generation as appropriate.
8724 (Output_section::get_input_sections): Invalidate relaxed input section
8725 map.
8726 (Output_section::restore_states): Adjust type of checkpoint .
8727 Invalidate relaxed input section map.
8728 * output.h (Output_merge_base): New class declaration.
8729 (Input_section_specifier): New class defintion.
8730 (class Output_relaxed_input_section) Change base class to
8731 Output_section_data_build.
8732 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8733 base class initializer.
8734 (Output_section::add_relaxed_input_section): New method declaration.
8735 (Output_section::Input_section): Change visibility to protected.
8736 (Output_section::Input_section::relobj,
8737 Output_section::Input_section::shndx): Handle relaxed input sections.
8738 Output_section::input_sections) Change visibility to protected. Also
8739 define overload to return a non-const pointer.
8740 (Output_section::Merge_section_properties): New class defintion.
8741 (Output_section::Merge_section_by_properties_map,
8742 Output_section::Output_section_data_by_input_section_map,
8743 Output_section::Relaxation_map): New types.
8744 (Output_section::relax_input_section): Rename method to
8745 Output_section::convert_input_sections_to_relaxed_sections and change
8746 interface to take a vector of relaxed section pointers.
8747 (Output_section::find_merge_section,
8748 Output_section::find_relaxed_input_section,
8749 Output_section::build_relaxation_map,
8750 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8751 New method declarations.
8752 (Output_section::merge_section_map_
8753 Output_section::merge_section_by_properties_map_,
8754 Output_section::relaxed_input_section_map_,
8755 Output_section::is_relaxed_input_section_map_valid_,
8756 Output_section::generate_code_fills_at_write_): New data members.
8757 * script-sections.cc
8758 (Output_section_element_input::set_section_addresses): Call
8759 current_data_size and addralign methods of relaxed input sections.
8760 (Orphan_output_section::set_section_addresses): Call current_data_size
8761 and addralign methods of relaxed input sections.
8762 * symtab.cc (Symbol_table::compute_final_value): Extract template
8763 from the body of Symbol_table::sized_finalize_symbol.
8764 (Symbol_table::sized_finalized_symbol): Call
8765 Symbol_table::compute_final_value.
8766 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8767 (Symbol_table::compute_final_value): New templated method declaration.
8768 * target.cc (Target::do_make_output_section): New method defintion.
8769 * target.h (Target::make_output_section): New method declaration.
8770 (Target::relax): Add more parameters for input objects, symbol table
8771 and layout. Adjust call to do_relax.
8772 (Target::do_make_output_section): New method declaration.
8773 (Target::do_relax): Add parameters for input objects, symbol table
8774 and layout.
8775
8776 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8777
8778 * pread.c: Include stdio.h.
8779
8780 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8781
8782 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8783 defined.
8784
8785 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8786
8787 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8788 Change read_shndx type to unsigned int.
8789 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8790 int.
8791 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8792 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8793 Change read_shndx type to unsigned int.
8794 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8795 int.
8796 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8797 * layout.cc (Layout::create_symtab_sections): Cast the result of
8798 local_symcount * symsize to off_t in the gold_assert.
8799
8800 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8801
8802 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8803 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8804 R_ARM_BASE_ABS.
8805 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8806 (Arm_relocate_functions::thm_abs5): New function.
8807 (Arm_relocate_functions::abs12): New function.
8808 (Arm_relocate_functions::abs16): New function.
8809 (Arm_relocate_functions::base_abs): New function.
8810 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8811 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8812 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8813 R_ARM_BASE_ABS.
8814 (Scan::global): Likewise.
8815 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8816 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8817 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8818 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8819 R_ARM_BASE_ABS.
8820
8821 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8822
8823 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8824 (Arm_relocate_functions::movt_prel): New function.
8825 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8826 (Arm_relocate_functions::thm_movt_prel): New function.
8827 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8828 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8829 (Scan::global, Relocate::relocate): Likewise.
8830 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8831
8832 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8833
8834 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8835 Incremental_checker.
8836 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8837 unsigned int.
8838 (class Incremental_inputs_header): New class.
8839 (Incremental_inputs_header_writer): Edit comment.
8840 (Incremental_inputs_entry): New class.
8841 (Incremental_inputs_entry_writer): Edit comment.
8842 (Sized_incremental_binary::do_find_incremental_inputs_section):
8843 Add *strtab_shndx parameter, fill it.
8844 (Sized_incremental_binary::do_check_inputs): New method.
8845 (Incremental_checker::can_incrementally_link_output_file): Use
8846 Sized_incremental_binary::check_inputs.
8847 (Incremental_inputs::report_command_line): Save command line in
8848 command_line_.
8849 * incremental.h:
8850 (Incremental_binary::find_incremental_inputs_section): New
8851 method.
8852 (Incremental_binary::do_find_incremental_inputs_section): Add
8853 strtab_shndx parameter.
8854 (Incremental_binary::do_check_inputs): New pure virtual method.
8855 (Sized_incremental_binary::do_check_inputs): Declare.
8856 (Incremental_checker::Incremental_checker): Add incremental_inputs
8857 parameter, use it to initialize incremental_inputs_.
8858 (Incremental_checker::incremental_inputs_): New field.
8859 (Incremental_checker::command_line): New method.
8860 (Incremental_checker::inputs): New method.
8861 (Incremental_checker::command_line_): New field.
8862
8863 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8864
8865 * incremental.cc: Include <cstdarg> and "target-select.h".
8866 (vexplain_no_incremental): New function.
8867 (explain_no_incremental): New function.
8868 (Incremental_binary::error): New method.
8869 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8870 method.
8871 (make_sized_incremental_binary): New function.
8872 (open_incremental_binary): New function.
8873 (can_incrementally_link_file): Add checks if output is ELF and has
8874 inputs section.
8875 * incremental.h: Include "elfcpp_file.h" and "output.h".
8876 (Incremental_binary): New class.
8877 (Sized_incremental_binary): New class.
8878 (open_incremental_binary): Declare.
8879 * object.cc (is_elf_object): Use
8880 elfcpp::Elf_recognizer::is_elf_file.
8881 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8882 * output.h (Output_file::filesize): New method.
8883
8884 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8885
8886 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8887 New function.
8888 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8889 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8890 function.
8891 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8892 function.
8893 (Arm_relocate_functions::movw_abs_nc): New function.
8894 (Arm_relocate_functions::movt_abs): New function.
8895 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8896 (Arm_relocate_functions::thm_movt_abs): New function.
8897 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8898 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8899 (Scan::global): Likewise.
8900 (Relocate::relocate): Likewise.
8901 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8902
8903 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8904
8905 * arm.cc (Arm_relocate_functions::got_prel) New function.
8906 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8907 (Relocate::relocate): Likewise.
8908 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8909
8910 2009-10-06 Ian Lance Taylor <iant@google.com>
8911
8912 * options.h (class General_options): Define
8913 split_stack_adjust_size parameter.
8914 * object.h (class Object): Add uses_split_stack_ and
8915 has_no_split_stack_ fields. Add uses_split_stack and
8916 has_no_split_stack accessor functions. Declare
8917 handle_split_stack_section.
8918 (class Reloc_symbol_changes): Define.
8919 (class Sized_relobj): Define Function_offsets. Declare
8920 split_stack_adjust, split_stack_adjust_reltype, and
8921 find_functions.
8922 * object.cc (Object::handle_split_stack_section): New function.
8923 (Sized_relobj::do_layout): Call handle_split_stack_section.
8924 * dynobj.cc (Sized_dynobj::do_layout): Call
8925 handle_split_stack_section.
8926 * reloc.cc (Sized_relobj::relocate_sections): Call
8927 split_stack_adjust for executable sections in split_stack
8928 objects. Pass reloc_map to relocate_section.
8929 (Sized_relobj::split_stack_adjust): New function.
8930 (Sized_relobj::split_stack_adjust_reltype): New function.
8931 (Sized_relobj::find_functions): New function.
8932 * target-reloc.h: Include "object.h".
8933 (relocate_section): Add reloc_symbol_changes parameter. Change
8934 all callers.
8935 * target.h (class Target): Add calls_non_split method. Declare
8936 do_calls_non_split virtual method. Declare match_view and
8937 set_view_to_nop.
8938 * target.cc: Include "elfcpp.h".
8939 (Target::do_calls_non_split): New function.
8940 (Target::match_view): New function.
8941 (Target::set_view_to_nop): New function.
8942 * gold.cc (queue_middle_tasks): Give an error if mixing
8943 split-stack and non-split-stack objects with -r.
8944 * i386.cc (Target_i386::relocate_section): Add
8945 reloc_symbol_changes parameter.
8946 (Target_i386::do_calls_non_split): New function.
8947 * x86_64.cc (Target_x86_64::relocate_section): Add
8948 reloc_symbol_changes parameter.
8949 (Target_x86_64::do_calls_non_split): New function.
8950 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8951 parameter.
8952 * powerpc.cc (Target_powerpc::relocate_section): Add
8953 reloc_symbol_changes parameter.
8954 * sparc.cc (Target_sparc::relocate_section): Add
8955 reloc_symbol_changes parameter.
8956 * configure.ac: Call AM_CONDITIONAL for the default target.
8957 * configure: Rebuild.
8958 * testsuite/Makefile.am (TEST_AS): New variable.
8959 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8960 (check_DATA): Add split_i386 and split_x86_64 files.
8961 (SPLIT_DEFSYMS): Define.
8962 (split_i386_[1234n].o): New targets.
8963 (split_i386_[124]): New targets.
8964 (split_i386_[1234r].stdout): New targets.
8965 (split_x86_64_[1234n].o): New targets.
8966 (split_x86_64_[124]): New targets.
8967 (split_x86_64_[1234r].stdout): New targets.
8968 (MOSTLYCLEANFILES): Add new executables.
8969 * testsuite/split_i386.sh: New file.
8970 * testsuite/split_x86_64.sh: New file.
8971 * testsuite/split_i386_1.s: New file.
8972 * testsuite/split_i386_2.s: New file.
8973 * testsuite/split_i386_3.s: New file.
8974 * testsuite/split_i386_4.s: New file.
8975 * testsuite/split_i386_n.s: New file.
8976 * testsuite/split_x86_64_1.s: New file.
8977 * testsuite/split_x86_64_2.s: New file.
8978 * testsuite/split_x86_64_3.s: New file.
8979 * testsuite/split_x86_64_4.s: New file.
8980 * testsuite/split_x86_64_n.s: New file.
8981 * testsuite/testfile.cc (Target_test): Update relocation_section
8982 function.
8983 * testsuite/Makefile.in: Rebuild.
8984
8985 2009-10-06 Ian Lance Taylor <iant@google.com>
8986
8987 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8988 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8989 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8990 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8991 the address on ldo_addrs_.
8992 (Target_i386::Relocate::fix_up_ldo): New function.
8993
8994 2009-10-06 Rafael Espindola <espindola@google.com>
8995
8996 * plugin.cc (add_input_library): New.
8997 (Plugin::load): Add add_input_library to tv.
8998 (Plugin_manager::add_input_file): Add the is_lib argument.
8999 (add_input_file): Update call to Plugin_manager::add_input_file.
9000 (add_input_library): New.
9001 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9002
9003 2009-09-30 Doug Kwan <dougkwan@google.com>
9004
9005 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9006 symbol and call Symbol::may_need_copy_reloc to determine if
9007 a copy reloc is needed.
9008 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9009 nocopyreloc is given in command line.
9010 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9011 given in command line.
9012 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9013 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9014 of the removed Target_i386::may_need_copy_reloc.
9015 * options.h (copyreloc): New option with default value false.
9016 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9017 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9018 instead of the removed Target_powerpc::may_need_copy_reloc.
9019 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9020 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9021 instead of the removed Target_sparc::may_need_copy_reloc.
9022 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9023 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9024 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9025 instead of the removed Target_x86_64::may_need_copy_reloc.
9026
9027 2009-09-30 Ian Lance Taylor <iant@google.com>
9028
9029 * object.h (class Object): Remove target_ field, and target,
9030 sized_target, and set_target methods.
9031 (Object::sized_target): Remove.
9032 (class Sized_relobj): Update declarations. Remove sized_target.
9033 * object.cc (Sized_relobj::setup): Remove target parameter.
9034 Change all callers.
9035 (Input_objects::add_object): Don't do anything with the target.
9036 (make_elf_sized_object): Add punconfigured parameter. Change all
9037 callers. Set or test parameter target.
9038 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9039 Change all callers.
9040 * parameters.cc (Parameters::set_target): Change parameter type to
9041 be non-const.
9042 (Parameters::default_target): Remove.
9043 (set_parameters_target): Change parameter type to be non-const.
9044 (parameters_force_valid_target): New function.
9045 (parameters_clear_target): New function.
9046 * parameters.h (class Parameters): Update declarations. Remove
9047 default_target method. Add sized_target and clear_target
9048 methods. Change target_ to be non-const.
9049 (set_parameters_target): Update declaration.
9050 (parameters_force_valid_target): Declare.
9051 (parameters_clear_target): Declare.
9052 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9053 as NULL if we aren't searching.
9054 (Add_symbols::run): Don't check for compatible target.
9055 * fileread.cc (Input_file::open_binary): Call
9056 parameters_force_valid_target.
9057 * gold.cc (queue_middle_tasks): Likewise.
9058 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9059 set_target on object.
9060 * dynobj.h (class Sized_dynobj): Update declarations.
9061 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9062 make_elf_object returns NULL.
9063 (Archive::include_member): Don't check whether object target is
9064 compatible.
9065 * output.cc (Output_section::add_input_section): Get target from
9066 parameters.
9067 (Output_section::relax_input_section): Likewise.
9068 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9069 parameters.
9070 (Sized_relobj::do_scan_relocs): Likewise.
9071 (Sized_relobj::relocate_sections): Likewise.
9072 * resolve.cc (Symbol_table::resolve): Likewise.
9073 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9074 parameter. Change all callers.
9075 (Symbol_table::add_from_object): Get target from parameters.
9076 (Symbol_table::add_from_relobj): Don't check object target.
9077 (Symbol_table::add_from_dynobj): Likewise.
9078 (Symbol_table::define_special_symbol): Get target from
9079 parameters.
9080 * symtab.h (class Symbol_table): Update declaration.
9081 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9082 parameter. Change all callers. Clear parameter target.
9083 (Binary_test): Test target here.
9084 * testsuite/object_unittest.cc (gold_testsuite): Remove
9085 target_test_pointer parameter. Change all callers.
9086 (Object_test): Test target here.
9087
9088 2009-09-26 Ian Lance Taylor <iant@google.com>
9089
9090 * testsuite/initpri1.c: Don't try to use constructor priorities if
9091 compiling with gcc before 4.3.
9092
9093 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9094
9095 * testsuite/retain_symbols_file_test.sh (check_present): Change
9096 output file name to retain_symbols_file_test.stdout.
9097 (check_absent): Likewise.
9098
9099 2009-09-18 Craig Silverstein <csilvers@google.com>
9100
9101 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9102 * options.cc: Include <cerrno> and <fstream>.
9103 (General_options::finalize): Parse -retain-symbols-file tag.
9104 * options.h: New flag.
9105 (General_options): New method should_retain_symbol, new
9106 variable symbols_to_retain.
9107 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9108 should_retain_symbol map.
9109 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9110 * testsuite/Makefile.in: Regenerate.
9111 * testsuite/retain_symbols_file_test.sh: New file.
9112
9113 2009-09-18 Nick Clifton <nickc@redhat.com>
9114
9115 * po/es.po: Updated Spanish translation.
9116
9117 2009-09-17 Doug Kwan <dougkwan@google.com>
9118
9119 * debug.h (DEBUG_RELAXATION): New constant.
9120 (DEBUG_ALL): Add DEBUG_RELAXATION.
9121 (debug_string_to_enum): Add relaxation debug option.
9122 * layout.cc
9123 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9124 Layout::Relaxation_debug_check::read_sections,
9125 Layout::Relaxation_debug_check::read_sections): New method definitions.
9126 (Layout::Layout): Initialize data members
9127 record_output_section_data_from_scrips_,
9128 script_output_section_data_list_ and relaxation_debug_check_.
9129 (Layout::save_segments, Layout::restore_segments,
9130 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9131 Layout::relaxation_loop_body): New method definitions.
9132 (Layout::finalize): Support relaxation. Move section layout code to
9133 Layout::relaxation_loop_body.
9134 (Layout::set_asection_address_from_script): Move code for orphan
9135 section placement out.
9136 (Layout::place_orphan_sections_in_script): New method definition.
9137 * layout.h (Output_segment_headers, Output_file_header):
9138 New forward class declarations.
9139 (Layout::~Layout): Define.
9140 (Layout::new_output_section_data_from_script): New method definition.
9141 (Layout::place_orphan_sections_in_script): New method declaration.
9142 (Layout::Segment_states): New type declaration.
9143 (Layout::save_segments, Layout::restore_segments,
9144 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9145 Layout::relaxation_loop_body): New method declarations.
9146 (Layout::Output_section_data_list): New type declaration.
9147 (Layout::Relaxation_debug_check): New class definition.
9148 (Layout::record_output_section_data_from_script_,
9149 Layout::script_output_section_data_list_, Layout::segment_states_,
9150 Layout::relaxation_debug_check_): New data members.
9151 * output.cc: (Output_section_headers::do_size): New method definition.
9152 (Output_section_headers::Output_section_headers): Move size
9153 computation to Output_section_headers::do_size.
9154 (Output_segment_headers::do_size): New method definition.
9155 (Output_file_header::Output_file_header): Move size computation to
9156 Output_file_header::do_size and call it.
9157 (Output_file_header::do_size): New method definition.
9158 (Output_data_group::Output_data_group): Adjust call to
9159 Output_section_data.
9160 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9161 (Output_symtab_xindex::do_write): Add array bound check.
9162 (Output_section::Input_section::print_to_mapfile): Handle
9163 RELAXED_INPUT_SECTION_CODE.
9164 (Output_section::Output_section): Initialize data member checkpoint_.
9165 (Output_section::~Output_section): Delete checkpoint object pointed
9166 by checkpoint_.
9167 (Output_section::add_input_section): Always add an Input_section if
9168 relaxing.
9169 (Output_section::add_merge_input_section): Add assert.
9170 (Output_section::relax_input_section): New method definition.
9171 (Output_section::set_final_data_size): Set load address to zero for
9172 an unallocated section.
9173 (Output_section::do_address_and_file_offset_have_reset_values):
9174 New method definition.
9175 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9176 Handle relaxed input section.
9177 (Output_section::sort_attached_input_sections): Checkpoint input
9178 section list lazily.
9179 (Output_section::get_input_sections): Change type of input_sections to
9180 list of Simple_input_section pointers. Checkpoint input section list
9181 lazily. Also handle relaxed input sections.
9182 (Output_section::add_input_section_for_script): Take a reference to
9183 a Simple_input_section object instead of Relobj pointer and section
9184 index as parameter. Handle relaxed input sections.
9185 (Output_section::save_states, Output_section::restore_states): New
9186 method definitions.
9187 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9188 (Output_data::is_data_size_fixed): New method definition.
9189 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9190 if it is fixed.
9191 (Output_data::address_and_file_offset_have_reset_values): New method
9192 definition.
9193 (Output_data::do_address_and_file_offset_have_reset_values): New method
9194 definition.
9195 (Output_data::set_data_size): Check that data size is not fixed.
9196 (Output_data::fix_data_size): New method definition.
9197 (Output_data::is_data_size_fixed_): New data member.
9198 (Output_section_headers::set_final_data_size): New method definition.
9199 (Output_section_headers::do_size): New method declaration.
9200 (Output_segment_headers::set_final_data_size): New method definition.
9201 (Output_segment_headers::do_size): New method declaration.
9202 (Output_file_header::set_final_data_size)::New method definition.
9203 (Output_file_header::do_size)::New method declaration.
9204 (Output_section_data::Output_section_data): Add new parameter
9205 is_data_size_fixed and use it to fix data size.
9206 (Output_data_const::Output_data_const): Adjust call to base class
9207 constructor and fix data size.
9208 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9209 base class constructor and fix data size.
9210 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9211 base class constructor and fix data size.
9212 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9213 class constructor and fix data size.
9214 (Output_data_group::set_final_data_size): New method definition.
9215 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9216 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9217 class constructor and fix data size.
9218 (Output_relaxed_input_section): New class definition.
9219 (Output_section::Simple_input_section): New class definition.
9220 (Output_section::get_input_sections): Adjust parameter list.
9221 (Output_section::add_input_section_for_script): Same.
9222 (Output_section::save_states, Output_section::restore_states,
9223 Output_section::do_address_and_file_offset_have_reset_values,
9224 (Output_section::Input_section::Input_section): Handle
9225 RELAXED_INPUT_SECTION_CODE. Add new overload for
9226 Output_relaxed_input_section.
9227 (Output_section::Input_section::is_input_section,
9228 Output_section::Input_section::set_output_section): Handle relaxed
9229 input section.
9230 (Output_section::Input_section::is_relaxed_input_section,
9231 Output_section::Input_section::output_section_data,
9232 Output_section::Input_section::relaxed_input_section): New method
9233 definitions.
9234 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9235 value.
9236 (Output_section::Input_section::u1_): Update comments.
9237 (Output_section::Input_section::u2_): Add new union member poris.
9238 (Output_section::Checkpoint_output_section): New classs definition.
9239 (Output_section::relax_input_section): New method declaration.
9240 (Output_section::checkpoint_): New data member.
9241 (Output_segment): Update comments.
9242 (Output_segment::Output_segment): Un-privatize copy constructor.
9243 (Output_segment::operator=): Un-privatize.
9244 * script-sections.cc (Output_section_element::Input_section_list):
9245 Change element type to Output_section::Simple_input_section.
9246 (Output_section_element_dot_assignment::set_section_addresses):
9247 Register output section data for relaxation clean up.
9248 (Output_data_exression::Output_data_expression): Adjust call to base
9249 constructor to fix data size.
9250 (Output_section_element_data::set_section_addresses): Register
9251 Output_data_expression object for relaxation clean up.
9252 (struct Input_section_info): Replace Relobj pointer and section index
9253 pair with Output_section::Simple_input_section and Convert struct to a
9254 class.
9255 (Input_section_sorter::operator()): Adjust access to
9256 Input_section_info data member to use accessors.
9257 (Output_section_element_input::set_section_addresses): Use layout
9258 parameter. Adjust code to use Output_section::Simple_input_section
9259 and Input_secction_info classes. Register filler for relaxation
9260 clean up.
9261 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9262 and section index pair with Output_section::Simple_input_section
9263 class. Adjust code accordingly.
9264 (Phdrs_element::release_segment): New method definition.
9265 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9266 segment list.
9267 (Script_sections::release_segments): New method definition.
9268 * gold/script-sections.h (Script_sections::release_segments): New
9269 method declaration.
9270 * gold/target.h (Target::may_relax, Target::relax,
9271 Target::do_may_relax, Target::do_relax): New method definitions.
9272
9273 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9274
9275 * arm.cc (has_signed_unsigned_overflow): New function.
9276 (Arm_relocate_functions::abs8): New function.
9277 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9278 (Target_arm::Scan::global): Likewise.
9279 (Target_arm::relocate::relocate): Likewise.
9280 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9281 Likewise.
9282
9283 2009-09-16 Cary Coutant <ccoutant@google.com>
9284
9285 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9286 * testsuite/Makefile.in: Regenerate.
9287
9288 2009-09-11 Nick Clifton <nickc@redhat.com>
9289
9290 * po/gold.pot: Updated by the Translation project.
9291
9292 2009-09-08 Cary Coutant <ccoutant@google.com>
9293
9294 * output.cc (Output_file::open): Add execute permission to empty file.
9295 * testsuite/Makefile.am (permission_test): New test.
9296 * testsuite/Makefile.in: Regenerate.
9297
9298 2009-09-02 Ian Lance Taylor <iant@google.com>
9299
9300 * output.cc (Output_file::resize): Call map_no_anonymous rather
9301 than map.
9302
9303 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9304
9305 * gold.cc: Include "incremental.h".
9306 (queue_initial_tasks): Call Incremental_checker methods.
9307 * incremental.cc: Include "output.h".
9308 (Incremental_checker::can_incrementally_link_output_file): New
9309 method.
9310 * incremental.h (Incremental_checker): New class.
9311
9312 * output.cc (Output_file::open_for_modification): New method.
9313 (Output_file::map_anonymous): Changed return type to bool. Record
9314 map in base_ field.
9315 (Output_file::map_no_anonymous): New method, broken out of map.
9316 (Output_file::map): Use map_no_anonymous and map_anonymous.
9317 * output.h (class Output_file): Update declarations.
9318
9319 2009-08-24 Cary Coutant <ccoutant@google.com>
9320
9321 * options.h (Command_line::Pre_options): New class.
9322 (Command_line::pre_options): New member.
9323 * options.cc (gold::options::ready_to_register): New variable.
9324 (One_option::register_option): Do nothing if not registering options.
9325 Assert if same short option registered twice.
9326 (General_options::General_options): Turn off option registration when
9327 done constructing.
9328 (Command_line::Pre_options::Pre_options): New constructor.
9329
9330 2009-08-24 Cary Coutant <ccoutant@google.com>
9331
9332 * options.h (General_options::no_keep_memory): Remove incorrect
9333 short option.
9334
9335 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9336
9337 * Makefile.am (am__skiplex, am__skipyacc): New.
9338 * Makefile.in: Regenerate.
9339
9340 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9341
9342 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9343 (INCLUDES): ... this.
9344 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9345 (AM_CPPFLAGS): Renamed from ...
9346 (INCLUDE): ... this.
9347 * Makefile.in, testsuite/Makefile.in: Regenerate.
9348
9349 * Makefile.in: Regenerate.
9350 * aclocal.m4: Likewise.
9351 * config.in: Likewise.
9352 * configure: Likewise.
9353 * testsuite/Makefile.in: Likewise.
9354
9355 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9356 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9357 * Makefile.in: Regenerate.
9358 * testsuite/Makefile.in: Regenerate.
9359
9360 2009-08-19 Cary Coutant <ccoutant@google.com>
9361
9362 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9363 symbols in shared libraries overridden by hidden or internal symbols
9364 in the main program.
9365
9366 2009-08-19 Chris Demetriou <cgd@google.com>
9367
9368 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9369 checking source file names in error messages.
9370
9371 2009-08-18 Doug Kwan <dougkwan@google.com>
9372
9373 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9374 an elcpp::Ehdr as parameter. Adjust call to set_target.
9375 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9376 an elfcpp::Ehdr as parameter.
9377 * object.cc (Object::set_target): Remove the version that looks up
9378 a target and sets it.
9379 (Sized_relobj::setup): Take a Target object instead of
9380 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9381 (make_elf_sized_object): Find target and ask target to
9382 make an ELF object.
9383 * object.h: (Object::set_target): Remove the version that looks up
9384 a target and sets it.
9385 (Sized_relobj::setup): Take a Target object instead of
9386 an elfcpp:Ehdr as parameter.
9387 * target.cc: Include dynobj.h.
9388 (Target::do_make_elf_object_implementation): New.
9389 (Target::do_make_elf_object): New.
9390 * target.h (Target::make_elf_object): New template declaration.
9391 (Target::do_make_elf_object): New method declarations.
9392 (Target::do_make_elf_object_implementation): New template declaration.
9393
9394 2009-08-14 Ian Lance Taylor <iant@google.com>
9395
9396 * gold.h (FUNCTION_NAME): Define.
9397 (gold_unreachable): Use FUNCTION_NAME.
9398
9399 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9400
9401 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9402 symbol in the --keep-unique list is not found.
9403
9404 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9405
9406 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9407 been maked as --keep-unique.
9408 (Icf::unfold_section): New function.
9409 * icf.h (Icf::unfold_section): New function.
9410 * options.h (General_options::keep_unique): New option.
9411 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9412 * testsuite/Makefile.in: Regenerate.
9413 * testsuite/icf_keep_unique_test.sh: New file.
9414 * testsuite/icf_keep_unique_test.cc: New file.
9415
9416 2009-08-12 Cary Coutant <ccoutant@google.com>
9417
9418 PR 10471
9419 * resolve.cc (Symbol_table::resolve): Check for references from
9420 dynamic objects to hidden and internal symbols.
9421 * testsuite/Makefile.am (hidden_test.sh): New test.
9422 * testsuite/Makefile.in: Regenerate.
9423 * testsuite/hidden_test.sh: New script.
9424 * testsuite/hidden_test_1.c: New test source.
9425 * testsuite/hidden_test_main.c: New test source.
9426
9427 2009-08-11 Doug Kwan <dougkwan@google.com>
9428
9429 * arm.cc: Update comments.
9430 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9431 segment to locate the .ARM.exidx section if present.
9432
9433 2009-08-09 Doug Kwan <dougkwan@google.com>
9434
9435 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9436 patch.
9437
9438 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9439 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9440 compiler warnings.
9441
9442 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9443
9444 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9445 valid tls_segment only for non-debug-section relocations.
9446 * testsuite/Makefile.am: Add gc_tls_test.
9447 * testsuite/Makefile.in: Regenerate.
9448 * testsuite/gc_tls_test.cc: New file.
9449 * testsuite/gc_tls_test.sh: New file.
9450
9451 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9452
9453 * icf.cc: New file.
9454 * icf.h: New file.
9455 * Makefile.am (CCFILES): Add icf.cc.
9456 (HFILES): Add icf.h
9457 * Makefile.in: Regenerate.
9458 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9459 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9460 section, symbol and addend information for the relocs.
9461 * gold.cc (queue_middle_tasks): Call identical code folding.
9462 * gold.h: Add defines for multimap.
9463 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9464 to the call of finalize_local_symbols.
9465 * main.cc (main): Create object of class Icf.
9466 * object.cc (Sized_relobj::do_layout): Allow this function to be
9467 called twice during icf.
9468 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9469 to sections marked as identical by icf.
9470 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9471 when available.
9472 (Sized_relobj::do_section_entsize): New function.
9473 * object.h (Object::section_entsize): New function.
9474 (Object::do_section_entsize): New pure virtual function.
9475 (Relobj::finalize_local_symbols): Add new parameter.
9476 (Relobj::do_section_entsize): New function.
9477 * options.h (General_options::icf): New option.
9478 (General_options::icf_iterations): New option.
9479 (General_options::print_icf_sections): New option.
9480 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9481 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9482 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9483 icf.
9484 * symtab.cc (Symbol_table::is_section_folded): New function.
9485 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9486 to sections marked as identical by icf.
9487 * symtab.h (Symbol_table::set_icf): New function.
9488 (Symbol_table::icf): New function.
9489 (Symbol_table::is_section_folded): New function.
9490 (Symbol_table::icf_): New data member.
9491 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9492 * testsuite/Makefile.am: Add commands to build icf_test.
9493 * testsuite/Makefile.in: Regenerate.
9494 * testsuite/icf_test.sh: New file.
9495 * testsuite/icf_test.cc: New file.
9496
9497 2009-07-24 Chris Demetriou <cgd@google.com>
9498
9499 * layout.cc (is_compressible_debug_section): Fix incorrect
9500 comment about compressed section names.
9501
9502 2009-07-20 Ian Lance Taylor <ian@airs.com>
9503
9504 PR 10419
9505 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9506
9507 2009-07-16 Ian Lance Taylor <iant@google.com>
9508
9509 PR 10400
9510 * layout.h: #include <map>.
9511 (class Kept_section): Change from struct to class. Add accessors
9512 and setters. Add section size to Comdat_group mapping. Change
9513 Comdat_group to std::map. Add is_comdat_ field. Add
9514 linkonce_size field in union.
9515 (class Layout): Update declaration of find_or_add_kept_section.
9516 Don't declare find_kept_object.
9517 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9518 parameter. Add object, shndx, is_comdat, and is_group_name
9519 parameters. Change all callers. Adjust for new Kept_section.
9520 (Layout::find_kept_object): Remove.
9521 * object.cc (Sized_relobj::include_section_group): Update use of
9522 Kept_section. Rename secnum to shndx. Only record
9523 Kept_comdat_section if sections are the same size.
9524 (Sized_relobj::include_linkonce_section): Update use of
9525 Kept_section. Only record Kept_comdat_section if sections are the
9526 same size. Set size of linkonce section.
9527 (Sized_relobj::map_to_kept_section): Update call to
9528 get_kept_comdat_section.
9529 * object.h (class Sized_relobj): Rename fields in
9530 Kept_comdat_section to drop trailing underscores; change object
9531 field to Relobj*. Change Kept_comdat_section_table to store
9532 struct rather than pointer.
9533 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9534 Add kept_object and kept_shndx parameters. Change all callers.
9535 (Sized_relobj::get_kept_comdat_section): Change return type to
9536 bool. Add kept_object and kept_shndx parameters. Change all
9537 callers.
9538 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9539 Layout::find_or_add_kept_section.
9540
9541 2009-07-09 Ian Lance Taylor <iant@google.com>
9542
9543 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9544 Reserve space in the hash table.
9545
9546 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9547
9548 * fileread.cc (File_read::get_mtime): New method.
9549 * fileread.h (Timespec): New structure.
9550 (File_read::get_mtime): New method.
9551 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9552 Renamed from timestamp_nsec.
9553 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9554 Elf_Xword.
9555 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9556 timestamp_nsec.
9557 (Incremental_inputs::report_archive): Save mtime; style fix.
9558 (Incremental_inputs::report_obejct): Save mtime; style fix.
9559 (Incremental_inputs::report_script): Save mtime; style fix.
9560 (Incremental_inputs::finalize_inputs): Style fix.
9561 (Incremental_inputs::finalize): Style fix.
9562 (Incremental_inputs::create_input_section_data): Store inputs
9563 mtime.
9564 * incremental.h (Incremental_inputs::report_script): Add mtime
9565 argument.
9566 (Incremental_inputs::Input_info::Input_info): Intialize only one
9567 union member.
9568 (Incremental_inputs::Input_info::archive): Move to nameless
9569 union.
9570 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9571 (Incremental_inputs::Input_info::script): Move to nameless union.
9572 (Incremental_inputs::mtime): New field.
9573 * script.cc (read_input_script): Pass file mtime to
9574 Incremental_input.
9575 * script.h (Script_info::inputs): Style fix.
9576
9577 2009-07-01 Ian Lance Taylor <ian@airs.com>
9578
9579 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9580 instead of 32.
9581
9582 2009-06-24 Ian Lance Taylor <iant@google.com>
9583
9584 PR 10156
9585 * layout.cc (Layout::choose_output_section): If we find an
9586 existing section, update the flags.
9587 (Layout::create_notes): New function, broken out of
9588 Layout::finalize.
9589 (Layout::finalize): Don't create note sections.
9590 (Layout::create_note): Don't crash if linker script discards
9591 section.
9592 (Layout::create_gold_note): Likewise.
9593 (Layout::create_build_id): Likewise. Don't set
9594 after_input_sections on the section.
9595 (Layout::create_executable_stack_info): Remove target parameter.
9596 Change caller.
9597 * layout.h (class Layout): Declare create_notes. Update
9598 declaration of create_executable_stack_info.
9599 * gold.cc (queue_middle_tasks): Call create_notes.
9600 * output.cc (Output_section::update_flags_for_input_section): Move
9601 here from output.h. If SHF_ALLOC flag is newly set, mark address
9602 invalid.
9603 * output.h (Output_data::mark_address_invalid): New function.
9604 (class Output_section): Only declare, not define,
9605 update_flags_for_input_section. Remove set_flags.
9606
9607 2009-06-24 Ian Lance Taylor <iant@google.com>
9608
9609 * script-sections.cc (Output_section_definition::
9610 set_section_addresses): Rename shadowing local load_address to
9611 laddr.
9612
9613 2009-06-24 Ian Lance Taylor <iant@google.com>
9614
9615 PR 10244
9616 * reloc.cc (relocate_sections): Skip empty relocation sections.
9617
9618 2009-06-23 Ian Lance Taylor <iant@google.com>
9619
9620 PR 10156
9621 * layout.cc (Layout::create_note): Use choose_output_section
9622 rather than make_output_section.
9623
9624 2009-06-23 Ian Lance Taylor <iant@google.com>
9625
9626 PR 10237
9627 * options.cc (General_options::parse_V): Set printed_version_.
9628 (General_options::General_options): Initialize printed_version_.
9629 * options.h (class General_options): Add printed_version_ field.
9630 * gold.cc (queue_initial_tasks): If there are no input files,
9631 don't give a fatal error if we printed the version information.
9632 (queue_middle_tasks): If using -r with a shared object, give a
9633 fatal error rather than an ordinary error.
9634
9635 2009-06-23 Ian Lance Taylor <iant@google.com>
9636
9637 PR 10219
9638 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9639 (Layout::make_output_section): Set have_stabstr_section_ if we see
9640 a .stab*str section.
9641 (Layout::finalize): Call link_stabs_sections.
9642 (Layout::link_stabs_sections): New file.
9643 * layout.h (class Layout): Add have_stabstr_section_ field.
9644 Declare link_stabs_sections.
9645
9646 2009-06-23 Doug Kwan <dougkwan@google.com>
9647
9648 * Makefile.am (libgold_a_LIBADD): New.
9649 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9650 * Makefile.in: Regenerate.
9651 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9652 * configure: Regenerate.
9653 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9654 * fileread.cc: Include sys/state.h
9655 * gold.h: Declare memmem and strndup if found missing.
9656 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9657
9658 2009-06-23 Ian Lance Taylor <iant@google.com>
9659
9660 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9661 * configure: Rebuild.
9662
9663 2009-06-23 Ian Lance Taylor <iant@google.com>
9664
9665 PR 10147
9666 * object.cc (Object::section_contents): Don't try to get a view if
9667 the section has length zero.
9668 (Object::handle_gnu_warning_section): If the section is empty, use
9669 the name of the section as the warning.
9670
9671 2009-06-23 Ian Lance Taylor <iant@google.com>
9672
9673 PR 10133
9674 * stringpool.h (class Stringpool_template): Add optimize_ field.
9675 (Stringpool_template::set_optimize): New function.
9676 * stringpool.cc (Stringpool_template::Stringpool_template):
9677 Initialize optimize_ field.
9678 (Stringpool_template::set_string_offsets): Test local optimize
9679 fild rather than parameter.
9680 * layout.cc (Layout::Layout): Call set_optimize on the section
9681 name stringpool.
9682
9683 2009-06-22 Ian Lance Taylor <iant@google.com>
9684
9685 PR 10030
9686 * yyscript.y: Parse TARGET.
9687 * script.cc (script_set_target): New function.
9688 * script-c.h (script_set_target): Declare.
9689 * options.cc (General_options::string_to_object_format): Rename
9690 from string_to_object_format in anonymous namespace. Change
9691 callers.
9692 * options.h (class General_options): Declare
9693 string_to_object_format.
9694
9695 2009-06-22 Ian Lance Taylor <iant@google.com>
9696
9697 * script-sections.cc (Script_sections::create_segments): Don't put
9698 program headers in a PT_LOAD segment if -n or -N.
9699
9700 2009-06-22 Ian Lance Taylor <iant@google.com>
9701
9702 PR 10141
9703 * options.h (class General_options): Add -z lazy and -z now. Sort
9704 -z options into alphabetical order.
9705 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9706
9707 2009-06-21 Ian Lance Taylor <iant@google.com>
9708
9709 * layout.cc (Layout::make_output_section): Call
9710 Target::new_output_section.
9711 (Layout::attach_allocated_section_to_segment): Put large section
9712 sections in a separate load segment with the large segment flag
9713 set.
9714 (Layout::segment_precedes): Sort large data segments after other
9715 load segments.
9716 (align_file_offset): New static function.
9717 (Layout::set_segment_offsets): Use align_file_offset.
9718 * output.h (class Output_section): Add is_small_section_ and
9719 is_large_section_ fields.
9720 (Output_section::is_small_section): New function.
9721 (Output_section::set_is_small_section): New function.
9722 (Output_section::is_large_section): New function.
9723 (Output_section::set_is_large_section): New function.
9724 (Output_section::is_large_data_section): New function.
9725 (class Output_segment): Add is_large_data_segment_ field.
9726 (Output_segment::is_large_data_segment): New function.
9727 (Output_segment::set_is_large_data_segment): New function.
9728 * output.cc (Output_section::Output_section): Initialize new
9729 fields.
9730 (Output_segment::Output_segment): Likewise.
9731 (Output_segment::add_output_section): Add assertion that large
9732 data sections always go in large data segments. Force small data
9733 sections to the end of the list of data sections. Force small BSS
9734 sections to the start of the list of BSS sections. For large BSS
9735 sections to the end of the list of BSS sections.
9736 * symtab.h (class Symbol): Declare is_common_shndx.
9737 (Symbol::is_defined): Check Symbol::is_common_shndx.
9738 (Symbol::is_common): Likewise.
9739 (class Symbol_table): Define enum Commons_section_type. Update
9740 declarations. Add small_commons_ and large_commons_ fields.
9741 * symtab.cc (Symbol::is_common_shndx): New function.
9742 (Symbol_table::Symbol_table): Initialize new fields.
9743 (Symbol_table::add_from_object): Put small and large common
9744 symbols in the right list.
9745 (Symbol_table::sized_finalized_symbol): Check
9746 Symbol::is_common_shndx.
9747 (Symbol_table::sized_write_globals): Likewise.
9748 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9749 common symbol lists. Don't call do_allocate_commons_list if the
9750 list is empty.
9751 (Symbol_table::do_allocate_commons_list): Remove is_tls
9752 parameter. Add comons_section_type parameter. Change all
9753 callers. Handle small and large common symbols.
9754 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9755 Symbol::is_common_shndx.
9756 * resolve.cc (symbol_to_bits): Likewise.
9757 * target.h (Target::small_common_shndx): New function.
9758 (Target::small_common_section_flags): New function.
9759 (Target::large_common_shndx): New function.
9760 (Target::large_common_section_flags): New function.
9761 (Target::new_output_section): New function.
9762 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9763 small_common_section_flags, and large_common_section_flags
9764 fields.
9765 (Target::do_new_output_section): New virtual function.
9766 * arm.cc (Target_arm::arm_info): Initialize new fields.
9767 * i386.cc (Target_i386::i386_info): Likewise.
9768 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9769 Likewise.
9770 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9771 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9772 (Target_x86_64::do_new_output_section): New function.
9773 * configure.ac: Define conditional MCMODEL_MEDIUM.
9774 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9775 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9776 (large_LDFLAGS): Define.
9777 * testsuite/large.c: New file.
9778 * testsuite/testfile.cc (Target_test::test_target_info):
9779 Initialize new fields.
9780 * configure, testsuite/Makefile.in: Rebuild.
9781
9782 2009-06-05 Doug Kwan <dougkwan@google.com>
9783
9784 * Makefile.am (CCFILES): Add target.cc.
9785 * Makefile.in: Regenerate.
9786 * i386.cc (class Target_i386): Define new virtual method to
9787 override do_is_local_label_name in parent.
9788 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9789 local symbols if --discard-locals or -X is given.
9790 * options.h (class General_options): Declare new options
9791 '--discard-locals' and '-X' for discarding locals.
9792 * target.h (class Target): Define new methods is_local_label_name.
9793 Declare new virtual method do_is_local_label_name.
9794 * target.cc: New file.
9795 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9796 (check_SCRIPTS): Add discard_locals_test.sh.
9797 (check_DATA): Add discard_local_tests.syms.
9798 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9799 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9800 * testsuite/Makefile.in: Regenerate.
9801 * testsuite/discard_locals_test.c: New file.
9802 * testsuite/discard_locals_test.sh: Same.
9803
9804 2009-06-05 Doug Kwan <dougkwan@google.com>
9805
9806 * object.cc (Sized_relobj::Sized_relobj): Initialize
9807 discarded_eh_frame_shndx_ to -1U.
9808 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9809 section.
9810 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9811 a discarded .eh_frame section.
9812 (Sized_relobj::do_finalize_local_symbols): Ditto.
9813 * object.h (class Sized_relobj): Declare new member
9814 discarded_eh_frame_shndx_.
9815 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9816 (local_labels_test.o, local_labels_test): New rules.
9817 * testsuite/Makefile.in: Regenerate.
9818
9819 2009-06-04 Doug Kwan <dougkwan@google.com>
9820
9821 * layout.cc (Layout::section_name_mapping): Add mapping for
9822 special ARM sections.
9823
9824 2009-06-03 Doug Kwan <dougkwan@google.com>
9825
9826 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9827 (utils::has_overflow): Same.
9828
9829 2009-06-03 Ian Lance Taylor <iant@google.com>
9830
9831 * layout.cc (Layout::section_name_mapping): New array, replacing
9832 Layout::linkonce_mapping.
9833 (Layout::section_name_mapping_count): New variable, replacing
9834 Layout::linkonce_mapping_count.
9835 (Layout::linkonce_output_name): Remove.
9836 (Layout::output_section_name): Rewrite.
9837 * layout.h (class Layout): Rename Linkonce_mapping to
9838 Section_name_mapping, linkonce_mapping to section_name_mapping,
9839 linkonce_mapping_count to section_name_mapping_count. Don't
9840 declare linkonce_output_name.
9841
9842 2009-06-03 Doug Kwan <dougkwan@google.com>
9843
9844 * gold/arm.cc (namespace utils): New.
9845 (Target_arm::reloc_is_non_pic): Define new method.
9846 (class Arm_relocate_functions): New.
9847 (Target_arm::Relocate::relocate): Handle relocation types used by
9848 Android.
9849
9850 2009-06-03 Ian Lance Taylor <iant@google.com>
9851
9852 * arm.cc (Target_arm::scan::global): Use || instead of |.
9853
9854 2009-06-02 Doug Kwan <dougkwan@google.com>
9855
9856 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9857 issued_non_pic_error_.
9858 (class Target_arm::Scan): Declare new method check_non_pic.
9859 Define new method symbol_needs_plt_entry.
9860 Declare new data member issued_non_pic_error_.
9861 (class Target_arm::Relocate): Declare new method
9862 should_apply_static_reloc.
9863 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9864 (Target_arm::Scan::check_non_pic): Define new method.
9865 (Target_arm::Scan::local): Handle a small subset of reloc types used
9866 by Android.
9867 (Target_arm::Scan::local): Same.
9868 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9869
9870 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9871
9872 * incremental.cc (Incremental_inputs::report_command_line): Filter
9873 out --incremental-* options.
9874
9875 2009-05-29 Doug Kwan <dougkwan@google.com>
9876
9877 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9878 template class.
9879 (class Target_arm): Update comment.
9880 (Target_arm::Target_arm): Initialize new data members GOT_,
9881 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9882 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9883 and Target_arm::rel_dyn_section.
9884 Declare new_enum Target_arm::Got_type.
9885 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9886 and DYNBSS_.
9887 Update commments for member do_dynsym_value.
9888 (Target_arm::got_size, Target_arm::plt_section,
9889 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9890 new methods inside class defintion.
9891 (Target_arm::got_section): Define new method.
9892 (Target_arm::rel_dyn_section): Same.
9893 (Output_data_plt_arm): New template class.
9894 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9895 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9896 (Output_data_plt_arm::add_entry): Same.
9897 (Output_data_plt_arm::first_plt_entry): Define new
9898 static data member for PLT instruction template.
9899 (Output_data_plt_arm::plt_entry): Same.
9900 (Output_data_plt_arm::do_write): Define new method.
9901 (Target_arm::make_plt_entry): Same.
9902 (Target_arm::do_finalize_sections): Same.
9903 (Target_arm::do_dynsym_value): Same.
9904
9905 2009-05-28 Doug Kwan <dougkwan@google.com>
9906
9907 * Makefile.am (TARGETSOURCES): Add arm.cc.
9908 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9909 * Makefile.in: Regenerate.
9910 * arm.cc: New file.
9911 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9912
9913 2009-05-26 Doug Kwan <dougkwan@google.com>
9914
9915 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9916 (General_options::check_excluded_libs): Strip off directories in
9917 archive name before matching like GNU ld does.
9918 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9919 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9920 (exclude_libs_test_LDFLAGS): Add linker option
9921 -Wl,--exclude-libs,libexclude_libs_test_3
9922 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9923 an explicit archive without using -l.
9924 (alt/libexclude_libs_test_3.a): New make rule.
9925 * testsuite/Makefile.in: Regenerate.
9926 * testsuite/exclude_libs_test.c : Declare lib3_default().
9927 (main): Call it.
9928 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9929 * exclude_libs_test_3.c: New file.
9930
9931 2009-05-26 Nick Clifton <nickc@redhat.com>
9932
9933 * po/id.po: New Indonesian translation.
9934 * po/gold.pot: Updated template file.
9935
9936 2009-05-22 Sriraman Tallam <tmsriram@google.com>
9937
9938 * testsuite/Makefile.am: Add -ffunction-sections to compile
9939 gc_comdat_test files. Add -Wl,--gc-sections to build
9940 gc_comdat_test.
9941 * testsuite/Makefile.in: Regenerate.
9942 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9943
9944 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9945
9946 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9947 kept comdat section was garbage collected.
9948 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9949 * testsuite/Makefile.in: Regenerate.
9950 * testsuite/gc_comdat_test.sh: New file.
9951 * testsuite/gc_comdat_test_1.cc: New file.
9952 * testsuite/gc_comdat_test_2.cc: New file.
9953
9954 2009-05-19 Doug Kwan <dougkwan@google.com>
9955
9956 * archive.cc (Archive::Archive): Move constructor from archive.h
9957 to here. Initialize no_export_.
9958 (Archive::get_elf_object_for_member): Set no_export flag of object.
9959 * archive.h (Archive::Archive): Move constructor body to
9960 archive.cc.
9961 (Archive::no_export): New method.
9962 (Archive::no_export_): New field.
9963 * object.h (Object::Object): Initialize no_export_ to false.
9964 (Object::no_export, Object::set_no_export): New methods.
9965 (Object::no_export_): New field.
9966 * options.cc (General_options::parse_exclude_libs): New method.
9967 (General_options::check_excluded_libs) Same.
9968 * options.h (exclude_libs): New option.
9969 (General_options::check_excluded_libs): New method declaration.
9970 (General_options::excluded_libs_): New field.
9971 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9972 default or protected visibility if an object has no-export flag set.
9973 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9974 (check_SCRIPTS): Add exclude_libs_test.sh.
9975 (check_DATA): Add exclude_libs_test.syms.
9976 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9977 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9978 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9979 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9980 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9981 libexclude_libs_test_2.a): New rules.
9982 * testsuite/Makefile.in: Regenerate.
9983 * testsuite/exclude_libs_test.c: New file.
9984 * testsuite/exclude_libs_test.sh: Ditto.
9985 * testsuite/exclude_libs_test_1.c: Ditto.
9986 * testsuite/exclude_libs_test_2.c: Ditto.
9987
9988 2009-05-15 Ian Lance Taylor <iant@google.com>
9989
9990 * configure.ac: Check for declarations for cases where libiberty.h
9991 checks HAVE_DECL_xxx.
9992 * configure, config.in: Rebuild.
9993
9994 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9995
9996 * gold.h (Incremental_argument_list): Remove (invalid) forward
9997 declaration.
9998 * incremental.cc (Incremental_inputs::report_achive): New method.
9999 (Incremental_inputs::report_object): New method.
10000 (Incremental_inputs::report_script): New method.
10001 (Incremental_inputs::finalize_inputs): New method.
10002 (Incremental_inputs::finalize): Call finalize_inputs().
10003 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10004 Create inputs entries.
10005 * incremental.h (Incremental_input_type): New enum.
10006 (Incremental_inputs::Incremental_input): Initialize new fields.
10007 (Incremental_inputs::report_inputs): New method.
10008 (Incremental_inputs::report_achive): New method.
10009 (Incremental_inputs::report_object): New method.
10010 (Incremental_inputs::report_script): New method.
10011 (Incremental_inputs::finalize_inputs): New method.
10012 (Incremental_inputs::Input_info): New struct.
10013 (Incremental_inputs::Input_info_map): New typedef.
10014 (Incremental_inputs::lock_): New field.
10015 (Incremental_inputs::Inputs_): New field.
10016 (Incremental_inputs::Inputs_map): New field.
10017 * main.cc (main): Call Incremental_input::report_inputs.
10018 * options.h (Input_argument_list): Typedef moved from
10019 Input_arguments.
10020 (Input_file_group::Files): Remove, use ::Input_argument_list.
10021 (Input_file_group::Input_argument_list): Remove, use
10022 ::Input_argument_list.
10023 * plugin.cc (Plugin_manager::add_input_file): Add error in
10024 incremental build.
10025 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10026 functions.
10027 * script.cc (read_input_script): Call
10028 Incremental_input::report_script.
10029 * script.h (Script_info): New class.
10030
10031 2009-04-27 Ian Lance Taylor <iant@google.com>
10032
10033 * x86_64.cc (do_adjust_output_section): Set entsize to
10034 plt_entry_size.
10035
10036 2009-04-23 Elliott Hughes <enh@google.com>
10037
10038 * output.cc (Output_file::close): After short writes, continue
10039 writing from the correct offset in the buffer being written.
10040
10041 2009-04-23 Chris Demetriou <cgd@google.com>
10042
10043 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10044 * configure: Regenerate.
10045 * config.in: Regenerate.
10046 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10047 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10048
10049 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10050
10051 * incremental.cc (Incremental_inputs_header_data): Renamed from
10052 Incremental_input_header_data.
10053 (Incremental_inputs_header_data::data_size): New field.
10054 (Incremental_inputs_header_data::put_input_file_count): Renamed
10055 from input_file_count.
10056 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10057 from command_line_offset.
10058 (Incremental_inputs_header_data::put_reserved): Renamed from
10059 put_reserved.
10060 (Incremental_inputs_entry_data): Renamed from
10061 Incremental_input_entry_data.
10062 (Incremental_inputs_entry_data::data_size): New field.
10063 (Incremental_inputs::report_command_line): New method.
10064 (Incremental_inputs::finalize): New method.
10065 (Incremental_inputs::create_incremental_inputs_data): New method.
10066 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10067 * incremental.h: New file.
10068 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10069 (Layout::finalize): Create incremental inputs section in
10070 incremental builds.
10071 (Layout::create_incremental_info_sections): New method.
10072 * layout.h (Layout::incremental_inputs): New method.
10073 (Layout::create_incremental_info_sections): New method.
10074 (Layout::incremental_inputs_): New field.
10075 * main.cc (main): Notify Incremental_input of the command line.
10076
10077 2009-04-01 Ian Lance Taylor <iant@google.com>
10078 Mikolaj Zalewski <mikolajz@google.com>
10079
10080 * gold.h (reserve_unordered_map): Define, three versions, one for
10081 each version of Unordered_map.
10082 * layout.cc (Layout::Layout): Remove options parameter. Add
10083 number_of_input_files parameter. Don't initialize options_.
10084 Initialize number_of_input_files_ and resized_signatures_. Move
10085 sections_are_attached_.
10086 (Layout::layout_group): Reserve space for group_signatures_.
10087 (Layout::find_or_add_kept_section): Change name parameter to be a
10088 reference. Resize signatures_ map when it gets large enough.
10089 (Layout::layout_eh_frame): Use parameters->options() instead of
10090 this->options_.
10091 (Layout::make_output_section): Likewise.
10092 (Layout::attach_allocated_section_to_segment): Likewise.
10093 (Layout::finalize, Layout::create_executable_stack): Likewise.
10094 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10095 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10096 * layout.h (class Layout): Update declarations. Remove options_
10097 field. Add number_of_input_files_ and resized_signatures_
10098 fields. Move sections_are_attached_ field.
10099 * main.cc (main): Pass number of input files to Layout
10100 constructor. Don't pass options.
10101
10102 2009-03-30 Ian Lance Taylor <iant@google.com>
10103
10104 * ffsll.c (ffsll): Correct implementation.
10105
10106 2009-03-27 Ian Lance Taylor <iant@google.com>
10107
10108 * ffsll.c: New file.
10109 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10110 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10111 * ftruncate.c (ftruncate): Declare before definition.
10112 * mremap.c (mremap): Likewise.
10113 * pread.c (pread): Likewise.
10114 * configure, Makefile.in, config.in: Rebuild.
10115
10116 * mremap.c: New file.
10117 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10118 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10119 (mremap): Declare if HAVE_MREMAP is not defined.
10120 * configure, Makefile.in, config.in: Rebuild.
10121
10122 2009-03-27 Cary Coutant <ccoutant@google.com>
10123
10124 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10125 position independent.
10126 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10127 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10128
10129 2009-03-24 Cary Coutant <ccoutant@google.com>
10130
10131 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10132 an executable.
10133 (needs_dynamic_reloc): Likewise.
10134
10135 2009-03-24 Ian Lance Taylor <iant@google.com>
10136
10137 * yyscript.y (file_cmd): Recognize EXTERN.
10138 (extern_name_list, extern_name_list_body): New nonterminals.
10139 * script.cc (script_add_extern): Define.
10140 * script-c.h (script_add_extern): Declare.
10141
10142 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10143
10144 * object.cc (is_elf_object): Define.
10145 * object.h (is_elf_object): Declare.
10146 * archive.cc (Archive::get_elf_object_for_member): Call
10147 is_elf_object.
10148 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10149
10150 2009-03-24 Elliott Hughes <enh@google.com>
10151
10152 * output.cc (Output_file::map_anonymous): Define.
10153 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10154 try an anonymous one. Report the size if the mmap fails.
10155 * output.h (class Output_file): Declare map_anonymous.
10156
10157 2009-03-24 Ian Lance Taylor <iant@google.com>
10158
10159 * target-select.cc (instantiate_target): Don't acquire the lock if
10160 the instantiated_target_ field has already been set.
10161
10162 2009-03-23 Ian Lance Taylor <iant@google.com>
10163
10164 * gold-threads.h (class Initialize_lock): Define.
10165 * gold-threads.cc (class Initialize_lock_once): Define.
10166 (initialize_lock_control): New static variable.
10167 (initialize_lock_pointer): New static variable.
10168 (initialize_lock_once): New static function.
10169 (Initialize_lock::Initialize_lock): Define.
10170 (Initialize_lock::initialize): Define.
10171 * target-select.h: Include "gold-threads.h".
10172 (class Target_selector): Add lock_ and initialize_lock_ fields.
10173 Don't define instantiate_target, just declare it.
10174 * target-select.cc (Target_selector::Target_selector): Initialize
10175 new fields.
10176 (Target_selector::instantiate_target): Define.
10177 * descriptors.h: Include "gold-threads.h".
10178 (class Descriptors): Add initialize_lock_ field.
10179 * descriptors.cc (Descriptors::Descriptors): Initialize new
10180 field.
10181 (Descriptors::open): Use initialize_lock_ field
10182 * errors.h (class Errors): Add initialize_lock_ field.
10183 * errors.cc (Errors::Errors): Initialize new field.
10184 (Errors::initialize_lock): Use initialize_lock_ field.
10185 * powerpc.cc (class Target_selector_powerpc): Remove
10186 instantiated_target_ field. In do_recognize call
10187 instantiate_target rather than do_instantiate_target. In
10188 do_instantiate_target just allocate a new target.
10189 * sparc.cc (class Target_selector_sparc): Likewise.
10190
10191 * freebsd.h: New file.
10192 * i386.cc: Include "freebsd.h".
10193 (Target_i386): Derive from Target_freebsd rather than
10194 Sized_target.
10195 (Target_selector_i386): Derive from Target_selector_freebsd rather
10196 than Target_selector.
10197 * x86_64.cc: Include "freebsd.h".
10198 (Target_x86_64): Derive from Target_freebsd rather than
10199 Sized_target.
10200 (Target_selector_x86_64): Derive from Target_selector_freebsd
10201 rather than Target_selector.
10202 * target.h (class Target): Add adjust_elf_header and
10203 do_adjust_elf_header.
10204 * output.cc (Output_file_header:: do_sized_write): Call target
10205 adjust_elf_header routine.
10206 * configure.tgt: Set targ_osabi.
10207 * configure.ac: Define GOLD_DEFAULT_OSABI.
10208 * parameters.cc (Parameters::default_target): Pass
10209 GOLD_DEFAULT_OSABI to select_target.
10210 * target-select.h (class Target_selector): Make instantiate_target
10211 protected rather than private.
10212 * Makefile.am (HFILES): Add freebsd.h.
10213 * configure, Makefile.in, config.in: Rebuild.
10214
10215 * merge.cc (do_add_input_section): Correct pend value. Change
10216 message about last entry not being null terminated from error to
10217 warning.
10218
10219 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10220
10221 * incremental.cc: New file.
10222 * Makefile.am (CCFILES): Add incremental.cc.
10223 * Makefile.in: Rebuild.
10224
10225 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10226
10227 * layout.cc (Layout::output_section_name): Preserve names
10228 of '.note.' sections.
10229
10230 2009-03-19 Ian Lance Taylor <iant@google.com>
10231
10232 * descriptors.cc (Descriptors::open): Check that the options are
10233 valid before using them.
10234
10235 2009-03-18 Ian Lance Taylor <iant@google.com>
10236
10237 * script-sections.h: Include <list>.
10238 (class Script_sections): Change Sections_elements from std::vector
10239 to std::list. Typedef public Elements_iterator. Add
10240 orphan_section_placement_, data_segment_align_start_, and
10241 saw_data_segment_align_ fields. Remove data_segment_align_index_
10242 field.
10243 * script-sections.cc (class Orphan_section_placement): New class.
10244 (class Sections_element): Add virtual functions is_relro and
10245 orphan_section_init. Remove virtual function place_orphan_here.
10246 (class Output_section_definition): Add is_relro and
10247 orphan_section_init. Remove place_orphan_here.
10248 (class Orphan_output_section): Likewise.
10249 (Script_sections::Script_sections): Update for field changes.
10250 (Script_sections::data_segment_align): Set saw_data_segment_align_
10251 and data_segment_align_start_, not data_segment_align_index.
10252 (Script_sections::data_segment_relro_end): Check
10253 saw_data_segment_align_. Use data_segment_align_start_ rather
10254 than data_segment_align_index_.
10255 (Script_sections::place_orphan): Rewrite to use
10256 Orphan_section_placement.
10257
10258 2009-03-17 Ian Lance Taylor <iant@google.com>
10259
10260 * archive.cc (Archive::add_symbols): Check for a version attached
10261 to the symbol name in the archive map.
10262 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10263 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10264 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10265 (ver_test_11.a): New target.
10266 * testsuite/Makefile.in: Rebuild.
10267
10268 * configure.ac: Check for chsize and posix_fallocate. Replace
10269 ftruncate.
10270 * ftruncate.c: New file, from gnulib.
10271 * output.cc (posix_fallocate): Define dummy version if not
10272 HAVE_POSIX_FALLOCATE.
10273 (Output_file::map): Call posix_fallocate rather than lseek and
10274 write.
10275 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10276 * configure, Makefile.in, config.in: Rebuild.
10277
10278 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10279
10280 * layout.h (Layout::create_note): Add section_name parameter.
10281 * layout.cc (Layout::create_note): Likewise.
10282 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10283
10284 2009-03-17 Ian Lance Taylor <iant@google.com>
10285
10286 * descriptors.cc: Include "options.h".
10287 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10288 (Descriptors::open): Always use O_CLOEXEC when opening a new
10289 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10290 then set FD_CLOEXEC.
10291
10292 * sparc.cc (class Target_sparc): Add has_got_section.
10293 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10294 make sure we have a GOT section.
10295
10296 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10297 (Target_sparc::Scan::local): Likewise.
10298 (Target_sparc::Scan::global): Likewise.
10299 (Target_sparc::Relocate::relocate): Likewise.
10300 (Target_sparc::Relocate::relocate_tls): Likewise.
10301
10302 * symtab.cc (Symbol_table::define_default_version): New function,
10303 broken out of add_from_object.
10304 (Symbol_table::add_from_object): Call define_default_version.
10305 (Symbol_table::define_special_symbol): Add resolve_oldsym
10306 parameter. Change all callers. If the version for a symbol comes
10307 from a version script, resolve it with the symbol with the same
10308 name with no version. Also add the symbol without a version if
10309 appropriate.
10310 (do_define_in_output_data): If resolving with oldsym, don't delete
10311 sym.
10312 (do_define_in_output_segment): Likewise.
10313 (do_define_as_constant): Likewise.
10314 * symtab.h (class Symbol_table): Update declarations.
10315
10316 2009-03-13 Ian Lance Taylor <iant@google.com>
10317
10318 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10319 (Read_symbols::requeue): New function.
10320 (Read_symbols::do_read_symbols): If make_elf_object fails because
10321 the target type is not configured, and the file was searched for,
10322 issue a warning and retry with the next directory.
10323 (Add_symbols::run): If the file has an incompatible format, and
10324 it was searched for, requeue the Read_symbols task. On error,
10325 release the object.
10326 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10327 dirindex parameter to constructor. Change all callers. Declare
10328 incompatible_warning and requeue.
10329 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10330 input_argument_ and input_group_ fields. Add them to
10331 constructor. Change all callers.
10332 (class Read_script): Add dirindex_ field. Add it to constructor.
10333 Change all callers.
10334 * archive.cc (Archive::setup): Remove input_objects parameter.
10335 Change all callers.
10336 (Archive::get_file_and_offset): Likewise.
10337 (Archive::read_all_symbols): Likewise.
10338 (Archive::read_symbols): Likewise.
10339 (Archive::get_elf_object_for_member): Remove input_objects
10340 parameter. Add punconfigured parameter. Change all callers.
10341 (Archive::add_symbols): Change return type to bool. Check return
10342 value of include_member.
10343 (Archive::include_all_members): Likewise.
10344 (Archive::include_member): Change return type to bool. Return
10345 false if first included object has incompatible target. Set
10346 included_member_ field.
10347 (Add_archive_symbols::run): If add_symbols returns false, requeue
10348 Read_symbols task.
10349 * archive.h (class Archive): Add included_member_ field.
10350 Initialize it in constructor. Add input_file and searched_for
10351 methods. Update declarations.
10352 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10353 input_argument_ fields. Add them to constructor. Change all
10354 callers.
10355 * script.cc: Include "target-select.h".
10356 (class Parser_closure): Add skip_on_incompatible_target_ and
10357 found_incompatible_target_ fields. Add
10358 skip_on_incompatible_target parameter to constructor. Change all
10359 callers. Add methods skip_on_incompatible_target,
10360 clear_skip_on_incompatible_target, found_incompatible_target, and
10361 set_found_incompatible_target.
10362 (read_input_script): Add dirindex parameter. Change all callers.
10363 If parser finds an incompatible target, requeue Read_symbols
10364 task.
10365 (script_set_symbol): Clear skip_on_incompatible_target in
10366 closure.
10367 (script_add_assertion, script_parse_option): Likewise.
10368 (script_start_sections, script_add_phdr): Likewise.
10369 (script_check_output_format): New function.
10370 * script.h (read_input_script): Update declaration.
10371 * script-c.h (script_check_output_format): Declare.
10372 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10373 (ignore_cmd): Remove OUTPUT_FORMAT.
10374 * fileread.cc (Input_file::Input_file): Add explicit this.
10375 (Input_file::will_search_for): New function.
10376 (Input_file::open): Add pindex parameter. Change all callers.
10377 * fileread.h (class Input_file): Add input_file_argument method.
10378 Declare will_search_for. Update declarations.
10379 * object.cc (make_elf_object): Add punconfigured parameter.
10380 Change all callers.
10381 * object.h (class Object): Make input_file public. Add
10382 searched_for method.
10383 (make_elf_object): Update declaration.
10384 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10385 restart search.
10386 * dirsearch.h (class Dirsearch): Update declaration.
10387 * options.h (class General_options): Add --warn-search-mismatch.
10388 * parameters.cc (Parameters::is_compatible_target): New function.
10389 * parameters.h (class Parameters): Declare is_compatible_target.
10390 * workqueue.cc (Workqueue::add_blocker): New function.
10391 * workqueue.h (class Workqueue): Declare add_blocker.
10392
10393 * fileread.cc (Input_file::open): Remove options parameter.
10394 Change all callers.
10395 (Input_file::open_binary): Likewise.
10396 * script.cc (read_input_script): Likewise.
10397 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10398 options parameter from constructor. Change all callers.
10399 (class Read_script): Likewise.
10400 * fileread.h (class Input_file): Update declarations.
10401 * script.h (read_input_script): Update declaration.
10402
10403 2009-03-10 Nick Clifton <nickc@redhat.com>
10404
10405 * po/es.po: New Spanish translation.
10406
10407 2009-03-06 Cary Coutant <ccoutant@google.com>
10408
10409 * options.cc (parse_short_option): Keep dash_z from registering itself.
10410
10411 2009-03-03 Ian Lance Taylor <iant@google.com>
10412
10413 PR 9918
10414 * target-reloc.h (relocate_section): Pass output_section to
10415 relocate.
10416 * i386.cc (Target_i386::should_apply_static_reloc): Add
10417 output_section parameter. Change all callers.
10418 (Target_i386::Relocate::relocate): Add output_section parameter.
10419 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10420 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10421 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10422 * testsuite/two_file_shared.sh: New script.
10423 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10424 (check_DATA): Add two_file_shared.dbg.
10425 (two_file_shared.dbg): New target.
10426 * testsuite/Makefile.in: Rebuild.
10427
10428 2009-03-01 Ian Lance Taylor <iant@google.com>
10429
10430 * configure.ac: Check for byteswap.h.
10431 * configure: Rebuild.
10432 * config.in: Rebuild.
10433
10434 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10435
10436 * layout.cc (Layout::find_or_add_kept_section): New function.
10437 (Layout::add_comdat): Removed.
10438 * layout.h (struct Kept_section): Move out of class Layout.
10439 Remove trailing underscores from field names. Add group_sections
10440 field. Rename group_ field to is_group. Change all uses.
10441 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10442 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10443 comdat_groups_ field.
10444 (Sized_relobj::include_section_group): Use
10445 find_or_add_kept_section and Kept_section::group_sections.
10446 (Sized_relobj::include_linkonce_section): Likewise.
10447 * object.cc (class Sized_relobj): Don't define Comdat_group or
10448 Comdat_group_table. Remove find_comdat_group and
10449 add_comdat_group. Remove comdat_groups_ field.
10450 * plugin.cc (include_comdat_group): Use
10451 Layout::find_or_add_kept_section.
10452
10453 2009-02-28 Ian Lance Taylor <iant@google.com>
10454
10455 * README: --gc-sections and map files are now supported. Document
10456 some build requirements.
10457
10458 PR 6992
10459 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10460 relocatable link set the value of the section symbol to zero.
10461 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10462 relocatable link don't include the section address in the local
10463 symbol value.
10464
10465 2009-02-27 Ian Lance Taylor <iant@google.com>
10466
10467 PR 6811
10468 * options.h (class Search_directory): Add is_system_directory.
10469 (class General_options): Declare is_in_system_directory.
10470 * options.cc (get_relative_sysroot): Make static.
10471 (get_default_sysroot): Make static.
10472 (General_optoins::is_in_system_directory): New function.
10473 * fileread.cc (Input_file::is_in_system_directory): New function.
10474 * fileread.h (class Input_file): Declare is_in_system_directory.
10475 * object.h (class Object): Add is_in_system_directory.
10476 (class Input_objects): Remove system_library_directory_ field.
10477 * object.cc (Input_objects::add_object): Don't set
10478 system_library_directory_.
10479 (input_objects::found_in_system_library_directory): Remove.
10480 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10481 parameter. Change all callers.
10482 (Symbol_table::sized_write_globals): Likewise.
10483 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10484 Call Object::is_in_system_directory.
10485 * symtab.h (class Symbol_table): Update declarations.
10486
10487 PR 5990
10488 * descriptors.h (Open_descriptor): Add is_on_stack field.
10489 * descriptors.cc (Descriptors::open): If the descriptor is on the
10490 top of the stack, remove it. Initialize is_on_stack field.
10491 (Descriptors::release): Only add pod to stack if it is not on the
10492 stack already.
10493 (Descriptors::close_some_descriptor): Clear stack_next and
10494 is_on_stack fields.
10495
10496 PR 7091
10497 * output.cc (Output_section::find_starting_output_address): Rename
10498 from starting_output_address; add PADDR parameter; change return
10499 type.
10500 * output.h (class Output_section): Declare
10501 find_starting_output_address instead of starting_output_address.
10502 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10503 section symbol for which we can't find a merge section.
10504
10505 PR 9836
10506 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10507 hidden or internal, force the symbol to be local.
10508 * resolve.cc (Symbol::override_visibility): Define.
10509 (Symbol::override_base): Use override_visibility.
10510 (Symbol_table::resolve): Likewise.
10511 (Symbol::override_base_with_special): Likewise.
10512 (Symbol_table::override_with_special): If the visibility is hidden
10513 or internal, force the symbol to be local.
10514 * symtab.h (class Symbol): Add set_visibility and
10515 override_visibility.
10516 * testsuite/ver_test_1.sh: New file.
10517 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10518 (check_DATA): Add ver_test_1.syms.
10519 (ver_test_1.syms): New target.
10520 * testsuite/Makefile.in: Rebuild.
10521
10522 2009-02-25 Cary Coutant <ccoutant@google.com>
10523
10524 * layout.cc (Layout::choose_output_section): Don't rename sections
10525 when using a linker script that has a SECTIONS clause.
10526 * Makefile.in: Regenerate.
10527
10528 * testsuite/Makefile.am (script_test_5.sh): New test case.
10529 * testsuite/Makefile.in: Regenerate.
10530 * testsuite/script_test_5.cc: New file.
10531 * testsuite/script_test_5.sh: New file.
10532 * testsuite/script_test_5.t: New file.
10533
10534 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10535
10536 * archive.cc (Archive::include_member): Update calls to add_symbols.
10537 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10538 the Layout argument.
10539 * dynobj.h (do_add_symbols): Add the Layout argument.
10540 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10541 Layout argument.
10542 * object.h (Object::add_symbols): Add the Layout argument.
10543 (Object::do_add_symbols): Add the Layout argument.
10544 (Sized_relobj::do_add_symbols): Add the Layout argument.
10545 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10546 Unify the two versions.
10547 (Add_plugin_symbols): Remove.
10548 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10549 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10550 (Add_plugin_symbols): Remove.
10551 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10552 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10553 (Add_symbols::run): Make it work with Pulginobj.
10554
10555 2009-02-06 Ian Lance Taylor <iant@google.com>
10556
10557 * object.cc (Sized_relobj::do_layout): Make info message start
10558 with lower case letter.
10559
10560 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10561
10562 * binary.cc: Fix file comment.
10563
10564 * options.h (enum Incremental_disposition): Define.
10565 (class General_options): Add new options: --incremental,
10566 --incremental_changed, --incremental_unchanged,
10567 --incremental_unknown. Add incremental_disposition_ and
10568 implicit_incremental_ fields.
10569 (General_options::incremental_disposition): New function.
10570 (class Position_dependent_options): Add incremental_disposition
10571 option.
10572 (Position_dependent_options::copy_from_options): Set incremental
10573 dispositions.
10574 * options.cc (General_options::parse_incremental_changed): New
10575 function.
10576 (General_options::parse_incremental_unchanged): New function.
10577 (General_options::parse_incremental_unknown): New function.
10578 (General_options::General_options): Initialize new fields
10579 incremental_disposition_ and implicit_incremental_.
10580 (General_options::finalize): Check for uasge of --incremental-*
10581 without --incremental.
10582
10583 2009-02-06 Chris Demetriou <cgd@google.com>
10584
10585 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10586 pointer and to report location as the file name associated with
10587 the symbol.
10588 (gold_undefined_symbol_at_location): New function to replace the
10589 old gold_undefined_symbol functionality.
10590 * target-reloc.h (relocate_section): Update to use
10591 gold_undefined_symbol_at_location.
10592 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10593 Call gold_undefined_symbol function rather than gold_error.
10594 * errors.h (Errors::undefined_symbol): Take location as a
10595 string, rather than calculating it from a relocation.
10596 * errors.cc (Errors::fatal): Print "fatal error:" before the
10597 formatted message.
10598 (Errors::error, Errors::error_at_location): Print "error: "
10599 before the formatted message.
10600 (Errors::undefined_symbol): Take location as a string, rather
10601 than calculating it from a relocation.
10602 (gold_undefined_symbol_at_location): New function akin to
10603 old gold_undefined_symbol, calculates location from relocation.
10604 (gold_undefined_symbol): Change to take only a Symbol pointer
10605 and to report location as the file name associated with the symbol.
10606 * testsuite/debug_msg.sh: Update for changed error messages.
10607 * testsuite/undef_symbol.sh: Likewise.
10608
10609 2009-02-04 Duncan Sands <baldrick@free.fr>
10610
10611 PR 9812
10612 * reduced_debug_output.h
10613 (Output_reduced_debug_abbrev_section::failed): Use format for
10614 gold_warning.
10615 (Output_reduced_debug_info_section::faild): Likewise.
10616
10617 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10618
10619 * script.cc (Lazy_demangler): New class.
10620 (Version_script_info::get_symbol_version_helper): Demangle a
10621 symbol only once.
10622
10623 2009-01-29 Cary Coutant <ccoutant@google.com>
10624
10625 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10626 to __tls_get_addr.
10627 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10628
10629 2009-01-28 Ian Lance Taylor <iant@google.com>
10630
10631 * version.cc (version_string): Bump to 1.9.
10632
10633 * gold.h: Include <cstring> and <stdint.h>.
10634 * version.cc: Include <cstdio>.
10635 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10636 warning.
10637 * reduced_debug_output.cc (insert_into_vector): Rename from
10638 Insert_into_vector; change all callers. Use Swap_unaligned to
10639 avoid aliasing issue; remove union since it is unnecessary.
10640
10641 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10642
10643 * Makefile.am (CCFILES): Add gc.cc.
10644 (HFILES): Add gc.h.
10645 * Makefile.in: Regenerate.
10646 * gold.cc (Gc_runner): New class.
10647 (queue_initial_tasks): Call garbage collection related tasks
10648 when corresponding options are invoked.
10649 (queue_middle_gc_tasks): New function.
10650 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10651 processed early before laying out sections during garbage collection.
10652 * gold.h (queue_middle_gc_tasks): New function.
10653 (is_prefix_of): Move from "layout.cc".
10654 * i386.cc (Target_i386::gc_process_relocs): New function.
10655 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10656 * main.cc (main): Create object of class "Garbage_collection".
10657 * object.cc (Relobj::copy_symbols_data): New function.
10658 (Relobj::is_section_name_included): New function.
10659 (Sized_relobj::do_layout): Allow this function to be called twice
10660 during garbage collection and defer layout of section during the
10661 first call.
10662 * object.h (Relobj::get_symbols_data): New function.
10663 (Relobj::is_section_name_included): New function.
10664 (Relobj::copy_symbols_data): New function.
10665 (Relobj::set_symbols_data): New function.
10666 (Relobj::get_relocs_data): New function.
10667 (Relobj::set_relocs_data): New function.
10668 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10669 (Relobj::gc_process_relocs): New function.
10670 (Relobj::do_gc_process_relocs): New pure virtual function.
10671 (Relobj::sd_): New data member.
10672 (Sized_relobj::is_output_section_offset_invalid): New function.
10673 (Sized_relobj::do_gc_process_relocs): New function.
10674 * options.h (General_options::gc_sections): Modify to not be a no-op.
10675 (General_options::print_gc_sections): New option.
10676 * plugin.cc (Plugin_finish::run): Remove function call to
10677 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10678 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10679 * reloc.cc (Read_relocs::run): Add task to process relocs and
10680 determine unreferenced sections when doing garbage collection.
10681 (Gc_process_relocs): New class.
10682 (Sized_relobj::do_gc_process_relocs): New function.
10683 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10684 sections that are garbage collected.
10685 * reloc.h (Gc_process_relocs): New class.
10686 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10687 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10688 symbols whose corresponding sections are garbage collected.
10689 (Symbol_table::Symbol_table): Add new parameter for the garbage
10690 collection object.
10691 (Symbol_table::gc_mark_undef_symbols): New function.
10692 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10693 (Symbol_table::gc_mark_dyn_syms): New function.
10694 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10695 as garbage.
10696 (Symbol_table::add_from_object): Likewise.
10697 (Symbol_table::add_from_relobj): When building shared objects, do not
10698 treat externally visible symbols as garbage.
10699 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10700 table information for static and relocatable links.
10701 * symtab.h (Symbol_table::set_gc): New function.
10702 (Symbol_table::gc): New function.
10703 (Symbol_table::gc_mark_undef_symbols): New function.
10704 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10705 (Symbol_table::gc_mark_dyn_syms): New function.
10706 (Symbol_table::gc_): New data member.
10707 * target.h (Sized_target::gc_process_relocs): New pure virtual
10708 function.
10709 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10710 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10711
10712 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10713
10714 * options.h (General_options::gc_sections): Define as a no-op for now.
10715 (General_options::no_keep_memory): Ditto.
10716 (General_options::Bshareable): Define.
10717 * options.cc (General_options::finalize): Honor -Bshareable.
10718
10719 2009-01-20 Andreas Schwab <schwab@suse.de>
10720
10721 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10722 read the value in the contents, since we don't use it. Use the
10723 template endianness when writing.
10724 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10725
10726 2009-01-19 Andreas Schwab <schwab@suse.de>
10727
10728 * configure.tgt (powerpc64-*): Fix targ_obj.
10729
10730 2009-01-15 Ian Lance Taylor <iant@google.com>
10731
10732 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10733 local symbols when stripping all symbols.
10734
10735 2009-01-14 Cary Coutant <ccoutant@google.com>
10736
10737 * output.cc (Output_reloc): Add explicit instantiations.
10738
10739 2009-01-14 Cary Coutant <ccoutant@google.com>
10740
10741 * archive.cc (Archive::get_elf_object_for_member): Remove call
10742 to File_read::claim_for_plugin.
10743 * descriptors.cc (Descriptors::open): Remove reference to
10744 is_claimed.
10745 (Descriptors::claim_for_plugin): Remove.
10746 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10747 (Descriptors::is_claimed): Remove.
10748 (claim_descriptor_for_plugin): Remove.
10749 * fileread.cc (File_read::claim_for_plugin): Remove.
10750 * fileread.h (File_read::claim_for_plugin): Remove.
10751 (File_read::descriptor): Reopen descriptor if necessary.
10752 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10753 (Plugin_manager::all_symbols_read): Add task parameter. Change
10754 all callers.
10755 (Plugin_manager::get_input_file): New function.
10756 (Plugin_manager::release_input_file): New function.
10757 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10758 corresponding data member.
10759 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10760 and pass to base constructor. Change all callers.
10761 (get_input_file, release_input_file): New functions.
10762 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10763 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10764 (Plugin_manager::all_symbols_read): Add task parameter.
10765 (Plugin_manager::get_input_file): New function.
10766 (Plugin_manager::release_input_file): New function.
10767 (Plugin_manager::task_): New data member.
10768 (Pluginobj::Pluginobj): Add filesize parameter.
10769 (Pluginobj::filename): New function.
10770 (Pluginobj::descriptor): New function.
10771 (Pluginobj::filesize): New function.
10772 (Pluginobj::filesize_): New data member.
10773 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10774 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10775 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10776
10777 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10778 with archive libraries.
10779 * testsuite/Makefile.in: Regenerate.
10780 * testsuite/plugin_test.c (struct sym_info): New type.
10781 (get_input_file, release_input_file): New static variables.
10782 (onload): Capture new transfer vector entries.
10783 (claim_file_hook): Stop reading at end of file according to filesize.
10784 Factor out parsing of readelf output into separate function.
10785 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10786 APIs and get the source file name from the symbol table. Convert
10787 source file name to corresponding object file name. Print info
10788 message when adding new input files.
10789 (parse_readelf_line): New function.
10790 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10791 * testsuite/plugin_test_2.sh: Likewise.
10792 * testsuite/plugin_test_3.sh: Likewise.
10793 * testsuite/plugin_test_4.sh: New test case.
10794
10795 2009-01-07 Ian Lance Taylor <iant@google.com>
10796
10797 * version.cc (version_string): Bump to 1.8.
10798
10799 2008-12-23 Cary Coutant <ccoutant@google.com>
10800
10801 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10802 * plugin.cc (Plugin_manager::finish): Rename as
10803 layout_deferred_objects. Move cleanup to separate function.
10804 (Plugin_manager::cleanup): New function.
10805 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10806 separately.
10807 * plugin.h (Plugin_manager::finish): Rename as
10808 layout_deferred_objects.
10809 (Plugin_manager::cleanup): New function.
10810 (Plugin_manager::cleanup_done): New field.
10811
10812 2008-12-23 Cary Coutant <ccoutant@google.com>
10813
10814 * plugin.cc (is_visible_from_outside): New function.
10815 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10816 so we don't return "IR only" status for exported symbols or -r links.
10817
10818 * testsuite/Makefile.am (plugin_test_3): New test case.
10819 * testsuite/Makefile.in: Regenerate.
10820 * testsuite/plugin_test_3.sh: New file.
10821
10822 2008-12-22 Cary Coutant <ccoutant@google.com>
10823
10824 * object.cc (Sized_relobj::layout_section): New function.
10825 (Sized_relobj::do_layout): Defer layout of input sections until after
10826 plugin has provided replacement files.
10827 (Sized_relobj::do_layout_deferred_sections): New function.
10828 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10829 (Relobj::layout_deferred_sections): New function.
10830 (Relobj::do_layout_deferred_sections): New function.
10831 (Sized_relobj::do_layout_deferred_sections): New function.
10832 (Sized_relobj::layout_section): New function.
10833 (Sized_relobj::Deferred_layout): New structure.
10834 (Sized_relobj::deferred_layout_): New field.
10835 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10836 Change all callers. Layout deferred sections.
10837 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10838 references.
10839 (Plugin_hook::run): Move code from do_plugin_hook inline.
10840 (Plugin_hook::do_plugin_hook): Remove.
10841 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10842 (Plugin_manager::finish): Renamed, was cleanup.
10843 (Plugin_manager::should_defer_layout): New function.
10844 (Plugin_manager::add_deferred_layout_object): New function.
10845 (Plugin_manager::Deferred_layout_list): New type.
10846 (Plugin_manager::deferred_layout_objects_): New field.
10847 (Plugin_hook::do_plugin_hook): Remove.
10848
10849 2008-12-17 Ian Lance Taylor <iant@google.com>
10850
10851 * options.h (class General_options): Add --no case for
10852 --export-dynamic.
10853
10854 2008-12-16 Cary Coutant <ccoutant@google.com>
10855
10856 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10857 vector.
10858 (Plugin_manager::claim_file): Create plugin object even if
10859 plugin did not call the add_symbols callback.
10860 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10861 asking for more symbols than were added.
10862 * testsuite/Makefile.am (plugin_test_1): Add test case with
10863 no global symbols.
10864 (empty.syms): New target.
10865 * testsuite/Makefile.in: Regenerate.
10866 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10867 message. Don't call add_symbols if no globals.
10868 (all_symbols_read_hook): Don't provide replacement for empty
10869 claimed file.
10870
10871 2008-12-12 Ian Lance Taylor <iant@google.com>
10872
10873 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10874 r_type == 0 for a local symbol with r_sym == 0.
10875 (scan_relocatable_relocs): Pass r_sym to
10876 local_non_section_strategy.
10877 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10878 r_sym parameter.
10879
10880 * configure.ac: Update test for TLS descriptors: they are
10881 supported as of glibc 2.9.
10882 * configure: Rebuild.
10883
10884 2008-12-11 Ian Lance Taylor <iant@google.com>
10885
10886 PR 7091
10887 * target-reloc.h (Default_scan_relocatable_relocs): For each
10888 function, map r_type == 0 to RELOC_DISCARD.
10889
10890 2008-12-10 Cary Coutant <ccoutant@google.com>
10891
10892 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10893 object to override a kept COMDAT group from a plugin object.
10894
10895 2008-12-09 Ian Lance Taylor <iant@google.com>
10896
10897 PR 7088
10898 * yyscript.y (file_cmd): Handle INPUT.
10899
10900 * testsuite/initpri1.c: Change all declarations to be full
10901 prototypes by adding void, to avoid compiler warnings.
10902
10903 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
10904
10905 * options.cc (General_options::parse_plugin_opt): New.
10906 (General_options::add_plugin): The argument now is just the filename.
10907 (General_options::add_plugin_option): New.
10908 * options.h (plugin_opt): New.
10909 (add_plugin): Change argument name.
10910 (add_plugin_option): New.
10911 * plugin.cc (Plugin::load): Don't parse the plugin option.
10912 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10913 (Plugin::add_option): New.
10914 (Plugin::args_): Change type.
10915 (Plugin::filename_): New.
10916 (Plugin_manager::add_plugin_option): New.
10917 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10918 * testsuite/Makefile.in: Regenerate.
10919
10920 2008-12-05 Cary Coutant <ccoutant@google.com>
10921
10922 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10923 Handle --strip-lto-sections option.
10924 * options.h (strip_lto_sections): New option.
10925
10926 2008-12-01 Cary Coutant <ccoutant@google.com>
10927
10928 * plugin.cc (ld_plugin_message): Change format parameter to const.
10929 Fix mismatch between new[] and delete.
10930
10931 2008-11-14 Cary Coutant <ccoutant@google.com>
10932
10933 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10934 instead of -1U.
10935
10936 2008-11-05 Craig Silverstein <csilvers@google.com>
10937
10938 * options.cc (General_options::parse_dynamic_list): New function.
10939 * options.h (General_options): New flags dynamic_list,
10940 dynamic_list_data, dynamic_list_cpp_new, and
10941 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10942 (General_options::in_dynamic_list): New function.
10943 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10944 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10945 (Lex::can_continue_name): Likewise.
10946 (yylex): Likewise.
10947 (read_script_file): New parameter script_options.
10948 (read_dynamic_list): New function.
10949 (Script_options::define_dynamic_list): New function.
10950 (dynamic_list_keyword_parsecodes): New variable.
10951 (dynamic_list_keywords): New variable.
10952 * script.h (Script_options::define_dynamic_list): New function
10953 prototype.
10954 (read_dynamic_list): New function prototype.
10955 * symtab.cc (strprefix): New macro.
10956 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10957 dynamic_list_data, dynamic_list_cpp_new, and
10958 dynamic_list_cpp_typeinfo.
10959 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10960 (dynamic_list_expr): New rule.
10961 (dynamic_list_nodes): Likewise.
10962 (dynamic_list_node): Likewise.
10963 * testsuite/Makefile.am (dynamic_list): New test.
10964 * testsuite/Makefile.in: Regenerated.
10965 * testsuite/dynamic_list.t: New file.
10966 * testsuite/dynamic_list.sh: New file.
10967
10968 2008-11-05 Craig Silverstein <csilvers@google.com>
10969
10970 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10971 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10972 (t11_last): Likewise.
10973 * testsuite/ver_test_6.c (main): Likewise.
10974
10975 2008-10-07 Cary Coutant <ccoutant@google.com>
10976
10977 * options.c (General_options::finalize): Add check for -static and
10978 -shared.
10979 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10980 is not empty.
10981
10982 2008-10-02 Cary Coutant <ccoutant@google.com>
10983
10984 * plugin.cc (make_sized_plugin_object): Fix conditional
10985 compilation to work when not all targets are enabled.
10986
10987 2008-09-29 Cary Coutant <ccoutant@google.com>
10988
10989 * archive.cc (Archive::get_file_and_offset): Use filename instead
10990 of name to get library path.
10991 (Archive::include_member): Unlock external member of a thin archive.
10992
10993 * testsuite/Makefile.am (TEST_AR): New variable.
10994 (thin_archive_test_1): New test.
10995 (thin_archive_test_2): New test.
10996 * testsuite/Makefile.in: Regenerate.
10997 * testsuite/thin_archive_main.cc: New file.
10998 * testsuite/thin_archive_test_1.cc: New file.
10999 * testsuite/thin_archive_test_2.cc: New file.
11000 * testsuite/thin_archive_test_3.cc: New file.
11001 * testsuite/thin_archive_test_4.cc: New file.
11002
11003 2008-09-29 Cary Coutant <ccoutant@google.com>
11004
11005 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11006 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11007 instead of -1U.
11008 (Sized_relobj::do_finalize_local_symbols): Likewise.
11009 (Sized_relobj::map_to_kept_section): Likewise.
11010 * object.h (Sized_relobj::invalid_address): New constant.
11011 (Sized_relobj::do_output_section_offset): Check for invalid_address
11012 and return -1ULL.
11013 * output.cc (Output_reloc::local_section_offset): Use constant
11014 invalid_address instead of -1U.
11015 (Output_reloc::get_address): Likewise.
11016 (Output_section::output_address): Change -1U to -1ULL.
11017 * output.h (Output_reloc::invalid_address): New constant.
11018 * reloc.cc (Sized_relobj::write_sections): Use constant
11019 invalid_address instead of -1U.
11020 (Sized_relobj::relocate_sections): Likewise.
11021 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11022 values for merge sections.
11023 * target-reloc.h (relocate_for_relocatable): Use constant
11024 invalid_address instead of -1U.
11025
11026 2008-09-19 Cary Coutant <ccoutant@google.com>
11027
11028 Add plugin functionality for link-time optimization (LTO).
11029 * configure.ac (plugins): Add --enable-plugins option.
11030 * configure: Regenerate.
11031 * config.in: Regenerate.
11032 * Makefile.am (LIBDL): New variable.
11033 (CCFILES): Add plugin.cc.
11034 (HFILES): Add plugin.h.
11035 (ldadd_var): Add LIBDL.
11036 * Makefile.in: Regenerate.
11037
11038 * archive.cc: Include "plugin.h".
11039 (Archive::setup): Don't preread archive symbols when using a plugin.
11040 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11041 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11042 files.
11043 (Archive::include_member): Add symbols from plugin objects.
11044 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11045 * descriptors.cc (Descriptors::open): Check for file descriptors
11046 abandoned by plugins.
11047 (Descriptors::claim_for_plugin): New function.
11048 * descriptors.h (Descriptors::claim_for_plugin): New function.
11049 (Open_descriptor::is_claimed): New field.
11050 (claim_descriptor_for_plugin): New function.
11051 * fileread.cc (File_read::claim_for_plugin): New function.
11052 * fileread.h (File_read::claim_for_plugin): New function.
11053 (File_read::descriptor): New function.
11054 * gold.cc: Include "plugin.h".
11055 (queue_initial_tasks): Add task to call plugin hooks for generating
11056 new object files.
11057 * main.cc: Include "plugin.h".
11058 (main): Load plugin libraries.
11059 * object.h (Pluginobj): Declare.
11060 (Object::pluginobj): New function.
11061 (Object::do_pluginobj): New function.
11062 (Object::set_target): New function.
11063 * options.cc: Include "plugin.h".
11064 (General_options::parse_plugin): New function.
11065 (General_options::General_options): Initialize plugins_ field.
11066 (General_options::add_plugin): New function.
11067 * options.h (Plugin_manager): Declare.
11068 (General_options): Add --plugin option.
11069 (General_options::has_plugins): New function.
11070 (General_options::plugins): New function.
11071 (General_options::add_plugin): New function.
11072 (General_options::plugins_): New field.
11073 * plugin.cc: New file.
11074 * plugin.h: New file.
11075 * readsyms.cc: Include "plugin.h".
11076 (Read_symbols::do_read_symbols): Check for archive before checking
11077 for ELF file. Call plugin hooks to claim files.
11078 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11079 from a real object file; force override when processing replacement
11080 files.
11081 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11082 (Symbol::init_base_object): Likewise.
11083 (Symbol::init_base_output_data): Likewise.
11084 (Symbol::init_base_output_segment): Likewise.
11085 (Symbol::init_base_constant): Likewise.
11086 (Symbol::init_base_undefined): Likewise.
11087 (Symbol::output_section): Assert that object is not a plugin.
11088 (Symbol_table::add_from_pluginobj): New function.
11089 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11090 undefined.
11091 (Symbol_table::sized_write_globals): Likewise.
11092 (Symbol_table::add_from_pluginobj): Instantiate template.
11093 * symtab.h (Sized_pluginobj): Declare.
11094 (Symbol::in_real_elf): New function.
11095 (Symbol::set_in_real_elf): New function.
11096 (Symbol::in_real_elf_): New field.
11097 (Symbol_table::add_from_pluginobj): New function.
11098
11099 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11100 (LIBDL): New variable.
11101 (LDADD): Add LIBDL.
11102 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11103 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11104 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11105 (MOSTLYCLEANFILES): Likewise.
11106 * testsuite/Makefile.in: Regenerate.
11107 * testsuite/plugin_test.c: New file.
11108 * testsuite/plugin_test_1.sh: New file.
11109 * testsuite/plugin_test_2.sh: New file.
11110
11111 2008-09-16 Ian Lance Taylor <iant@google.com>
11112
11113 * target-reloc.h (relocate_section): Check whether a symbol is
11114 defined by the ABI before reporting an undefined symbol error.
11115 * target.h (Target::is_defined_by_abi): Make parameter const.
11116 (Target::do_is_defined_by_abi): Likewise.
11117 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11118 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11119 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11120 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11121 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11122 * testsuite/Makefile.in: Rebuild.
11123
11124 * fileread.cc (make_view): Add casts to avoid warning.
11125
11126 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11127
11128 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11129 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11130
11131 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11132
11133 * options.h (General_options::output_is_executable): New.
11134 (General_options::output_is_pie): New.
11135 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11136 for shared libraries.
11137 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11138
11139 2008-09-11 Chris Demetriou <cgd@google.com>
11140
11141 * options.h (origin): New -z option.
11142 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11143 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11144 in DT_FLAGS_1.
11145
11146 2008-09-05 Cary Coutant <ccoutant@google.com>
11147
11148 * fileread.cc (File_read::make_view): Add check for attempt to map
11149 beyond end of file.
11150
11151 2008-09-05 Cary Coutant <ccoutant@google.com>
11152
11153 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11154 explicit instantiations.
11155
11156 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11157
11158 PR gold/6858
11159 * options.cc (General_options::finalize): Allow undefined symbols
11160 in shlibs if linking -shared.
11161
11162 PR gold/6859
11163 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11164 symbols as not needing a dynsym entry.
11165
11166 2008-08-20 Craig Silverstein <csilvers@google.com>
11167
11168 * fileread.cc (File_read::open): Do not lock the file unless it
11169 was successfully opened.
11170
11171 2008-08-14 Cary Coutant <ccoutant@google.com>
11172
11173 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11174 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11175 * testsuite/tls_test.cc (struct int128): 128-bit struct
11176 for testing TLS relocs with non-zero addend.
11177 (v12): New TLS variable.
11178 (t12): New test.
11179 (t_last): Add check for v12.
11180 * testsuite/tls_test.h (t12): New function.
11181 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11182
11183 2008-08-13 Ian Lance Taylor <iant@google.com>
11184
11185 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11186 set tls_segment_ or relro_segment_.
11187 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11188 when appropriate.
11189 * output.h (Output_section::clear_is_relro): New function.
11190 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11191 sections specially even when output_data_ is empty.
11192 (Output_segment::maximum_alignment): When first section is relro,
11193 only force alignment for PT_LOAD segments.
11194 * script.cc (script_data_segment_align): New function.
11195 (script_data_segment_relro_end): New function.
11196 * script-c.h (script_data_segment_align): Declare.
11197 (script_data_segment_relro_end): Declare.
11198 * script-sections.h (class Script_sections): Declare
11199 data_segment_align and data_segment_relro_end. Add fields
11200 segment_align_index_ and saw_relro_end_.
11201 * script-sections.cc (class Sections_element): Add set_is_relro
11202 virtual function. Add new bool* parameter to place_orphan_here.
11203 Add get_output_section virtual function.
11204 (class Output_section_definition): Add set_is_relro. Add new
11205 bool* parameter to place_orphan_here. Add get_output_section.
11206 Add is_relro_ field.
11207 (Output_section_definition::Output_section_definition): Initialize
11208 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11209 and is_relro_ fields.
11210 (Output_section_definition::place_orphan_here): Add is_relro
11211 parameter.
11212 (Output_section_definition::set_section_addresses): Set relro for
11213 output section.
11214 (Output_section_definition::alternate_constraint): Likewise.
11215 (class Orphan_output_section): Add new bool* parameter to
11216 place_orphan_here. Add get_output_section.
11217 (Orphan_output_section::place_orphan_here): Add is_relro
11218 parameter.
11219 (Script_sections::Script_sections): Initialize
11220 data_segment_align_index_ and saw_relro_end_.
11221 (Script_sections::data_segment_align): New function.
11222 (Script_sections::data_segment_relro_end): New function.
11223 (Script_sections::place_orphan): Set or clear is_relro.
11224 (Script_sections::set_section_addresses): Force alignment of first
11225 TLS section.
11226 * yyscript.y (exp): Call script_data_segment_align and
11227 script_data_segment_relro_end.
11228 * testsuite/relro_script_test.t: New file.
11229 * testsuite/relro_test.cc (using_script): Declare.
11230 (t1, t2): Test using_script.
11231 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11232 (relro_script_test_SOURCES): Define.
11233 (relro_script_test_DEPENDENCIES): Define.
11234 (relro_script_test_LDFLAGS): Define.
11235 (relro_script_test_LDADD): Define.
11236 (relro_script_test.so): New target.
11237 * testsuite/Makefile.in: Rebuild.
11238
11239 2008-08-06 Cary Coutant <ccoutant@google.com>
11240
11241 * archive.cc (Archive::total_archives, Archive::total_members)
11242 (Archive::total_members_loaded): New variables.
11243 (Archive::setup): Add parameter. Add option to preread
11244 archive symbols.
11245 (Archive::read_armap): Add counter.
11246 (Archive::get_file_and_offset): New function.
11247 (Archive::get_elf_object_for_member): New function.
11248 (Archive::read_all_symbols): New function.
11249 (Archive::read_symbols): New function.
11250 (Archive::add_symbols): Add counters.
11251 (Archive::include_all_members): Use armap to find members if it's
11252 already built.
11253 (Archive::include_member): Skip reading symbols if already read.
11254 Factored code into Archive::get_file_and_offset and
11255 Archive::get_elf_object_for_member. Changed call to
11256 Mapfile::report_include_archive_member.
11257 (Archive::print_stats): New function.
11258 * archive.h: Declare Object and Read_symbols_data classes.
11259 (Archive::Archive): Add initializers for new members.
11260 (Archive::setup): Add parameter.
11261 (Archive::print_stats): New function.
11262 (Archive::total_archives, Archive::total_members)
11263 (Archive::total_members_loaded): New variables.
11264 (Archive::get_file_and_offset): New function.
11265 (Archive::get_elf_object_for_member): New function.
11266 (Archive::read_all_symbols): New function.
11267 (Archive::read_symbols): New function.
11268 (Archive::Archive_member): New class.
11269 (Archive::members_): New member.
11270 (Archive::num_members_): New member.
11271 * main.cc: Include archive.h.
11272 (main): Call Archive::print_stats.
11273 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11274 archive parameter; member_name is now the fully-decorated name.
11275 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11276 * options.h: (General_options): Add --preread-archive-symbols option.
11277 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11278 Archive::setup.
11279
11280 2008-08-04 Ian Lance Taylor <iant@google.com>
11281
11282 * symtab.h (Symbol::use_plt_offset): New function.
11283 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11284 * powerpc.cc (Relocate::relocate): Likewise.
11285 * sparc.cc (Relocate::relocate): Likewise.
11286 * x86_64.cc (Relocate::relocate): Likewise.
11287 * testsuite/weak_plt.sh: New test.
11288 * testsuite/weak_plt_main.cc: New test.
11289 * testsuite/weak_plt_shared.cc: New test.
11290 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11291 (check_PROGRAMS): Add weak_plt.
11292 (check_DATA): Add weak_plt_shared.so.
11293 (weak_plt_main_pic.o, weak_plt): New targets.
11294 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11295 * testsuite/Makefile.in: Rebuild.
11296
11297 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11298 gcctestdir/ld.
11299 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11300 * testsuite/Makefile.in: Rebuild.
11301
11302 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11303
11304 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11305 * Makefile.in: Regenerate.
11306 * po/POTFILES.in: Regenerate.
11307
11308 2008-07-29 Ian Lance Taylor <iant@google.com>
11309
11310 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11311 symbols before other symbols.
11312 * testsuite/script_test_2.cc (test_addr): Declare.
11313 (test_addr_alias): Declare.
11314 (main): Check that test_addr and test_addr_alias have the right
11315 values.
11316 * testsuite/script_test_2.t: Define test_addr_alias and
11317 test_addr.
11318
11319 2008-07-24 Ian Lance Taylor <iant@google.com>
11320
11321 PR 5990
11322 * descriptors.cc: New file.
11323 * descriptors.h: New file.
11324 * gold-threads.h (class Hold_optional_lock): New class.
11325 * fileread.cc: Include "descriptors.h".
11326 (File_read::~File_read): Release descriptor rather than closing
11327 it.
11328 (File_read::open) [file]: Call open_descriptor rather than open.
11329 Set is_descriptor_opened_.
11330 (File_read::open) [memory]: Assert that descriptor is not open.
11331 (File_read::reopen_descriptor): New function.
11332 (File_read::release): Release descriptor.
11333 (File_read::do_read): Make non-const. Reopen descriptor.
11334 (File_read::read): Make non-const.
11335 (File_read::make_view): Reopen descriptor.
11336 (File_read::do_readv): Likewise.
11337 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11338 Update declarations.
11339 * layout.cc: Include "descriptors.h".
11340 (Layout::create_build_id): Use open_descriptor rather than open.
11341 * output.cc: Include "descriptors.h".
11342 (Output_file::open): Use open_descriptor rather than open.
11343 * archive.cc (Archive::const_iterator): Change Archive to be
11344 non-const.
11345 (Archive::begin, Archive::end): Make non-const.
11346 (Archive::count_members): Likewise.
11347 * archive.h (class Archive): Update declarations.
11348 * object.h (Object::read): Make non-const.
11349 * Makefile.am (CCFILES): Add descriptors.cc.
11350 (HFILES): Add descriptors.h.
11351 * Makefile.in: Rebuild.
11352
11353 PR 6716
11354 * gold.h: Always include <clocale>. Add Solaris workarounds
11355 following code in binutils/sysdep.h.
11356
11357 PR 6048
11358 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11359 this->eh_frame_hdr_ is NULL before using it.
11360
11361 * dynobj.cc (Versions::Versions): Update comment.
11362
11363 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11364 the base version name.
11365
11366 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11367 array size plus one.
11368 (Stringpool_template::set_string_offsets): Subtract one from key
11369 before using it as an array index.
11370 (Stringpool_template::get_offset_with_length): Likewise.
11371 (Stringpool_template::write_to_buffer): Likewise.
11372 * stringpool.h (Stringpool_template::get_offset_from_key):
11373 Likewise.
11374
11375 2008-07-23 Ian Lance Taylor <iant@google.com>
11376
11377 PR 6658
11378 * object.h (Merged_symbol_value::value): Do our best to handle a
11379 negative addend.
11380
11381 PR 6647
11382 * script.cc (Version_script_info::get_versions): Don't add empty
11383 version tag to return value.
11384 (Version_script_info::get_symbol_version_helper): Change return
11385 type to bool. Add pversion parameter. Change all callers.
11386 (script_register_vers_node): Don't require a non-NULL tag.
11387 * script.h (class Version_script_info): Update declarations.
11388 (Version_script_info::get_symbol_version): Change return type to
11389 bool. Add version parameter. Change all callers.
11390 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11391 handling. Handle an empty version from a version script.
11392 (Symbol_table::define_special_symbol): Likewise.
11393 * testsuite/ver_test_10.script: New file.
11394 * testsuite/ver_test_10.sh: New file.
11395 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11396 (check_DATA): Add ver_test_10.syms.
11397 (ver_test_10.syms, ver_test_10.so): New target.
11398 * testsuite/Makefile.in: Rebuild.
11399
11400 2008-07-23 Simon Baldwin <simonb@google.com>
11401
11402 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11403 to zero for undefined symbols from dynamic libraries.
11404
11405 2008-07-23 Ian Lance Taylor <iant@google.com>
11406
11407 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11408 Change all callers.
11409 * symtab.h (class Symbol_table): Update declaration.
11410 * testsuite/ver_test_9.cc: New file.
11411 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11412 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11413 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11414 (ver_test_9.so, ver_test_9.o): New targets.
11415 * testsuite/Makefile.in: Rebuild.
11416
11417 2008-07-22 Ian Lance Taylor <iant@google.com>
11418
11419 * options.h (class General_options): Define --check-sections.
11420 * layout.cc (Layout::set_segment_offsets): Handle
11421 --check-sections.
11422
11423 * options.h (class General_options): Define -n/--nmagic and
11424 -N/--omagic.
11425 * options.cc (General_options::finalize): For -n/--nmagic or
11426 -N/--omagic, set -static.
11427 * layout.cc (Layout::attach_allocated_section_to_segment): If
11428 -N/--omagic, don't put read-only and read-write sections in
11429 different segments.
11430 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11431 finding a read-only segment.
11432 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11433 don't set the minimum segment alignment to the common page size,
11434 and don't set the file offset to the address modulo the page size.
11435 * script-sections.cc (Script_sections::create_segments): If
11436 -n/--omagic, don't put read-only and read-write sections in
11437 different segments.
11438
11439 * cref.cc: New file.
11440 * cref.h: New file.
11441 * options.h (class General_options): Add --print-symbol-counts.
11442 * main.cc (main): Issue defined symbol report if requested.
11443 * archive.cc (Archive::interpret_header): Make into a const member
11444 function.
11445 (Archive::add_symbols): Call Input_objects::archive_start and
11446 archive_stop.
11447 (Archive::const_iterator): Define new class.
11448 (Archive::begin, Archive::end): New functions.
11449 (Archive::include_all_members): Rewrite to use iterator.
11450 (Archive::count_members): New function.
11451 * archive.h (class Archive): Update declarations.
11452 (Archive::filename): New function.
11453 * object.cc: Include "cref.h".
11454 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11455 (Sized_relobj::do_get_global_symbol_counts): New function.
11456 (Input_objects::add_object): Add object to cross-referencer.
11457 (Input_objects::archive_start): New function.
11458 (Input_objects::archive_stop): New function.
11459 (Input_objects::print_symbol_counts): New function.
11460 * object.h: Declare Cref and Archive.
11461 (Object::get_global_symbol_counts): New function.
11462 (Object::do_get_global_symbol_counts): New pure virtual function.
11463 (class Sized_relobj): Add defined_count_ field. Update
11464 declarations.
11465 (class Input_objects): Add cref_ field. Update constructor.
11466 Update declarations.
11467 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11468 defined_count_.
11469 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11470 symbol counts.
11471 (Sized_dynobj::do_get_global_symbol_counts): New function.
11472 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11473 defined_count_. Update declarations. Define Symbols typedef.
11474 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11475 parameter. Change all callers.
11476 (Symbol_table::add_from_dynobj): Add sympointers and defined
11477 parameters. Change all callers.
11478 * symtab.h (class Symbol_table): Update declarations.
11479 * Makefile.am (CCFILES): Add cref.cc.
11480 (HFILES): Add cref.h.
11481 * Makefile.in: Rebuild.
11482
11483 2008-07-22 Simon Baldwin <simonb@google.com>
11484
11485 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11486 to zero when writing undefined symbols.
11487
11488 2008-07-22 Ian Lance Taylor <iant@google.com>
11489
11490 * output.cc (Output_section::add_input_section): Don't try to
11491 merge empty merge sections.
11492
11493 2008-07-21 Craig Silverstein <csilvers@google.com>
11494
11495 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11496 Include symbol version in error message.
11497
11498 2008-07-20 Chris Demetriou <cgd@google.com>
11499
11500 * configure.ac (gold_cv_c_random_seed): New configured variable.
11501 (RANDOM_SEED_CFLAGS): New substituted variable.
11502 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11503 * configure: Rebuild.
11504 * Makefile.in: Likewise.
11505 * testsuite/Makefile.in: Likewise.
11506
11507 2008-07-18 Ian Lance Taylor <iant@google.com>
11508
11509 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11510 where we see NAME/NULL and NAME/VERSION as separate symbols.
11511 * testsuite/ver_test_main.cc (main): Call t4.
11512 (t4, t4_2a): Define.
11513 * testsuite/ver_test_2.cc (t4_2): Define.
11514 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11515 * testsuite/ver_test_4.cc (t4_2a): Define.
11516 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11517 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11518
11519 2008-07-17 Ian Lance Taylor <iant@google.com>
11520
11521 * dynobj.cc (Versions::add_def): If we give an error about a
11522 missing version, go ahead and create the version anyhow.
11523
11524 2008-07-10 Ian Lance Taylor <iant@google.com>
11525
11526 Handle output sections with more than 0x7fffffff bytes.
11527 * object.h (class Relobj): Change map_to_output_ to
11528 output_sections_, and just keep a section pointer. Change all
11529 uses. Move comdat group support to Sized_relobj.
11530 (Relobj::is_section_specially_mapped): Remove.
11531 (Relobj::output_section): Remove poff parameter. Change all
11532 callers.
11533 (Relobj::output_section_offset): New function.
11534 (Relobj::set_section_offset): Rewrite.
11535 (Relobj::map_to_output): Remove.
11536 (Relobj::output_sections): New function.
11537 (Relobj::do_output_section_offset): New pure virtual function.
11538 (Relobj::do_set_section_offset): Likewise.
11539 (class Sized_relobj): Add section_offsets_ field. Add comdat
11540 group support from Relobj. Update declarations.
11541 (Sized_relobj::get_output_section_offset): New function.
11542 (Sized_relobj::do_output_section_offset): New function.
11543 (Sized_relobj::do_set_section_offset): New function.
11544 * object.cc (Relobj::output_section_address): Remove.
11545 (Sized_relobj::Sized_relobj): Initialize new fields.
11546 (Sized_relobj::include_section_group): Cast find_kept_object to
11547 Sized_relobj.
11548 (Sized_relobj::include_linkonce_section): Likewise.
11549 (Sized_relobj::do_layout): Use separate arrays for output section
11550 and output offset.
11551 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11552 output_sections.
11553 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11554 output_sections and section_offsets.
11555 (Sized_relobj::write_local_symbols): Likewise.
11556 (map_to_kept_section): Compute output address directly.
11557 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11558 output_sections and section_offsets.
11559 (Sized_relobj::write_sections): Likewise.
11560 (Sized_relobj::relocate_sections): Likewise.
11561 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11562 * output.h (class Output_reloc): Update declarations. Change
11563 u2_.relobj to Sized_relobj*.
11564 (class Output_data_reloc): Change add functions to use
11565 Sized_relobj*.
11566 * output.cc (Output_reloc::Output_reloc): Change relobj to
11567 Sized_relobj*.
11568 (Output_reloc::local_section_offset): Change return type to
11569 Elf_Addr. Use get_output_section_offset.
11570 (Output_reloc::get_address): Likewise.
11571 (Output_section::is_input_address_mapped): Don't call
11572 is_section_specially_mapped.
11573 (Output_section::output_offset): Likewise.
11574 (Output_section::output_address): Likewise.
11575 (Output_section::starting_output_address): Likewise.
11576 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11577 parameter to Sized_relobj*.
11578 (Copy_relocs::need_copy_reloc): Likewise.
11579 (Copy_relocs::save): Likewise.
11580 * copy-relocs.h (class Copy_relocs): Update declarations.
11581 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11582 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11583 * target-reloc.h (relocate_for_relocatable): Change
11584 offset_in_output_section type to Elf_Addr. Change code that uses
11585 it as well.
11586 * layout.cc (Layout::layout): Always set *off.
11587 * mapfile.cc (Mapfile::print_input_section): Use
11588 output_section_offset.
11589 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11590 Sized_relobj*.
11591 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11592 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11593 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11594
11595 2008-07-03 Ian Lance Taylor <iant@google.com>
11596
11597 * layout.cc (Layout::include_section): Do not discard unrecognized
11598 SHT_STRTAB sections.
11599
11600 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11601
11602 * script.cc (Lex::can_continue_name): Make '?' allowable in
11603 version-script names.
11604 * testsuite/version_script.map: Change glob pattern to use '?'
11605
11606 2008-06-30 Manish Singh <yosh@gimp.org>
11607
11608 PR 6585
11609 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11610 Correct typo.
11611
11612 2008-06-30 Ian Lance Taylor <iant@google.com>
11613
11614 PR 6660
11615 PR 6682
11616 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11617 versions]: Don't try to read the value in the contents, since we
11618 don't use it. Use the template endianness when writing.
11619
11620 2008-06-25 Cary Coutant <ccoutant@google.com>
11621
11622 * fileread.cc (File_read::make_view): Assert on zero-length view.
11623 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11624 symbol table when there are no symbols to read.
11625
11626 2008-06-23 Craig Silverstein <csilvers@google.com>
11627
11628 * version.cc (version_string): Bump to 1.7
11629
11630 2008-06-18 Craig Silverstein <csilvers@google.com>
11631
11632 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11633 constant 0xFFFF to type Valtype.
11634 (Powerpc_relocate_functions::rel16_ha): Likewise.
11635
11636 2008-06-17 Ian Lance Taylor <iant@google.com>
11637
11638 * output.h (Output_section::Input_section): Initialize p2align_ to
11639 zero for Output_section_data constructors.
11640 (Output_section::Input_section::addralign): If not an input
11641 section, return the alignment of the Output_section_data.
11642 * testsuite/copy_test.cc: New file.
11643 * testsuite/copy_test_1.cc: New file.
11644 * testsuite/copy_test_2.cc: New file.
11645 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11646 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11647 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11648 (copy_test_1_pic.o, copy_test_1.so): New targets.
11649 (copy_test_2_pic.o, copy_test_2.so): New targets.
11650 * testsuite/Makefile.in: Rebuild.
11651
11652 * script-sections.cc (Script_sections::place_orphan): Initialize
11653 local variable exact.
11654
11655 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11656
11657 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11658
11659 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11660 David S. Miller <davem@davemloft.net>
11661
11662 * powerpc.cc: New file.
11663 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11664 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11665 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11666 * Makefile.in: Rebuild.
11667
11668 2008-06-09 Ian Lance Taylor <iant@google.com>
11669
11670 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11671 <exception>.
11672 (throwing, orig_terminate): New static variables.
11673 (terminate_handler): New static function.
11674 (t2): Set terminate handler.
11675
11676 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11677
11678 PR 6584
11679 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11680 alignment.
11681
11682 2008-05-30 Cary Coutant <ccoutant@google.com>
11683
11684 * archive.cc (Archive::include_all_members) Correct to step
11685 over symbol table and extended name table in thin archives.
11686
11687 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11688
11689 PR 6407
11690 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11691 calculation.
11692
11693 2008-05-28 Caleb Howe <cshowe@google.com>
11694
11695 * reduced_debug_output.cc: New file.
11696 * reduced_debug_output.h: New file.
11697 * options.h (class General_options): Add --strip-debug-non-line.
11698 * options.cc (General_options::finalize): Add strip_debug_non_line
11699 to the strip heirarchy.
11700 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11701 fields.
11702 * layout.cc: Include "reduced_debug_output.h".
11703 (Layout::Layout): Initialize new fields.
11704 (line_only_debug_sections): New static array.
11705 (is_lines_only_debug_sections): New static inline function.
11706 (Layout::include_section): Handle --strip-debug-non-line.
11707 (Layout::make_output_section): If --strip-debug-non-line, build
11708 new output sections for .debug_abbrev and .debug_info.
11709 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11710 gold. Warn about possible overflow.
11711 (read_signed_LEB_128): Likewise.
11712 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11713 (read_signed_LEB_128): Declare.
11714 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11715 (HFILES): Add reduced_debug_output.h.
11716 * Makefile.in: Rebuild.
11717
11718 2008-05-21 Ian Lance Taylor <iant@google.com>
11719
11720 * mapfile.cc: New file.
11721 * mapfile.h: New file.
11722 * options.h (class General_options): Add -M/--print-map and -Map.
11723 * options.cc (General_options::finalize): Make -M equivalent to
11724 -Map -.
11725 * main.cc: Include <cstdio> and "mapfile.h".
11726 (main): Open mapfile if requested.
11727 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11728 constructor. Change caller.
11729 (queue_initial_tasks): Add mapfile parameter. Change caller.
11730 (queue_middle_tasks): Likewise.
11731 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11732 declarations.
11733 * archive.cc: Include "mapfile.h".
11734 (Archive::add_symbols): Add mapfile parameter. Change all
11735 callers. Pass mapfile, symbol, and reason to include_member.
11736 (Archive::include_all_members): Add mapfile parameter. Change all
11737 callers.
11738 (Archive::include_member): Add mapfile, sym, and why parameters.
11739 Change all callers. Report inclusion to map file.
11740 * archive.h: Include "fileread.h".
11741 (class Archive): Update declarations.
11742 (Archive::file): New const method.
11743 (class Add_archive_symbols): Add mapfile_ field. Update
11744 constructor. Change all callers.
11745 * readsyms.h (class Read_symbols): Likewise.
11746 (class Finish_group): Likewise.
11747 (class Read_script): Likewise.
11748 * common.cc: Include "mapfile.h".
11749 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11750 all callers.
11751 (Symbol_table::do_allocate_commons): Likewise.
11752 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11753 symbol allocation to mapfile.
11754 * common.h (class Allocate_commons_task): Add mapfile_ field.
11755 Update constructor. Change all callers.
11756 * symtab.h (class Symbol_table): Update declarations.
11757 * layout.cc: Include "mapfile.h".
11758 (Layout_task_runner::run): Print information to mapfile.
11759 (Layout::create_gold_note): Change Output_data_fixed_space to
11760 Output_data_zero_fill.
11761 (Layout::create_build_id): Likewise.
11762 (Layout::print_to_mapfile): New function.
11763 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11764 constructor. Change caller.
11765 (class Layout): Declare print_to_mapfile.
11766 * output.cc (Output_section::Input_section::print_to_mapfile): New
11767 function.
11768 (Output_section::add_input_section): If producing a map, always
11769 add to input_sections_ list.
11770 (Output_section::do_print_to_mapfile): New function.
11771 (Output_segment::print_sections_to_mapfile): New function.
11772 (Output_segment::print_section_list_to_mapfile): New function.
11773 * output.h: Include "mapfile.h".
11774 (Output_data::print_to_mapfile): New function.
11775 (Output_data::do_print_to_mapfile): New virtual function.
11776 (Output_segment_headers::do_print_to_mapfile): New function.
11777 (Output_file_header::do_print_to_mapfile): New function.
11778 (Output_data_const::do_print_to_mapfile): New function.
11779 (class Output_data_const_buffer): Add map_name_ field. Update
11780 constructor. Change all callers. Add do_print_to_mapfile
11781 function.
11782 (class Output_data_fixed_space): Likewise.
11783 (class Output_data_space): Likewise.
11784 (class Output_data_zero_fill): New class.
11785 (Output_data_strtab::do_print_to_mapfile): New function.
11786 (Output_data_reloc_base::do_print_to_mapfile): New function.
11787 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11788 (Output_data_group::do_print_to_mapfile): New function.
11789 (Output_data_got::do_print_to_mapfile): New function.
11790 (Output_data_dynamic::do_print_to_mapfile): New function.
11791 (Output_symtab_xindex::do_print_to_mapfile): New function.
11792 (class Output_section): Declare do_print_to_mapflie. Declare
11793 print_to_mapfile in Input_section.
11794 (class Output_segment): Declare new functions.
11795 * object.h (Sized_relobj::symbol_count): New function.
11796 * script-sections.cc
11797 (Output_section_element_dot_assignment::set_section_addresses):
11798 Change Output_data_fixed_space to Output_data_zero_fill.
11799 (Output_data_expression::do_print_to_mapfile): New function.
11800 * script.cc (read_input_script): Add mapfile parameter. Change
11801 all callers.
11802 * script.h (read_input_script): Update declaration.
11803 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11804 (Eh_frame::do_print_to_mapfile): New function.
11805 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11806 (Output_merge_string::do_print_to_mapfile): New function.
11807 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11808 function.
11809 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11810 function.
11811 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11812 function.
11813 * Makefile.am (CCFILES): Add mapfile.cc.
11814 (HFILES): Add mapfile.h.
11815 * Makefile.in: Rebuild.
11816
11817 2008-05-19 Ian Lance Taylor <iant@google.com>
11818
11819 * options.h (class General_options): Add -z relro.
11820 * layout.cc (Layout::Layout): Initialize relro_segment_.
11821 (Layout::add_output_section_data): Return the output section.
11822 (Layout::make_output_section): Rcognize relro sections and mark
11823 them appropriately.
11824 (Layout::attach_allocated_section_to_segment): Put relro sections
11825 in a PT_GNU_RELRO segment.
11826 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11827 section as relro.
11828 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11829 PT_TLS segments.
11830 (Layout::linkonce_mapping): Map d.rel.ro.local to
11831 .data.rel.ro.local.
11832 (Layout::output_section_name): Us .data.rel.ro.local for any
11833 section which begins with that.
11834 * layout.h (class Layout): Update add_output_section_data
11835 declaration. Add relro_segment_ field.
11836 * output.cc (Output_section::Output_section): Initialize is_relro_
11837 and is_relro_local_ fields.
11838 (Output_segment::add_output_section): Group relro sections.
11839 (Output_segment::is_first_section_relro): New function.
11840 (Output_segment::maximum_alignment): If there is a relro section,
11841 align the segment to the common page size.
11842 (Output_segment::set_section_addresses): Track whether we are
11843 looking at relro sections. If the last section is a relro
11844 section, align to the common page size.
11845 (Output_segment::set_section_list_addresses): Add in_relro
11846 parameter. Change all callers. Align to the page size when
11847 moving from relro to non-relro section.
11848 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11849 segment.
11850 * output.h (class Output_section): Add is_relro_ and
11851 is_relro_local_ fields.
11852 (Output_section::is_relro): New function.
11853 (Output_section::set_is_relro): New function.
11854 (Output_section::is_relro_local): New function.
11855 (Output_section::set_is_relro_local): New function.
11856 (class Output_segment): Update declarations.
11857 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11858 * sparc.cc (Target_sparc::got_section): Likewise.
11859 * x86_64.cc (Target_x86_64::got_section): Likewise.
11860 * testsuite/relro_test_main.cc: New file.
11861 * testsuite/relro_test.cc: New file.
11862 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11863 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11864 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11865 (relro_test.so, relro_test_pic.o): New targets.
11866 * testsuite/Makefile.in: Rebuild.
11867
11868 2008-05-16 Ian Lance Taylor <iant@google.com>
11869
11870 * output.cc (Output_segment::add_output_section): Remove front
11871 parameter.
11872 * output.h (class Output_segment): Remove
11873 add_initial_output_section and overloaded add_output_section.
11874 Update declaration of remaining add_output_section.
11875 * layout.cc (Layout::create_interp): Call add_output_section
11876 rather than add_initial_output_section.
11877 (Layout::finish_dynamic_section): Likewise.
11878
11879 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11880 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11881 know the dynamic type.
11882 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11883 field. Initialize it in constructor.
11884 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11885 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11886 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11887 reloc.
11888
11889 * output.cc (Output_reloc::get_address): Change return type to
11890 Elf_Addr.
11891 * output.h (class Output_reloc): Update get_address declaration.
11892 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11893 for section addresses.
11894
11895 2008-05-09 Ian Lance Taylor <iant@google.com>
11896
11897 PR 6493
11898 * gold.cc (gold_nomem): Use return value of write.
11899
11900 2008-05-08 Ian Lance Taylor <iant@google.com>
11901
11902 * symtab.c (Symbol::init_base_output_data): Add version
11903 parameter. Change all callers.
11904 (Symbol::init_base_output_segment): Likewise.
11905 (Symbol::init_base_constant): Likewise.
11906 (Symbol::init_base_undefined): Likewise.
11907 (Sized_symbol::init_output_data): Likewise.
11908 (Sized_symbol::init_output_segment): Likewise.
11909 (Sized_symbol::init_constant): Likewise.
11910 (Sized_symbol::init_undefined): Likewise.
11911 (Symbol_table::do_define_in_output_data): If the new symbol has a
11912 version, mark it as the default.
11913 (Symbol_table::do_define_in_output_segment): Likewise.
11914 (Symbol_table::do_define_as_constant): Likewise.
11915 * symtab.h (class Symbol): Update declarations.
11916 (class Sized_symbol): Likewise.
11917 * resolve.cc (Symbol::override_version): New function.
11918 (Symbol::override_base): Call override_version.
11919 (Symbol::override_base_with_special): Likewise.
11920 * testsuite/ver_script_8.script: New file.
11921 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11922 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11923 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11924 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11925
11926 2008-05-06 Ian Lance Taylor <iant@google.com>
11927
11928 PR 6049
11929 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11930 functions.
11931 (class General_options): Remove existing --undefined, and add
11932 --no-undefined instead. Add new --undefined as synonym for -u.
11933 * archive.cc (Archive::add_symbols): Check whether symbol was
11934 named with -u.
11935 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11936 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11937 all uses. Add IS_UNDEFINED. Update declarations to split
11938 different versions of init_base. Declare init_base_undefined.
11939 (Symbol::is_defined): Handle IS_UNDEFINED.
11940 (Symbol::is_undefined): Likewise.
11941 (Symbol::is_weak_undefined): Call is_undefined.
11942 (Symbol::is_absolute): Handle IS_CONSTANT.
11943 (class Sized_symbol): Update declarations to split different
11944 versions of init. Declare init_undefined.
11945 (class Symbol_table): Declare new functions.
11946 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11947 Change all callers.
11948 (Symbol::init_base_output_data): Likewise.
11949 (Symbol::init_base_output_segment): Likewise.
11950 (Symbol::init_base_constant): Likewise.
11951 (Symbol::init_base_undefined): New function.
11952 (Sized_symbol::init_object): Rename from init. Change all
11953 callers.
11954 (Sized_symbol::init_output_data): Likewise.
11955 (Sized_symbol::init_output_segment): Likewise.
11956 (Sized_symbol::init_constant): Likewise.
11957 (Sized_symbol::init_undefined): New function.
11958 (Symbol_table::add_undefined_symbols_from_command_line): New
11959 function.
11960 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11961 function.
11962 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11963 (Symbol::output_section): Likewise.
11964 (Symbol::set_output_section): Likewise.
11965 (Symbol_table::sized_finalize_symbol): Likewise.
11966 (Symbol_table::sized_write_globals): Likewise.
11967 * resolve.cc (Symbol_table::should_override): Likewise.
11968 (Symbol::override_base_with_special): Likewise.
11969
11970 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11971 symbol, change it to have default visibility.
11972 * testsuite/protected_1.cc: New file.
11973 * testsuite/protected_2.cc: New file.
11974 * testsuite/protected_3.cc: New file.
11975 * testsuite/protected_main_1.cc: New file.
11976 * testsuite/protected_main_2.cc: New file.
11977 * testsuite/protected_main_3.cc: New file.
11978 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11979 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11980 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11981 (protected_1.so): New target.
11982 (protected_1_pic.o, protected_2_pic.o): New targets.
11983 (protected_3_pic.o): New target.
11984 (check_PROGRAMS): Add protected_2.
11985 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11986 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11987 * testsuite/Makefile.in: Rebuild.
11988
11989 * options.h (DEFINE_var): Add set_user_set_##varname__.
11990 (DEFINE_bool_alias): New macro.
11991 (class General_options): Define -Bstatic using DEFINE_bool_alias
11992 rather than DEFINE_special. Add --undefined as an alias for -z
11993 defs.
11994 * options.cc (General_options::parse_Bstatic): Remove.
11995
11996 * options.h (class General_options): Add --fatal-warnings.
11997 * main.cc (main): Implement --fatal-warnings.
11998 * errors.h (Errors::warning_count): New function.
11999
12000 * options.h (class General_options): Add -Bsymbolic-functions.
12001 * symtab.h (Symbol::is_preemptible): Check for
12002 -Bsymbolic-functions.
12003
12004 2008-05-05 Ian Lance Taylor <iant@google.com>
12005
12006 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12007 as noVARNAME rather than no-VARNAME.
12008 (class General_options): Add option -z combreloc.
12009 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12010 get_address.
12011 (Output_reloc::sort_before) [SHT_REL]: New function.
12012 (Output_reloc::sort_before) [SHT_RELA]: New function.
12013 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12014 Sort_relocs_comparison.
12015 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12016 parameter. Change all callers.
12017 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12018 sort_relocs parameter. Change all callers.
12019 * output.cc (Output_reloc::get_address): New function, broken out
12020 of write_rel.
12021 (Output_reloc::write_rel): Call it.
12022 (Output_reloc::compare): New function.
12023 (Output_data_reloc_base::do_write): Optionally sort relocs.
12024
12025 * configure.ac: If targ_extra_obj is set, link it in.
12026 * configure.tgt: Initialize all variables.
12027 (x86_64*): Set targ_extra_obj and targ_extra_size.
12028 * configure: Rebuild.
12029
12030 * object.cc (Sized_relobj::include_section_group): Adjust section
12031 indexes read from group data. Build vector to pass to
12032 layout_group.
12033 * layout.cc (Layout::layout_group): Add flags and shndxes
12034 parameters. Remove contents parameter. Change caller. Update
12035 explicit instantiations.
12036 * layout.h (class Layout): Update layout_group declaration.
12037 * output.cc (Output_data_group::Output_data_group): Add flags and
12038 input_shndxes parameters. Remove contents parameter. Change
12039 caller.
12040 (Output_data_group::do_write): Change input_sections_ to
12041 input_shndxes_.
12042 * output.h (class Output_data_group): Update constructor
12043 declaration. Rename input_sections_ to input_shndxes_.
12044 * testsuite/many_sections_test.cc: Add template.
12045
12046 2008-04-30 Cary Coutant <ccoutant@google.com>
12047
12048 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12049
12050 * layout.cc (Layout::include_section): Refactored check for debug
12051 info section.
12052 (Layout::add_comdat): Add new parameters. Change type
12053 of signature parameter. Add object and shndx to signatures table.
12054 (Layout::find_kept_object): New function.
12055 * layout.h: Include <cstring>.
12056 (Layout::is_debug_info_section): New function.
12057 (Layout::add_comdat): Add new parameters.
12058 (Layout::find_kept_object): New function.
12059 (Layout::Kept_section): New struct.
12060 (Layout::Signatures): Change type of map range.
12061 * object.cc (Relobj::output_section_address): New function.
12062 (Sized_relobj::include_section_group): Add new parameters. Change
12063 calls to Layout::add_comdat. Change to build table of kept comdat
12064 groups and table mapping discarded sections to kept sections.
12065 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12066 (Sized_relobj::do_layout): Change calls to include_section_group and
12067 include_linkonce_section.
12068 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12069 value to zero when section is discarded.
12070 (Sized_relobj::map_to_kept_section): New function.
12071 * object.h (Relobj::output_section_address): New function.
12072 (Relobj::Comdat_group): New type.
12073 (Relobj::find_comdat_group): New function.
12074 (Relobj::Comdat_group_table): New type.
12075 (Relobj::Kept_comdat_section): New type.
12076 (Relobj::Kept_comdat_section_table): New type.
12077 (Relobj::add_comdat_group): New function.
12078 (Relobj::set_kept_comdat_section): New function.
12079 (Relobj::get_kept_comdat_section): New function.
12080 (Relobj::comdat_groups_): New field.
12081 (Relobj::kept_comdat_sections_): New field.
12082 (Symbol_value::input_value): Update comment.
12083 (Sized_relobj::map_to_kept_section) New function.
12084 (Sized_relobj::include_linkonce_section): Add new parameter.
12085 * target-reloc.h (Comdat_behavior): New type.
12086 (get_comdat_behavior): New function.
12087 (relocate_section): Add code to map a discarded section to the
12088 corresponding kept section when applying a relocation.
12089
12090 2008-04-30 Craig Silverstein <csilvers@google.com>
12091
12092 * dwarf_reader.cc (next_generation_count): New static var.
12093 (Addr2line_cache_entry): New struct.
12094 (addr2line_cache): New static var.
12095 (Dwarf_line_info::one_addr2line): Added caching.
12096 (Dwarf_line_info::clear_addr2line_cache): New function.
12097 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12098 cache-size parameter.
12099 (Dwarf_line_info::one_addr2line_cache): New function.
12100 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12101 new cache-size argument to one_addr2line(), and clear cache.
12102
12103 2008-04-28 Cary Coutant <ccoutant@google.com>
12104
12105 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12106 R_386_PC8 relocations.
12107
12108 2008-04-23 Ian Lance Taylor <iant@google.com>
12109
12110 * object.cc (Sized_relobj::include_section_group): Check for
12111 invalid section group.
12112
12113 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12114 header size.
12115
12116 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12117 than read for file header.
12118 * archive.cc (Archive::include_member): Likewise.
12119
12120 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12121
12122 * aclocal.m4: Regenerate.
12123 * configure: Regenerate.
12124
12125 2008-04-19 Ian Lance Taylor <iant@google.com>
12126
12127 * version.cc (version_string): Bump to 1.6.
12128
12129 * testsuite/Makefile.am (many_sections_r_test): New target.
12130 (many_sections_r_test_SOURCES): Remove.
12131 (many_sections_r_test_DEPENDENCIES): Remove.
12132 (many_sections_r_test_LDFLAGS): Remove.
12133 (many_sections_r_test_LDADD): Remove.
12134
12135 * object.cc (Sized_relobj::do_add_symbols): Always pass
12136 local_symbol_count_ to add_from_relobj.
12137
12138 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12139 every thousand variables.
12140 * testsuite/Makefile.in: Rebuild.
12141
12142 * object.cc (Xindex::initialize_symtab_xindex): New function.
12143 (Xindex::read_symtab_xindex): New function.
12144 (Xindex::sym_xindex_to_shndx): New function.
12145 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12146 available.
12147 (Sized_relobj::do_initialize_xindex): New function.
12148 (Sized_relobj::do_read_symbols): Adjust section links.
12149 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12150 parameter. Change all callers.
12151 (Sized_relobj::include_section_group): Adjust section links and
12152 symbol section indexes.
12153 (Sized_relobj::do_layout): Adjust section links.
12154 (Sized_relobj::do_count_local_symbols): Adjust section links and
12155 symbol section indexes.
12156 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12157 ordinary and special symbols.
12158 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12159 dynsym_xindex parameters. Change all callers. Adjust section
12160 links. Use SHN_XINDEX when needed.
12161 (Sized_relobj::get_symbol_location_info): Adjust section links.
12162 Don't get fooled by special symbols.
12163 * object.h (class Xindex): Define.
12164 (class Object): Add xindex_ parameter. Declare virtual functoin
12165 do_initialize_xindex.
12166 (Object::adjust_sym_shndx): New function.
12167 (Object::set_xindex): New protected function.
12168 (class Symbol_value): Add is_ordinary_shndx_ field.
12169 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12170 (Symbol_value::value): Assert ordinary section.
12171 (Symbol_value::initialize_input_to_output_map): Likewise.
12172 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12173 Change all callers.
12174 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12175 all callers.
12176 (class Sized_relobj): Update declarations.
12177 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12178 parameter. Change all callers.
12179 (Sized_relobj::adjust_shndx): New function.
12180 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12181 field.
12182 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12183 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12184 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12185 (Sized_dynobj::read_dynsym_section): Adjust section links.
12186 (Sized_dynobj::read_dynamic): Likewise.
12187 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12188 section links.
12189 (Sized_dynobj::do_initialize_xindex): New function.
12190 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12191 do_initialize_xindex.
12192 (Sized_dynobj::adjust_shndx): New function.
12193 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12194 dynsym_xindex_ fields.
12195 (Layout::finalize): Add a call to set_section_indexes before
12196 creating the symtab sections.
12197 (Layout::set_section_indexes): Don't do anything if the section
12198 already has a section index.
12199 (Layout::create_symtab_sections): Add shnum parameter. Change
12200 caller. Create .symtab_shndx section if needed.
12201 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12202 caller.
12203 (Layout::allocated_output_section_count): New function.
12204 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12205 needed.
12206 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12207 fields. Update declarations.
12208 (Layout::symtab_xindex): New function.
12209 (Layout::dynsym_xindex): New function.
12210 (class Write_symbols_task): Add layout_ field.
12211 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12212 Change caller.
12213 * output.cc (Output_section_headers::Output_section_headers): Add
12214 shstrtab_section parameter. Change all callers.
12215 (Output_section_headers::do_sized_write): Store overflow values
12216 for section count and section string table section index in
12217 section header zero.
12218 (Output_file_header::do_sized_write): Check for overflow of
12219 section count and section string table section index.
12220 (Output_symtab_xindex::do_write): New function.
12221 (Output_symtab_xindex::endian_do_write): New function.
12222 * output.h (class Output_section_headers): Add shstrtab_section_.
12223 Update declarations.
12224 (class Output_symtab_xindex): Define.
12225 (Output_section::has_out_shndx): New function.
12226 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12227 field.
12228 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12229 Change all callers.
12230 (Sized_symbol::init): Likewise.
12231 (Symbol::output_section): Check for ordinary symbol.
12232 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12233 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12234 callers.
12235 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12236 Change all callers. Simplify handling of symbols from sections
12237 not included in the link.
12238 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12239 distinction.
12240 (Weak_alias_sorter::operator()): Assert that symbols are
12241 ordinary.
12242 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12243 distinction.
12244 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12245 parameters. Change all callers.
12246 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12247 symbol distinction. Use SHN_XINDEX when needed.
12248 (Symbol_table::write_section_symbol): Add symtab_xindex
12249 parameter. Change all callers.
12250 (Symbol_table::sized_write_section_symbol): Likewise. Use
12251 SHN_XINDEX when needed.
12252 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12253 declarations.
12254 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12255 (Symbol::is_defined): Check is_ordinary.
12256 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12257 (Symbol::is_absolute, Symbol::is_common): Likewise.
12258 (class Sized_symbol): Update declarations.
12259 (class Symbol_table): Update declarations.
12260 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12261 parameters. Change all callers.
12262 (Sized_symbol::override): Likewise.
12263 (Symbol_table::override): Likewise.
12264 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12265 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12266 is_ordinary, and orig_st_shndx parameters. Change all callers.
12267 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12268 to be in an ordinary section.
12269 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12270 object and is_ordinary parameters. Change all callers.
12271 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12272 Change all callers. Don't add undefined or non-ordinary symbols
12273 to reloc_map_.
12274 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12275 Change all callers.
12276 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12277 declarations.
12278 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12279 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12280 (Sized_relobj::relocate_sections): Likewise.
12281 * target-reloc.h (scan_relocs): Adjust section symbol index.
12282 (scan_relocatable_relocs): Likewise.
12283 * i386.cc (Scan::local): Check for ordinary symbols.
12284 * sparc.cc (Scan::local): Likewise.
12285 * x86_64.cc (Scan::local): Likewise.
12286 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12287 to symbol_section_and_value.
12288 * testsuite/many_sections_test.cc: New file.
12289 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12290 (check_PROGRAMS): Add many_sections_test.
12291 (many_sections_test_SOURCES): Define.
12292 (many_sections_test_DEPENDENCIES): Define.
12293 (many_sections_test_LDFLAGS): Define.
12294 (BUILT_SOURCES): Add many_sections_define.h.
12295 (many_sections_define.h): New target.
12296 (BUILT_SOURCES): Add many_sections_check.h.
12297 (many_sections_check.h): New target.
12298 (check_PROGRAMS): Add many_sections_r_test.
12299 (many_sections_r_test_SOURCES): Define.
12300 (many_sections_r_test_DEPENDENCIES): Define.
12301 (many_sections_r_test_LDFLAGS): Define.
12302 (many_sections_r_test_LDADD): Define.
12303 (many_sections_r_test.o): New target.
12304 * testsuite/Makefile.in: Rebuild.
12305
12306 2008-04-17 Cary Coutant <ccoutant@google.com>
12307
12308 * errors.cc (Errors::info): New function.
12309 (gold_info): New function.
12310 * errors.h (Errors::info): New function.
12311 * gold.h (gold_info): New function.
12312 * object.cc (Input_objects::add_object): Print trace output.
12313 * options.cc (options::parse_set): New function.
12314 (General_options::parse_wrap): Deleted.
12315 (General_options::General_options): Deleted initializer.
12316 * options.h (options::String_set): New typedef.
12317 (options::parse_set): New function.
12318 (DEFINE_set): New macro.
12319 (General_options::wrap): Changed to use DEFINE_set. Changed
12320 callers of any_wrap_symbols and is_wrap_symbol.
12321 (General_options::trace, General_options::trace_symbol):
12322 New options.
12323 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12324 (General_options::wrap_symbols_): Deleted.
12325 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12326
12327 2008-04-17 David S. Miller <davem@davemloft.net>
12328
12329 * options.cc (General_options::parse_V): New function.
12330 * options.h: Add entries for -V and -Qy.
12331
12332 2008-04-17 Ian Lance Taylor <iant@google.com>
12333
12334 * common.cc (Symbol_table::allocate_commons): Remove options
12335 parameter. Change caller.
12336 (Symbol_table::do_allocate_commons): Remove options parameter.
12337 Change caller. Just call do_allocate_commons_list twice.
12338 (Symbol_table::do_allocate_commons_list): New function, broken out
12339 of do_allocate_commons.
12340 * common.h (class Allocate_commons_task): Remove options_ field.
12341 Update constructor.
12342 * symtab.cc (Symbol_table::Symbol_table): Initialize
12343 tls_commons_.
12344 (Symbol_table::add_from_object): Put TLS common symbols on
12345 tls_commons_ list.
12346 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12347 which are IN_OUTPUT_DATA.
12348 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12349 allocate_commons and do_allocate_commons declarations. Declare
12350 do_allocate_commons_list.
12351 * gold.cc (queue_middle_tasks): Update creation of
12352 Allocate_commons_task to not pass options.
12353 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12354 (TLS_TEST_C_FLAGS): New variable.
12355 (tls_test_c_pic.o): New target.
12356 (tls_test_shared.so): Link in tls_test_c_pic.o.
12357 (tls_test_c_pic_ie.o): New target.
12358 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12359 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12360 (tls_test_c.o): New target.
12361 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12362 (tls_pic_test_LDADD): Likewise.
12363 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12364 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12365 (tls_test_c_gnu2.o): New target.
12366 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12367 tls_test_c_gnu2.o.
12368 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12369 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12370 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12371 * testsuite/tls_test.cc: Include "config.h".
12372 (t_last): Call t11_last.
12373 * testsuite/tls_test.h (t11, t11_last): Declare.
12374 * testsuite/tls_test_c.c: New file.
12375 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12376 * configure.ac: Check for OpenMP support.
12377 * configure, config.in, Makefile.in: Rebuild.
12378 * testsuite/Makefile.in: Rebuild.
12379
12380 2008-04-16 Cary Coutant <ccoutant@google.com>
12381
12382 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12383 (Target_i386::tls_base_symbol_defined_): New field.
12384 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12385 (Target_i386::Scan::global): Likewise.
12386 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12387 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12388 (Target_x86_64::tls_base_symbol_defined_): New field.
12389 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12390 (Target_x86_64::Scan::global): Likewise.
12391
12392 2008-04-16 Cary Coutant <ccoutant@google.com>
12393
12394 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12395 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12396 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12397 building shared libraries.
12398 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12399 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12400 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12401 * testsuite/Makefile.in: Rebuild.
12402 * testsuite/weak_undef.h: New file.
12403 * testsuite/weak_undef_file1.cc: Add extra test cases.
12404 * testsuite/weak_undef_file2.cc: Likewise.
12405 * testsuite/weak_undef_test.cc: Likewise.
12406
12407 2008-04-16 David S. Miller <davem@davemloft.net>
12408
12409 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12410 Add issued_non_pic_error_ field. Declare check_non_pic.
12411 (Target_sparc::Scan::check_non_pic): New function.
12412 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12413 (Target_sparc::Scan::global): Likewise.
12414
12415 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12416 * configure: Rebuild.
12417
12418 * options.h (DEFINE_enable): New macro.
12419 (new_dtags): New enable option.
12420 (initfirst, interpose, loadfltr, nodefaultlib,
12421 nodelete, nodlopen, nodump): New -z options.
12422 * layout.cc (Layout:finish_dynamic_section): If new
12423 dtags enabled, emit DT_RUNPATH. Also, emit a
12424 DT_FLAGS_1 containing any specified -z flags.
12425
12426 2008-04-16 Ian Lance Taylor <iant@google.com>
12427
12428 * copy-relocs.cc: New file.
12429 * copy-relocs.h: New file.
12430 * reloc.cc: Remove Copy_relocs code.
12431 * reloc.h: Likewise.
12432 * reloc-types.h (struct Reloc_types) [both versions]: Add
12433 get_reloc_addend_noerror.
12434 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12435 variants of add_global which take an addend which must be zero.
12436 * i386.cc: Include "copy-relocs.h".
12437 (class Target_i386): Change type of copy_relocs_ to variable,
12438 update initializer.
12439 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12440 Change all callers.
12441 (Target_i386::do_finalize_sections): Change handling of
12442 copy_relocs_.
12443 * sparc.cc: Include "copy-relocs.h".
12444 (class Target_sparc): Change type of copy_relocs_ to variable,
12445 update initializer.
12446 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12447 Change all callers.
12448 (Target_sparc::do_finalize_sections): Change handling of
12449 copy_relocs_.
12450 * x86_64.cc: Include "copy-relocs.h".
12451 (class Target_x86_64): Change type of copy_relocs_ to variable,
12452 update initializer.
12453 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12454 class. Change all callers.
12455 (Target_x86_64::do_finalize_sections): Change handling of
12456 copy_relocs_.
12457 * Makefile.am (CCFILES): Add copy-relocs.cc.
12458 (HFILES): Add copy-relocs.h.
12459
12460 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12461
12462 * testsuite/script_test_4.sh: Permit leading zeroes.
12463
12464 2008-04-15 Ian Lance Taylor <iant@google.com>
12465
12466 * script-sections.cc (Script_sections::create_segments): Use
12467 header_size_adjustment even when there is enough room for the
12468 headers.
12469 * testsuite/script_test_4.sh: New file.
12470 * testsuite/script_test_4.t: New file.
12471 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12472 (check_DATA): Add script_test_4.stdout.
12473 (MOSTLYCLEANFILES): Likewise.
12474 (script_test_4): New target.
12475 (script_test_4.stdout): New target.
12476 * testsuite/Makefile.in: Rebuild.
12477
12478 * sparc.cc: Add definitions for Output_data_plt_sparc class
12479 constants.
12480
12481 2008-04-14 David S. Miller <davem@davemloft.net>
12482
12483 * sparc.cc: New file.
12484 * Makefile.am (TARGETSOURCES): Add sparc.cc
12485 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12486 * configure.tgt: Document targ_extra_size and
12487 targ_extra_big_endian. Add entries for sparc-* and
12488 sparc64-*.
12489 * configure.ac: Handle targ_extra_size and
12490 targ_extra_big_endian.
12491 * Makefile.in: Rebuild.
12492 * configure: Likewise.
12493 * po/POTFILES.in: Likewise.
12494 * po/gold.pot: Likewise.
12495
12496 2008-04-14 Ian Lance Taylor <iant@google.com>
12497
12498 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12499 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12500 in the name/type/flags to section mapping. Don't call
12501 allocate_output_section.
12502 (Layout::choose_output_section): Change parameter from adjust_name
12503 to is_input_section. Don't permit input sections after sections
12504 are attached to segments. Don't call allocate_output_section.
12505 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12506 not write_enable_output_section.
12507 (Layout::make_output_section): Don't push to
12508 unattached_section_list_ nor call attach_to_segment. Call
12509 attach_section_to_segment if sections are attached.
12510 (Layout::attach_sections_to_segments): New function.
12511 (Layout::attach_section_to_segment): New function.
12512 (Layout::attach_allocated_section_to_segment): Rename from
12513 attach_to_segment. Remove flags parameter.
12514 (Layout::allocate_output_section): Remove function.
12515 (Layout::write_enable_output_section): Remove function.
12516 * layout.h (class Layout): Update for above changes. Add new
12517 field sections_are_attached_.
12518 * output.h (Output_section::update_flags_for_input_section): New
12519 function.
12520 * output.cc (Output_section::add_input_section): Call
12521 update_flags_for_input_section.
12522 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12523
12524 2008-04-11 Cary Coutant <ccoutant@google.com>
12525
12526 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12527 thought unnecessary.
12528 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12529
12530 2008-04-11 Ian Lance Taylor <iant@google.com>
12531
12532 * output.h (class Output_section_data): Remove inline definition
12533 of set_addralign.
12534 * output.cc (Output_section_data::set_addralign): New function.
12535
12536 2008-04-11 Cary Coutant <ccoutant@google.com>
12537
12538 Add support for TLS descriptors for i386 and x86_64.
12539 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12540 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12541 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12542 GOT_TYPE_TLS_DESC.
12543 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12544 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12545 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12546 relocations.
12547 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12548 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12549 Fix problem with initial-exec relocations.
12550 (Target_i386::Relocate::relocate_tls): Likewise.
12551 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12552 relaxation.
12553 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12554 support for section-plus-offset dynamic table entries.
12555 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12556 (Output_data_dynamic::Dynamic_entry): Add support for
12557 section-plus-offset dynamic table entries.
12558 (Output_data_dynamic::Classification): Likewise.
12559 (Output_data_dynamic::classification_): Renamed offset_.
12560 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12561 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12562 (Target_x86_64::make_plt_section): New function.
12563 (Target_x86_64::reserve_tlsdesc_entries): New function.
12564 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12565 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12566 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12567 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12568 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12569 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12570 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12571 add extra PLT entry for TLS descriptors.
12572 (Output_data_plt_x86_64::got_): New field.
12573 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12574 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12575 fields.
12576 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12577 descriptors.
12578 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12579 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12580 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12581 R_386_TLS_DESC_CALL relocations.
12582 (Target_x86_64::Scan::global): Likewise.
12583 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12584 for TLS descriptors.
12585 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12586 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12587 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12588 GD-to-IE relaxation.
12589 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12590 and TLS_DESCRIPTORS.
12591 * Makefile.in: Rebuild.
12592 * configure: Rebuild.
12593 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12594 (tls_test_shared2.so): New target.
12595 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12596 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12597 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12598 (tls_shared_gd_to_ie_test_LDADD): New variable.
12599 (tls_shared_gnu2_gd_to_ie_test): New target.
12600 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12601 New targets.
12602 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12603 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12604 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12605 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12606 (tls_shared_gnu2_test): New target.
12607 (tls_test_gnu2_shared.so): New target.
12608 (tls_shared_gnu2_test_SOURCES): New variable.
12609 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12610 (tls_shared_gnu2_test_LDFLAGS): New variable.
12611 (tls_shared_gnu2_test_LDADD): New variable.
12612 * testsuite/Makefile.in: Rebuild.
12613 * testsuite/Makefile.
12614
12615 2008-04-11 Ian Lance Taylor <iant@google.com>
12616
12617 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12618 justsyms.t.
12619 * testsuite/Makefile.in: Rebuild.
12620
12621 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12622 long.
12623 * testsuite/script_test_2.cc (main): Adjust test.
12624
12625 2008-04-11 David S. Miller <davem@davemloft.net>
12626 Ian Lance Taylor <iant@google.com>
12627
12628 * options.h (General_options): Add entries for '-Y' and
12629 '-relax'.
12630 * options.cc (General_options:finalize): If -Y was used, add those
12631 entries to the library path instead of the default "/lib" and
12632 "/usr/lib".
12633
12634 2008-04-11 David S. Miller <davem@davemloft.net>
12635
12636 * testsuite/justsyms.t: Start at 0x100.
12637 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12638 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12639 long.
12640 * testsuite/script_test_2.cc: Adjust string and section length
12641 checks.
12642
12643 2008-04-09 Ian Lance Taylor <iant@google.com>
12644
12645 PR gold/5996
12646 * script-sections.cc (Sections_element::allocate_to_segment): Add
12647 orphan parameter.
12648 (Output_section_definition::allocate_to_segment): Likewise.
12649 (Orphan_output_section::allocate_to_segment): Likewise.
12650 (Script_sections::attach_sections_using_phdrs_clause): Don't
12651 propagate non-PT_LOAD segments to orphan sections.
12652 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12653 readelf rather than objdump.
12654 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12655 .interp section and PT_INTERP segment are the same size.
12656 * testsuite/Makefile.in: Rebuild.
12657
12658 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12659 aliases for symbols defined in the same object.
12660 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12661 (weak_alias_test_SOURCES): New variable.
12662 (weak_alias_test_DEPENDENCIES): New variable.
12663 (weak_alias_test_LDFLAGS): New variable.
12664 (weak_alias_test_LDADD): New variable.
12665 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12666 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12667 (weak_alias_test_3.o): New target.
12668 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12669 * testsuite/weak_alias_test_main.cc: New file.
12670 * testsuite/weak_alias_test_1.cc: New file.
12671 * testsuite/weak_alias_test_2.cc: New file.
12672 * testsuite/weak_alias_test_3.cc: New file.
12673
12674 2008-04-08 Ian Lance Taylor <iant@google.com>
12675
12676 * options.h (class General_options): Add --noinhibit-exec option.
12677 * main.cc (main): Check --noinhibit-exec.
12678
12679 * options.h (class General_options): Define --wrap as a special
12680 option. Add wrap_symbols_ field.
12681 (General_options::any_wrap_symbols): New function.
12682 (General_options::is_wrap_symbol): New function.
12683 * options.cc (General_options::parse_wrap): New function.
12684 (General_options::General_options): Initialize wrap_symbols_.
12685 * symtab.cc (Symbol_table::wrap_symbol): New function.
12686 (Symbol_table::add_from_object): Handle --wrap.
12687 * symtab.h (class Symbol_table): Declare wrap_symbol.
12688 * target.h (Target::wrap_char): New function.
12689 (Target::Target_info): Add wrap_char field.
12690 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12691 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12692 * testsuite/testfile.cc (Target_test::test_target_info):
12693 Likewise.
12694
12695 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12696 there is one.
12697
12698 * layout.h (class Layout): Add added_eh_frame_data_ field.
12699 * layout.cc (Layout::Layout): Initialize new field.
12700 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12701 output section until we find a section we merged successfully.
12702 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12703 that the size be non-zero.
12704
12705 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12706 qualifier.
12707
12708 2008-04-08 Craig Silverstein <csilvers@google.com>
12709
12710 * configure.ac: Export new conditional variable HAVE_ZLIB.
12711 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12712 on HAVE_ZLIB.
12713 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12714 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12715
12716 2008-04-07 Ian Lance Taylor <iant@google.com>
12717
12718 * version.cc (version_string): Set to "1.5".
12719
12720 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12721 Add issued_non_pic_error_ field. Declare check_non_pic.
12722 (Target_x86_64::Scan::check_non_pic): New function.
12723 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12724 (Target_x86_64::Scan::global): Likewise.
12725
12726 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12727 addend parameter. Change caller. Handle merge sections.
12728 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12729 Address to Addend. Don't add in the result of
12730 local_section_offset, pass down the addend and use the returned
12731 value.
12732 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12733 Update declarations of local_section_offset and symbol_value.
12734 * testsuite/two_file_test_1.cc (t18): New function.
12735 * testsuite/two_file_test_2.cc (f18): New function.
12736 * testsuite/two_file_test_main.cc (main): Call t18.
12737 * testsuite/two_file_test.h (t18, f18): Declare.
12738
12739 * configure.ac: Don't test for objdump, c++filt, or readelf.
12740 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12741 conditionals.
12742 (TEST_READELF): New variable.
12743 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12744 (check_PROGRAMS): Add two_file_strip_test.
12745 (two_file_strip_test): New target.
12746 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12747 (two_file_same_shared_strip_test_SOURCES): New variable.
12748 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12749 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12750 (two_file_same_shared_strip_test_LDADD): New variable.
12751 (two_file_shared_strip.so): New target.
12752 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12753 (ver_test_5.syms, ver_test_7.syms): Likewise.
12754 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12755 (strip_test_3.stdout): Use TEST_OBJDUMP.
12756 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12757
12758 2008-04-04 Cary Coutant <ccoutant@google.com>
12759
12760 * symtab.h (Symbol::is_weak_undefined): New function.
12761 (Symbol::is_strong_undefined): New function.
12762 (Symbol::is_absolute): New function.
12763 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12764 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12765 absolute symbols.
12766 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12767 (weak_undef_test): New target.
12768 * testsuite/Makefile.in: Rebuild.
12769 * testsuite/weak_undef_file1.cc: New file.
12770 * testsuite/weak_undef_file2.cc: New file.
12771 * testsuite/weak_undef_test.cc: New file.
12772
12773 2008-04-03 Craig Silverstein <csilvers@google.com>
12774
12775 * compressed_output.h (class Output_compressed_section): Use
12776 unsigned buffer.
12777 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12778 add zlib header.
12779 (zlib_compressed_suffix): Removed.
12780 (Output_compressed_section::set_final_data_size): Use unsigned
12781 buffers.
12782 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12783 Fix linker invocation.
12784 (flagstest_o_specialfile_and_compress_debug_sections):
12785 Likewise.
12786 * testsuite/Makefile.in: Regenerated.
12787
12788 2008-04-02 David S. Miller <davem@davemloft.net>
12789
12790 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12791 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12792
12793 2008-04-02 Craig Silverstein <csilvers@google.com>
12794
12795 * TODO: New file.
12796
12797 2008-04-02 Ian Lance Taylor <iant@google.com>
12798
12799 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12800 parameters. Update for new key type to views_. Change all
12801 callers.
12802 (File_read::read): Adjust for byteshift in returned view.
12803 (File_read::add_view): New function, broken out of
12804 find_and_make_view.
12805 (File_read::make_view): New function, broken out of
12806 find_and_make_view.
12807 (File_read::find_or_make_view): Add offset and aligned
12808 parameters. Rewrite accordingly. Change all callers.
12809 (File_read::get_view): Add offset and aligned parameters. Adjust
12810 for byteshift in return value.
12811 (File_read::get_lasting_view): Likewise.
12812 * fileread.h (class File_read): Update declarations.
12813 (class File_read::View): Add byteshift_ field. Add byteshift to
12814 constructor. Add byteshift method.
12815 * archive.h (Archive::clear_uncached_views): New function.
12816 (Archive::get_view): Add aligned parameter. Change all callers.
12817 * object.h (Object::get_view): Add aligned parameter. Change all
12818 callers.
12819 (Object::get_lasting_view): Likewise.
12820
12821 * fileread.cc (File_read::release): Don't call clear_views if
12822 there are multiple objects.
12823 * fileread.h (File_read::clear_uncached_views): New function.
12824 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12825 on the archive.
12826
12827 2008-03-31 Cary Coutant <ccoutant@google.com>
12828
12829 Add thin archive support.
12830 * archive.cc (Archive::armagt): New const.
12831 (Archive::setup): Remove task parameter and calls to unlock.
12832 (Archive::unlock_nested_archives): New function.
12833 (Archive::read_header): Add nested_off parameter. Change
12834 all callers.
12835 (Archive::interpret_header): Likewise.
12836 (Archive::include_all_members): Change to handle thin
12837 archives.
12838 (Archive::include_member): Likewise.
12839 * archive.h (Archive::Archive): Add new parameters and
12840 initializers.
12841 (Archive::armagt): New const.
12842 (Archive::setup): Remove task parameter.
12843 (Archive::unlock_nested_archives): New function.
12844 (Archive::read_header): Add nested_off parameter.
12845 (Archive::interpret_header): Likewise.
12846 (Archive::Nested_archive_table): New typedef.
12847 (Archive::is_thin_archive_): New field.
12848 (Archive::nested_archives_): New field.
12849 (Archive::options_): New field.
12850 (Archive::dirpath_): New field.
12851 (Archive::task_): New field.
12852 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12853 for thin archives. Pass additional parameters to
12854 Archive::Archive. Unlock the archive file after calling
12855 Archive::setup.
12856
12857 2008-03-29 Ian Lance Taylor <iant@google.com>
12858
12859 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12860 version symbol to be local.
12861 * testsuite/ver_test_4.sh: New file.
12862 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12863 (check_DATA): Add ver_test_4.syms.
12864 (ver_test_4.syms): New target.
12865 * testsuite/Makefile.in: Rebuild.
12866
12867 * output.cc
12868 (Output_section::Input_section_sort_entry::has_priority): New
12869 function.
12870 (Output_section::Input_section_sort_entry::match_file_name): New
12871 function.
12872 (Output_section::Input_section_sort_entry::match_section_name):
12873 Remove.
12874 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12875 Remove.
12876 (Output_section::Input_section_sort_entry::match_section_file):
12877 Remove.
12878 (Output_section::Input_section_sort_compare::operator()): Rewrite
12879 using new Input_section_sort_entry functions. Sort crtbegin and
12880 crtend first. Sort sections with no priority before sections with
12881 a priority.
12882 * testsuite/initpri1.c (d3): Check j != 4.
12883 (cd5): New constructor/destructor function.
12884 (main): Check j != 2.
12885
12886 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12887 new symbol when resolving, don't call set_is_default.
12888 * testsuite/ver_test_7.cc: New file.
12889 * testsuite/ver_test_7.sh: New file.
12890 * testsuite/Makefile.am (ver_test_7.so): New target.
12891 (ver_test_7.o): New target.
12892 (check_SCRIPTS): Add ver_test_7.sh.
12893 (check_DATA): Add ver_test_7.syms.
12894 (ver_test_7.syms): New target.
12895
12896 2008-03-28 Ian Lance Taylor <iant@google.com>
12897
12898 * layout.cc (Layout::layout): If we see an input section with a
12899 name that needs sorting, set the must_sort flag for the output
12900 section.
12901 (Layout::make_output_section): If the name of the output section
12902 indicates that it might require sorting, set the may_sort flag.
12903 * output.h (Output_section::may_sort_attached_input_sections): New
12904 function.
12905 (Output_section::set_may_sort_attached_input_sections): New
12906 function.
12907 (Output_section::must_sort_attached_input_sections): New
12908 function.
12909 (Output_section::set_must_sort_attached_input_sections): New
12910 function.
12911 (class Output_section): Declare Input_section_sort_entry. Define
12912 Input_section_sort_compare. Declare
12913 sort_attached_input_sections. Add new fields:
12914 may_sort_attached_input_sections_,
12915 must_sort_attached_input_sections_,
12916 attached_input_sections_are_sorted_.
12917 * output.cc (Output_section::Output_section): Initialize new
12918 fields.
12919 (Output_section::add_input_section): Add an entry to
12920 input_sections_ if may_sort or must_sort are true.
12921 (Output_section::set_final_data_size): Call
12922 sort_attached_input_sections if necessary.
12923 (Output_section::Input_section_sort_entry): Define new class.
12924 (Output_section::Input_section_sort_compare::operator()): New
12925 function.
12926 (Output_section::sort_attached_input_sections): New function.
12927 * configure.ac: Check whether the compiler supports constructor
12928 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12929 * testsuite/initpri1.c: New file.
12930 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12931 CONSTRUCTOR_PRIORITY.
12932 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12933 (initpri1_LDFLAGS): New variable.
12934 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12935
12936 2008-03-27 Ian Lance Taylor <iant@google.com>
12937
12938 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12939 * testsuite/common_test_1.c: New file.
12940 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12941 (common_test_1_SOURCES): New variable.
12942 (common_test_1_DEPENDENCIES): New variable.
12943 (common_test_1_LDFLAGS): New variable.
12944
12945 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12946 and commons_ correctly when NAME/VERSION does not override
12947 NAME/NULL.
12948 * testsuite/ver_test_6.c: New file.
12949 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12950 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12951 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12952
12953 2008-03-26 Ian Lance Taylor <iant@google.com>
12954
12955 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12956 of an undefined symbol from a version script.
12957 * testsuite/Makefile.am (ver_test_5.so): New target.
12958 (ver_test_5.o): New target.
12959 (check_SCRIPTS): Add ver_test_5.sh.
12960 (check_DATA): Add ver_test_5.syms.
12961 (ver_test_5.syms): New target.
12962 * testsuite/ver_test_5.cc: New file.
12963 * testsuite/ver_test_5.script: New file.
12964 * testsuite/ver_test_5.sh: New file.
12965 * Makefile.in, testsuite/Makefile.in: Rebuild.
12966
12967 PR gold/5986
12968 Fix problems building gold with gcc 4.3.0.
12969 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12970 (gold_error_at_location, gold_warning_at_location): Use it.
12971 * configure.ac: Check whether we can compile and use a template
12972 function with a printf attribute.
12973 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12974 when jumping over bytes.
12975 * object.cc: Instantiate Object::read_section_data.
12976 * debug.h: Include <cstring>
12977 * dwarf_reader.cc: Include <algorithm>
12978 * main.cc: Include <cstring>.
12979 * options.cc: Include <cstring>.
12980 * output.cc: Include <cstring>.
12981 * script.cc: Include <cstring>.
12982 * script.h: Include <string>.
12983 * symtab.cc: Include <cstring> and <algorithm>.
12984 * target-select.cc: Include <cstring>.
12985 * version.cc: Include <string>.
12986 * testsuite/testmain.cc: Include <cstdlib>.
12987 * configure, config.in: Rebuild.
12988
12989 2008-03-25 Ian Lance Taylor <iant@google.com>
12990
12991 * options.cc: Include "../bfd/bfdver.h".
12992 (options::help): Print bug reporting address.
12993
12994 * version.cc (print_version): Adjust output for current value of
12995 BFD_VERSION_STRING.
12996
12997 * NEWS: New file.
12998
12999 * options.cc (options::help): Print list of supported targets.
13000 * target-select.h: Include <vector>.
13001 (class Target_selector): Make machine_, size_, and is_big_endian_
13002 fields const. Add bfd_name_ and instantiated_target_ fields.
13003 (Target_selector::Target_selector): Add bfd_name parameter.
13004 (Target_selector::recognize): Make non-virtual, call
13005 do_recognize.
13006 (Target_selector::recognize_by_name): Make non-virtual, call
13007 do_recognize_by_name.
13008 (Target_selector::supported_names): New function.
13009 (Target_selector::bfd_name): New function.
13010 (Target_selector::do_instantiate_target): New pure virtual
13011 function.
13012 (Target_selector::do_recognize): New virtual function.
13013 (Target_selector::do_recognize_by_name): New virtual function.
13014 (Target_selector::instantiate_target): New private function.
13015 (supported_target_names): Declare.
13016 * target-select.cc (Target_selector::Target_selector): Update for
13017 new parameter and fields.
13018 (select_target_by_name): Check that the name matches before
13019 calling recognize_by_name.
13020 (supported_target_names): New function.
13021 * i386.cc (class Target_selector_i386): Update Target_selector
13022 constructor call. Remove recognize and recognize_by_name. Add
13023 do_instantiate_target.
13024 * x86_64.cc (class Target_selector_x86_64): Likewise.
13025 * testsuite/testfile.cc (class Target_selector_test): Update for
13026 changes to Target_selector.
13027
13028 * README: Rewrite, with some notes on unsupported features.
13029
13030 2008-03-24 Cary Coutant <ccoutant@google.com>
13031
13032 * i386.cc (Target_i386::Got_type): New enum declaration.
13033 (Target_i386::Scan::local): Updated callers of Output_data_got
13034 member functions.
13035 (Target_i386::Scan::global): Likewise.
13036 (Target_i386::Relocate::relocate): Likewise.
13037 (Target_i386::Relocate::relocate_tls): Likewise.
13038 * object.h (Got_offset_list): New class.
13039 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13040 (Sized_relobj::local_got_offset): Likewise.
13041 (Sized_relobj::set_local_got_offset): Likewise.
13042 (Sized_relobj::local_has_tls_got_offset): Removed.
13043 (Sized_relobj::local_tls_got_offset): Removed.
13044 (Sized_relobj::set_local_tls_got_offset): Removed.
13045 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13046 * output.cc (Output_data_got::add_global): Added got_type parameter.
13047 (Output_data_got::add_global_with_rel): Likewise.
13048 (Output_data_got::add_global_with_rela): Likewise.
13049 (Output_data_got::add_global_pair_with_rel): New function.
13050 (Output_data_got::add_global_pair_with_rela): New function.
13051 (Output_data_got::add_local): Added got_type parameter.
13052 (Output_data_got::add_local_with_rel): Likewise.
13053 (Output_data_got::add_local_with_rela): Likewise.
13054 (Output_data_got::add_local_pair_with_rel): New function.
13055 (Output_data_got::add_local_pair_with_rela): New function.
13056 (Output_data_got::add_global_tls): Removed.
13057 (Output_data_got::add_global_tls_with_rel): Removed.
13058 (Output_data_got::add_global_tls_with_rela): Removed.
13059 (Output_data_got::add_local_tls): Removed.
13060 (Output_data_got::add_local_tls_with_rel): Removed.
13061 (Output_data_got::add_local_tls_with_rela): Removed.
13062 * output.h (Output_data_got::add_global): Added got_type parameter.
13063 (Output_data_got::add_global_with_rel): Likewise.
13064 (Output_data_got::add_global_with_rela): Likewise.
13065 (Output_data_got::add_global_pair_with_rel): New function.
13066 (Output_data_got::add_global_pair_with_rela): New function.
13067 (Output_data_got::add_local): Added got_type parameter.
13068 (Output_data_got::add_local_with_rel): Likewise.
13069 (Output_data_got::add_local_with_rela): Likewise.
13070 (Output_data_got::add_local_pair_with_rel): New function.
13071 (Output_data_got::add_local_pair_with_rela): New function.
13072 (Output_data_got::add_global_tls): Removed.
13073 (Output_data_got::add_global_tls_with_rel): Removed.
13074 (Output_data_got::add_global_tls_with_rela): Removed.
13075 (Output_data_got::add_local_tls): Removed.
13076 (Output_data_got::add_local_tls_with_rel): Removed.
13077 (Output_data_got::add_local_tls_with_rela): Removed.
13078 * resolve.cc (Symbol::override_base_with_special): Removed
13079 reference to has_got_offset_ field.
13080 * symtab.cc (Symbol::init_fields): Replaced initialization
13081 of got_offset_ with got_offsets_. Removed initialization
13082 of has_got_offset_
13083 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13084 (Symbol::got_offset): Likewise.
13085 (Symbol::set_got_offset): Likewise.
13086 (Symbol::has_tls_got_offset): Removed.
13087 (Symbol::tls_got_offset): Removed.
13088 (Symbol::set_tls_got_offset): Removed.
13089 (Symbol::got_offset_): Removed.
13090 (Symbol::tls_mod_got_offset_): Removed.
13091 (Symbol::tls_pair_got_offset_): Removed.
13092 (Symbol::got_offsets_): New field.
13093 (Symbol::has_got_offset): Removed.
13094 (Symbol::has_tls_mod_got_offset): Removed.
13095 (Symbol::has_tls_pair_got_offset): Removed.
13096 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13097 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13098 member functions.
13099 (Target_x86_64::Scan::global): Likewise.
13100 (Target_x86_64::Relocate::relocate): Likewise.
13101 (Target_x86_64::Relocate::relocate_tls): Likewise.
13102
13103 2008-03-25 Ben Elliston <bje@au.ibm.com>
13104
13105 * yyscript.y: Fix spelling error in comment.
13106
13107 2008-03-24 Ian Lance Taylor <iant@google.com>
13108
13109 * options.h (class General_options): Define build_id option.
13110 * layout.h (class Layout): Declare write_build_id, create_note,
13111 create_build_id. Add build_id_note_ member.
13112 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13113 "libiberty.h", "md5.h", "sha1.h".
13114 (Layout::Layout): Initialize eh_frame_data_,
13115 eh_frame_hdr_section_, and build_id_note_.
13116 (Layout::finalize): Call create_build_id.
13117 (Layout::create_note): New function, broken out of
13118 Layout::create_gold_note.
13119 (Layout::create_gold_note): Call create_note.
13120 (Layout::create_build_id): New function.
13121 (Layout::write_build_id): New function.
13122 (Close_task_runner::run): Call write_build_id.
13123
13124 * x86_64.cc: Correct license to GPLv3.
13125
13126 2008-03-23 Ian Lance Taylor <iant@google.com>
13127
13128 * options.cc: Include "demangle.h".
13129 (parse_optional_string): New function.
13130 (parse_long_option): Handle takes_optional_argument.
13131 (parse_short_option): Update dash_z initializer. Handle
13132 takes_optional_argument.
13133 (General_options::General_options): Initialize do_demangle_.
13134 (General_options::finalize): Set do_demangle_. Handle demangling
13135 style.
13136 * options.h (parse_optional_string): Declare.
13137 (struct One_option): Add optional_arg field. Update constructor.
13138 Update call constructor calls. Add takes_optional_argument
13139 function.
13140 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13141 (DEFINE_optional_string): Define.
13142 (General_options::demangle): Change from DEFINE_bool to
13143 DEFINE_optional_string.
13144 (General_options::no_demangle): New function.
13145 (General_options::do_demangle): New function.
13146 (General_options::set_do_demangle): New function.
13147 (General_options::execstack_status_): Move definition to end of
13148 class definition.
13149 (General_options::static_): Likewise.
13150 (General_options::do_demangle_): New field.
13151 * object.cc (big_endian>::get_symbol_location_info): Call
13152 Options::do_demangle, not Options::demangle.
13153 * symtab.cc (demangle): Likewise.
13154
13155 2008-03-22 Ian Lance Taylor <iant@google.com>
13156
13157 * gold.h: Include <cstddef> and <sys/types.h>
13158 * options.h: Include <cstring>.
13159
13160 2008-03-21 Ian Lance Taylor <iant@google.com>
13161
13162 * Added source code to GNU binutils.
This page took 0.333322 seconds and 5 git commands to generate.