* macroexp.c (macro_stringify): Terminate the string.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
df7b86aa
NC
12012-05-17 Daniel Richard G. <skunk@iskunk.org>
2 Nick Clifton <nickc@redhat.com>
3
4 PR 14072
5 * configure.in: Add check that sysdep.h has been included before
6 any system header files.
7 * configure: Regenerate.
8 * config.in: Regenerate.
9
1007b503
CC
102012-05-14 Cary Coutant <ccoutant@google.com>
11
12 * layout.cc (Layout::make_output_section): Mark .tdata section
13 as RELRO.
14 * testsuite/relro_test.cc: Add a TLS variable.
15
fd885f3a
L
162012-05-10 H.J. Lu <hongjiu.lu@intel.com>
17
18 PR gold/14091
19 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
20 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
21 R_X86_64_64.
22
80f5885c
CC
232012-05-08 Cary Coutant <ccoutant@google.com>
24
25 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
26 (lines_only_debug_sections): Likewise.
27
2e702c99
RM
282012-05-02 Roland McGrath <mcgrathr@google.com>
29
30 * nacl.cc: New file.
31 * nacl.h: New file.
32 * Makefile.am (CCFILES, HFILES): Add them.
33 * Makefile.in: Regenerate.
34 * i386.cc (Output_data_plt_i386_nacl): New class.
35 (Output_data_plt_i386_nacl_exec): New class.
36 (Output_data_plt_i386_nacl_dyn): New class.
37 (Target_i386_nacl): New class.
38 (Target_selector_i386_nacl): New class.
39 (target_selector_i386): Use it instead of Target_selector_i386.
40 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
41 (Target_x86_64_nacl): New class.
42 (Target_selector_x86_64_nacl): New class.
43 (target_selector_x86_64, target_selector_x32): Use it instead of
44 Target_selector_x86_64.
45 * arm.cc (Output_data_plt_arm_nacl): New class.
46 (Target_arm_nacl): New class.
47 (Target_selector_arm_nacl): New class.
48 (target_selector_arm, target_selector_armbe): Use it instead of
49 Target_selector_arm.
50
51 * target-select.cc (select_target): Take new Input_file* and off_t
52 arguments, pass them on to recognize method of selector.
53 * object.cc (make_elf_sized_object): Update caller.
54 * parameters.cc (parameters_force_valid_target): Likewise.
55 * incremental.cc (make_sized_incremental_binary): Likewise.
56 * target-select.h: Update decl.
57 (Target_selector::recognize): Take new Input_file* argument,
58 pass it on to do_recognize.
59 (Target_selector::do_recognize): Take new Input_file* argument.
60 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
61 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
62 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
63 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
64
65 * target.h (Target::Target_info): New members isolate_execinstr
66 and rosegment_gap.
67 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
68 * arm.cc (Target_arm::arm_info): Update initializer.
69 * i386.cc (Target_i386::i386_info): Likewise.
70 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
71 * sparc.cc (Target_sparc::sparc_info): Likewise.
72 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
73 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
74 * layout.cc (Layout::attach_allocated_section_to_segment):
75 Take new const Target* argument. If target->isolate_execinstr(), act
76 like --rosegment.
77 (Layout::find_first_load_seg): Take new const Target* argument;
78 if target->isolate_execinstr(), reject PF_X segments.
79 (Layout::relaxation_loop_body): Update caller.
80 (Layout::set_segment_offsets): If target->isolate_execinstr(),
81 reset file offset to zero when we hit LOAD_SEG, and then do a second
82 loop over the segments before LOAD_SEG to reassign offsets after
83 addresses have been determined. Handle target->rosegment_gap().
84 (Layout::attach_section_to_segment): Take new const Target* argument;
85 pass it to attach_allocated_section_to_segment.
86 (Layout::make_output_section): Update caller.
87 (Layout::attach_sections_to_segments): Take new const Target* argument;
88 pass it to attach_section_to_segment.
89 * gold.cc (queue_middle_tasks): Update caller.
90 * layout.h (Layout): Update method decls with new arguments.
91
92 * arm.cc (Target_arm::Target_arm): Take optional argument for the
93 Target_info pointer to use.
94 (Target_arm::do_make_data_plt): New virtual method.
95 (Target_arm::make_data_plt): New method that calls it.
96 (Target_arm::make_plt_entry): Use it.
97 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
98 for the section alignment.
99 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
100 method.
101 (Output_data_plt_arm::first_plt_entry_offset): Call it.
102 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
103 method.
104 (Output_data_plt_arm::get_plt_entry_size): Call it.
105 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
106 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
107 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
108 method.
109 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
110 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
111 method instead of sizeof(plt_entry).
112 (Output_data_plt_arm::add_entry): Likewise.
113 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
114 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
115 than static method.
116 (Target_arm::plt_entry_size): Likewise.
117 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
118 Move to ...
119 (Output_data_plt_arm_standard): ... here, new class.
120 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
121 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
122 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
123
124 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
125 Take additional argument for the PLT entry size.
126 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
127 Use get_plt_entry_size method rather than plt_entry_size variable.
128 (Output_data_plt_x86_64::reserve_slot): Likewise.
129 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
130 (Output_data_plt_x86_64::add_entry): Likewise.
131 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
132 (Output_data_plt_x86_64::address_for_global): Likewise.
133 (Output_data_plt_x86_64::address_for_local): Likewise.
134 (Output_data_plt_x86_64::set_final_data_size): Likewise.
135 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
136 Make method non-static.
137 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
138 method.
139 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
140 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
141 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
142 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
143 virtual method.
144 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
145 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
146 virtual method.
147 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
148 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
149 virtual method.
150 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
151 (Output_data_plt_x86_64::plt_entry_size)
152 (Output_data_plt_x86_64::first_plt_entry)
153 (Output_data_plt_x86_64::plt_entry)
154 (Output_data_plt_x86_64::tlsdesc_plt_entry)
155 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
156 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
157 (Output_data_plt_x86_64_standard): ... here, new class.
158 (Target_x86_64::Target_x86_64): Take optional argument for the
159 Target_info pointer to use.
160 (Target_x86_64::do_make_data_plt): New virtual method.
161 (Target_x86_64::make_data_plt): New method to call it.
162 (Target_x86_64::init_got_plt_for_update): Use that.
163 Call this->plt_->add_eh_frame method here.
164 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
165 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
166 rather than static method.
167 (Target_x86_64::plt_entry_size): Likewise.
168 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
169 rather than plt_entry_size variable. Move guts of PLT filling to...
170 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
171 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
172 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
173
174 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
175 additional argument for the section alignment.
176 Don't do add_eh_frame_for_plt here.
177 (Output_data_plt_i386::first_plt_entry_offset): Make the method
178 non-static. Use get_plt_entry_size method rather than plt_entry_size
179 variable.
180 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
181 method.
182 (Output_data_plt_i386::get_plt_entry_size): Call it.
183 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
184 (Output_data_plt_i386::add_eh_frame): New method to call it.
185 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
186 method.
187 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
188 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
189 method.
190 (Output_data_plt_i386::fill_plt_entry): New method to call it.
191 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
192 method instead of plt_entry_size.
193 (Output_data_plt_i386::plt_entry_size)
194 (Output_data_plt_i386::plt_eh_frame_fde_size)
195 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
196 (Output_data_plt_i386_standard): ... here, new class.
197 (Output_data_plt_i386_exec): New class.
198 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
199 (Output_data_plt_i386_exec::first_plt_entry): ... here.
200 (Output_data_plt_i386::exec_plt_entry): Move to ...
201 (Output_data_plt_i386_exec::plt_entry): ... here.
202 (Output_data_plt_i386_dyn): New class.
203 (Output_data_plt_i386::first_plt_entry): Move to ...
204 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
205 (Output_data_plt_i386::dyn_plt_entry): Move to ...
206 (Output_data_plt_i386_dyn::plt_entry): ... here.
207 (Target_i386::Target_i386): Take optional argument for the Target_info
208 pointer to use.
209 (Target_i386::do_make_data_plt): New virtual method.
210 (Target_i386::make_data_plt): New method to call it.
211 (Target_i386::make_plt_section): Use that.
212 Call this->plt_->add_eh_frame method here.
213 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
214 rather than plt_entry_size variable.
215 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
216 (Output_data_plt_i386::address_for_local): Likewise.
217 (Output_data_plt_i386::do_write): Likewise.
218 Move guts of PLT filling to...
219 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
220 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
221 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
222 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
223
b9b9f2ee
CC
2242012-05-01 Cary Coutant <ccoutant@google.com>
225
226 * dwarf_reader.cc (Dwarf_die::read_attributes)
227 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
228 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
229 * reduced_debug_output.cc
230 (Output_reduced_debug_info_section::get_die_end): Remove
231 DW_FORM_GNU_ref_index. Add default case.
232
57923f48
MW
2332012-04-26 Mark Wielaard <mjw@redhat.com>
234
235 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
236 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
237 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
238 DW_AT_high_pc as offset from DW_AT_low_pc.
239
240 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
241 * testsuite/Makefile.in: Regenerate.
242 * testsuite/gdb_index_test_3.c: New test source file.
243 * testsuite/gdb_index_test_3.sh: New test source file.
244
2c54b4f4
ILT
2452012-04-25 Ian Lance Taylor <iant@google.com>
246
247 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
248 pointer.
249 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
250 as a class, not a struct.
251 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
252 (Target_arm::apply_cortex_a8_workaround): Likewise.
253 * gc.h: Declare Reloc_types as a struct, not a class.
254 * object.h: Declare Symbols_data as a struct.
255 * reloc.h: Declare Read_relocs_data as a struct.
256 * target.h: Declare Relocate_info as a struct.
257
a5a5f7a3
DM
2582012-04-24 David S. Miller <davem@davemloft.net>
259
260 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
261 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
262 and R_SPARC_WPLT30.
263
f038d496
CC
2642012-04-24 Cary Coutant <ccoutant@google.com>
265
266 * incremental-dump.cc (find_input_containing_global): Replace
267 magic number with symbolic constant.
268 (dump_incremental_inputs): Update version number.
269 * incremental.cc (Output_section_incremental_inputs): Update version
270 number; import symbolic constants from Incremental_inputs_reader.
271 (Incremental_inputs::create_data_sections): Align relocations
272 section correctly for 64-bit targets.
273 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
274 constants; add padding.
275 (Output_section_incremental_inputs::write_header): Add assert for
276 header_size.
277 (Output_section_incremental_inputs::write_input_files): Add assert
278 for input_entry_size.
279 (Output_section_incremental_inputs::write_info_blocks): Add padding;
280 add assert for object_info_size, input_section_entry_size,
281 global_sym_entry_size.
282 * incremental.h (Incremental_inputs_reader): Add symbolic constants
283 for data structure sizes; use them.
284 (Incremental_input_entry_reader): Import symbolic constants from
285 Incremental_inputs_reader; use them.
286
a4d85145
DM
2872012-04-23 David S. Miller <davem@davemloft.net>
288
289 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
290 and elf_flags_set_.
291 (Target_sparc::Target_sparc): Initialize new fields.
292 (Target_sparc::do_make_elf_object): New function.
293 (Target_sparc::do_adjust_elf_header): New function.
294
1d509098
CC
2952012-04-23 Cary Coutant <ccoutant@google.com>
296
297 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
298 CU range table of gdb index.
299
7ebeff7f
DM
3002012-04-20 David S. Miller <davem@davemloft.net>
301
302 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
303 instead of false.
304
13cf9988
DM
3052012-04-16 David S. Miller <davem@davemloft.net>
306
2a1079e8
DM
307 * sparc.cc (Target_sparc::got_address): New function.
308 (Sparc_relocate_functions::gdop_hix22): New function.
309 (Sparc_relocate_functions::gdop_lox10): New function.
310 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
311 relocs.
312 (Target_sparc::Scan::local): Likewise if the global symbol is not
313 preemptible and is not IFUNC.
314 (Target_sparc::Relocate::relocate): Perform GOTDATA code
315 transformations for local and non-preemptible non-IFUNC global
316 symbols.
317
0bc964fc
DM
318 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
319 writing out 64-bit part of ranges.
320
661d7a80
DM
321 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
322 -fpic and -fpie respectively.
323 * Makefile.in: Regenerate.
324
8c2bf391
DM
325 * sparc.cc (class Target_sparc): Add rela_ifunc_.
326 (Target_sparc::Target_sparc): Initialize new field.
327 (Target_sparc::do_plt_section_for_global): New function.
328 (Target_sparc::do_plt_section_for_local): New function.
329 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
330 (Target_sparc::make_plt_section): New function, broken out of
331 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
332 (Target_sparc::make_plt_entry): Call make_plt_section.
333 (Target_sparc::make_local_ifunc_plt_entry): New function.
334 (Target_sparc::rela_ifunc_section): New function.
335 (Target_sparc::plt_section): Remove const.
336 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
337 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
338 and ifunc_count_ fields.
339 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
340 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
341 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
342 (Output_data_plt_sparc::rela_ifunc): New function.
343 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
344 (Output_data_plt_sparc::has_ifunc_section): New function.
345 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
346 (Output_data_plt_sparc::address_for_global): New function.
347 (Output_data_plt_sparc::address_for_local): New function.
348 (Output_data_plt_sparc::plt_index_to_offset): New function.
349 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
350 and entry_count.
351 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
352 entry_count.
353 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
354 R_SPARC_JMP_IREL to switch.
355 (Target_sparc::Scan::check_non_pic): Likewise.
356 (Target_sparc::Scan::local): Handle IFUNC symbols.
357 (Target_sparc::Scan::local): Likewise.
358 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
359 and plt_address_for_local.
360 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
361 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
362
13cf9988
DM
363 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
364 (class Output_data_reloc): Adjust calls to Output_reloc_type.
365 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
366 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
367 global relocs too.
368 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
369 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
370 calls.
371 * sparc.cc (Target_sparc::Scan::global): Likewise.
372 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
373
31821be0
CC
3742012-04-16 Cary Coutant <ccoutant@google.com>
375
376 * archive.cc (Library_base::should_include_member): Check for
377 --export-dynamic-symbol.
378 * options.h (class General_options): Add --export-dynamic-symbol.
379 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
380 --export-dynamic-symbol.
381 (Symbol_table::gc_mark_undef_symbols): Likewise.
382 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
383
2615994e
DM
3842012-04-12 David S. Miller <davem@davemloft.net>
385
386 * sparc.cc (Reloc::wdisp10): New relocation method.
387 (Reloc::h34): Likewise.
388 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
389 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
390 R_SPARC_WDISP10.
391 (Target_sparc::Scan::local): Likewise.
392 (Target_sparc::Scan::global): Likewise.
393 (Target_sparc::Relocate::relocate): Likewise.
394
6782735d
CC
3952012-04-09 Cary Coutant <ccoutant@google.com>
396
397 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
398 low_pc == 0.
399
8c7a0b00
ILT
4002012-04-06 Ian Lance Taylor <iant@google.com>
401
402 * timer.cc: #include <unistd.h>.
403
58797674
RM
4042012-04-06 Roland McGrath <mcgrathr@google.com>
405
406 * configure.in (AC_CHECK_HEADERS): Add locale.h.
407 * config.in: Regenerate.
408 * configure: Regenerate.
409
44350750
NC
4102012-04-05 Nick Clifton <nickc@redhat.com>
411
412 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
413 (AM_LC_MESSAGES): Add.
414 * aclocal.m4: Regenerate.
415 * config.in: Regenerate.
416 * configure: Regenerate.
417
c1027032
CC
4182012-03-21 Cary Coutant <ccoutant@google.com>
419
420 * Makefile.am: Add gdb-index.cc, gdb-index.h.
421 * Makefile.in: Regenerate.
422 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
423 (Sized_elf_reloc_mapper::symbol_section): New function.
424 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
425 (make_elf_reloc_mapper): New function.
426 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
427 (Dwarf_abbrev_table::do_read_abbrevs): New function.
428 (Dwarf_abbrev_table::do_get_abbrev): New function.
429 (Dwarf_ranges_table::read_ranges_table): New function.
430 (Dwarf_ranges_table::read_range_list): New function.
431 (Dwarf_pubnames_table::read_section): New function.
432 (Dwarf_pubnames_table::read_header): New function.
433 (Dwarf_pubnames_table::next_name): New function.
434 (Dwarf_die::Dwarf_die): New function.
435 (Dwarf_die::read_attributes): New function.
436 (Dwarf_die::skip_attributes): New function.
437 (Dwarf_die::set_name): New function.
438 (Dwarf_die::set_linkage_name): New function.
439 (Dwarf_die::attribute): New function.
440 (Dwarf_die::string_attribute): New function.
441 (Dwarf_die::int_attribute): New function.
442 (Dwarf_die::uint_attribute): New function.
443 (Dwarf_die::ref_attribute): New function.
444 (Dwarf_die::child_offset): New function.
445 (Dwarf_die::sibling_offset): New function.
446 (Dwarf_info_reader::check_buffer): New function.
447 (Dwarf_info_reader::parse): New function.
448 (Dwarf_info_reader::do_parse): New function.
449 (Dwarf_info_reader::do_read_string_table): New function.
450 (Dwarf_info_reader::lookup_reloc): New function.
451 (Dwarf_info_reader::get_string): New function.
452 (Dwarf_info_reader::visit_compilation_unit): New function.
453 (Dwarf_info_reader::visit_type_unit): New function.
454 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
455 Sized_elf_reloc_mapper.
456 (Sized_dwarf_line_info::symbol_section): Remove function.
457 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
458 (Sized_dwarf_line_info::read_line_mappings): Remove object
459 parameter, adjust callers.
460 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
461 * dwarf_reader.h: Include <sys/types.h>.
462 (class Track_relocs): Remove forward declaration.
463 (class Elf_reloc_mapper): New class.
464 (class Sized_elf_reloc_mapper): New class.
465 (class Dwarf_abbrev_table): New class.
466 (class Dwarf_range_list): New class.
467 (class Dwarf_ranges_table): New class.
468 (class Dwarf_pubnames_table): New class.
469 (class Dwarf_die): New class.
470 (class Dwarf_info_reader): New class.
471 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
472 (Sized_dwarf_line_info::symbol_section): Remove member function.
473 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
474 base class.
475 * gdb-index.cc: New source file.
476 * gdb-index.h: New source file.
477 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
478 and .debug_types sections, call Layout::add_to_gdb_index.
479 (Sized_relobj_incr::do_section_name): Implement.
480 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
481 return type; Implement.
482 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
483 return type.
484 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
485 parameter list and return type.
486 (Sized_incr_dynobj::do_section_contents): Likewise.
487 * layout.cc: Include gdb-index.h.
488 (Layout::Layout): Initialize gdb_index_data_.
489 (Layout::init_fixed_output_section): Check for .gdb_index section.
490 (Layout::add_to_gdb_index): New function. Instantiate.
491 * layout.h: Add forward declaration for class Gdb_index.
492 (Layout::add_to_gdb_index): New member function.
493 (Layout::gdb_index_data_): New data member.
494 * main.cc: Include gdb-index.h.
495 (main): Print statistics for gdb index.
496 * object.cc (Object::section_contents): Move code into
497 do_section_contents.
498 (need_decompressed_section): Check for sections needed when building
499 gdb index.
500 (build_compressed_section_map): Likewise.
501 (Sized_relobj_file::do_read_symbols): Need local symbols when building
502 gdb index.
503 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
504 sections; call Layout::add_to_gdb_index.
505 (Sized_relobj_file::do_decompressed_section_contents): Call
506 do_section_contents directly.
507 * object.h (Object::do_section_contents): Adjust parameter list and
508 return type.
509 (Object::do_decompressed_section_contents): Call do_section_contents
510 directly.
511 (Sized_relobj_file::do_section_contents): Adjust parameter list and
512 return type.
513 * options.h (class General_options): Add --gdb-index option.
514 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
515 list and return type.
516 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
517 * reloc.h (Track_relocs::checkpoint): New function.
518 (Track_relocs::reset): New function.
519
520 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
521 New test cases.
522 * testsuite/Makefile.in: Regenerate.
523 * testsuite/gdb_index_test.cc: New test source file.
524 * testsuite/gdb_index_test_1.sh: New test source file.
525 * testsuite/gdb_index_test_2.sh: New test source file.
526
647f1574
DK
5272012-03-19 Doug Kwan <dougkwan@google.com>
528
529 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2e702c99 530 (Target_arm::do_finalize_sections): Remove code which defines
647f1574
DK
531 __exidx_start and __exidx_end. Make symbol table parameter
532 anonymous as it is not used.
533 * gold.cc (queue_middle_tasks): Call target hook to define any
534 target-specific symbols.
535 * target.h (Target::define_standard_symbols): New method.
536 (Target::do_define_standard_symbols): Same.
537 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
538 * testsuite/Makefile.in: Regenerate.
539 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
540 and __exidx_end.
541 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
542 relocations are generated for __exidx_start and __exidx_end.
543
7c6109da
DK
5442012-03-16 Doug Kwan <dougkwan@google.com>
545
546 * testsuite/Makefile.am: Disable test initpri3b.
547 * testsuite/Makefile.in: Regenerate.
548
7b8957f8
DK
5492012-03-15 Doug Kwan <dougkwan@google.com>
550
551 * arm.cc (Target_arm::got_section): Make .got section read-only
552 if -z now is given.
553
14dc9ef7
ILT
5542012-03-15 Ian Lance Taylor <iant@google.com>
555
556 PR gold/13850
557 * layout.cc (Layout::make_output_section): Correctly mark
558 SHT_INIT_ARRAY, et. al., as relro.
559
fa40b62a
DK
5602012-03-14 Doug Kwan <dougkwan@google.com>
561
562 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
563 dynamic relocations for protected symbols in shared objects.
564
fd325007
ILT
5652012-03-13 Ian Lance Taylor <iant@google.com>
566
567 * resolve.cc (Symbol_table::resolve): When merging common symbols,
568 keep the larger alignment.
569
e8dd54e1
CC
5702012-03-12 Cary Coutant <ccoutant@google.com>
571
572 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
573 handling of DW_LNE_define_file.
574
feb5f3b0
CC
5752012-03-12 Cary Coutant <ccoutant@google.com>
576
577 * reduced_debug_output.cc
578 (Output_reduced_debug_info_section::get_die_end): Add new FORM
579 codes to switch.
580
a1fb4256
CC
5812012-02-29 Cary Coutant <ccoutant@google.com>
582
583 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
584
5dd8762a
CC
5852012-02-29 Cary Coutant <ccoutant@google.com>
586
587 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
588 Call Object::decompressed_section_contents.
589 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
590 New dtor.
591 (Sized_dwarf_line_info::buffer_start_): New data member.
592 * merge.cc (Output_merge_data::do_add_input_section): Call
593 Object::decompressed_section_contents.
594 (Output_merge_string::do_add_input_section): Likewise.
595 * object.cc (need_decompressed_section): New function.
596 (build_compressed_section_map): Decompress sections needed later.
597 (Sized_relobj_file::do_decompressed_section_contents): New function.
598 (Sized_relobj_file::do_discard_decompressed_sections): New function.
599 * object.h (Object::decompressed_section_contents): New function.
600 (Object::discard_decompressed_sections): New function.
601 (Object::do_decompressed_section_contents): New function.
602 (Object::do_discard_decompressed_sections): New function.
603 (Compressed_section_info): New type.
604 (Compressed_section_map): Include decompressed section contents.
605 (Sized_relobj_file::do_decompressed_section_contents): New function.
606 (Sized_relobj_file::do_discard_decompressed_sections): New function.
607
7b5de7ee
CC
6082012-02-16 Cary Coutant <ccoutant@google.com>
609
610 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
611 * testsuite/Makefile.in: Regenerate.
612
f9fa4a63
CC
6132012-02-14 Cary Coutant <ccoutant@google.com>
614
615 * options.cc (General_options::finalize): Disallow -pie and -static.
616
2c175ebc
DK
6172012-02-03 Doug Kwan <dougkwan@google.com>
618
619 * arm.cc (Arm_relocate_functions::abs8,
620 Arm_relocate_functions::abs16): Use
621 Bits::has_signed_unsigned_overflow32.
622 (Arm_relocate_functions::thm_abs8): Correct range of
623 overflow check.
624 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
625 in assertions.
626
90cff06f
DK
6272012-02-02 Doug Kwan <dougkwan@google.com>
628
629 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
630 position independent outputs, not just shared objects.
631
63887f3d
L
6322012-01-30 H.J. Lu <hongjiu.lu@intel.com>
633
634 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
635 * configure: Regenerated.
636
bef2b434
ILT
6372012-01-27 Ian Lance Taylor <iant@google.com>
638
639 * reloc.h (Bits): New class with static functions, copied from
640 namespace utils in arm.cc.
641 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
642 instead.
643
c335b55d
L
6442012-01-27 H.J. Lu <hongjiu.lu@intel.com>
645
646 * incremental.cc (write_info_blocks): Correct relocation offset.
647
41194d9f
L
6482012-01-27 H.J. Lu <hongjiu.lu@intel.com>
649
650 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
651 (Relocate::tls_gd_to_le): Likewise.
652
1bae613c
L
6532012-01-27 H.J. Lu <hongjiu.lu@intel.com>
654
655 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
656
24482ca0
L
6572012-01-27 H.J. Lu <hongjiu.lu@intel.com>
658
659 * configure.ac: Check if -mcmodel=medium works.
660 * configure: Regenerated.
661
c2c7840a
CC
6622012-01-24 Cary Coutant <ccoutant@google.com>
663
664 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
665 definition and ...
666 (read_unsigned_LEB_128_x): ... this new function.
667 (read_signed_LEB_128): Replaced with inline definition and ...
668 (read_signed_LEB_128_x): ... this new function.
669 * int_encoding.h (read_unsigned_LEB_128_x): New function.
670 (read_unsigned_LEB_128): Add inline definition.
671 (read_signed_LEB_128_x): New function.
672 (read_signed_LEB_128): Add inline definition.
673 * testsuite/Makefile.am (leb128_unittest): New unit test.
674 * testsuite/Makefile.in: Regenerate.
675 * testsuite/leb128_unittest.cc: New unit test.
676
833de760 6772012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
678
679 PR gold/13617
680 * i386.cc (Target_i386::do_code_fill): When using a jmp
681 instruction, pad with nop instructions.
682 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
683
618d6666
L
6842012-01-22 H.J. Lu <hongjiu.lu@intel.com>
685
686 * x86_64.cc (gc_process_relocs): Add typename on types used in
687 template.
688 (scan_relocs): Likewise.
689 (relocate_section): Likewise.
690 (apply_relocation): Likewise.
691
3660ff06
L
6922012-01-10 H.J. Lu <hongjiu.lu@intel.com>
693
694 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
695 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
696 under x32.
697
fc51264f
L
6982012-01-09 H.J. Lu <hongjiu.lu@intel.com>
699
700 * x86_64.cc: Initial support for x32.
701
dd74ae06
CC
7022012-01-03 Cary Coutant <ccoutant@google.com>
703
704 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
705 Use abstract base class for GOT.
706 * gold/output.h (class Output_data_got_base): New abstract base class.
707 (class Output_data_got): Derive from new base class, adjust ctors.
708 (Output_data_got::reserve_slot): Make virtual; rename to
709 do_reserve_slot; Adjust callers.
710 * gold/target.h (Sized_target::init_got_plt_for_update): Return
711 pointer to abstract base class.
712 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
713
83896202
ILT
7142011-12-18 Ian Lance Taylor <iant@google.com>
715
716 * object.h (Relobj::local_symbol_value): New function.
717 (Relobj::local_plt_offset): New function.
718 (Relobj::local_has_got_offset): New function.
719 (Relobj::local_got_offset): New function.
720 (Relobj::set_local_got_offset): New function.
721 (Relobj::do_local_symbol_value): New pure virtual function.
722 (Relobj::do_local_plt_offset): Likewise.
723 (Relobj::do_local_has_got_offset): Likewise.
724 (Relobj::do_local_got_offset): Likewise.
725 (Relobj::do_set_local_got_offset): Likewise.
726 (Sized_relobj::do_local_has_got_offset): Rename from
727 local_has_got_offset.
728 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
729 (Sized_relobj::do_set_local_got_offset): Rename from
730 set_local_got_offset.
731 (Sized_relobj_file::do_local_plt_offset): Rename from
732 local_plt_offset.
733 (Sized_relobj_file::do_local_symbol_value): New function.
734 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
735 local_plt_offset.
736 * output.cc (Output_data_got::Got_entry::write): Change object to
737 Relobj. Use local_symbol_value.
738 (Output_data_got::add_global_with_rel): Change rel_dyn to
739 Output_data_reloc_generic*. Use add_global_generic.
740 (Output_data_got::add_global_with_rela): Remove. Change all
741 callers to use add_global_with_rel.
742 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
743 Output_data_reloc_generic*. Use add_global_generic.
744 (Output_data_got::add_global_pair_with_rela): Remove. Change all
745 callers to use add_global_pair_with_rel.
746 (Output_data_got::add_local): Change object to Relobj*.
747 (Output_data_got::add_local_plt): Likewise.
748 (Output_data_got::add_local_with_rel): Change object to Relobj*,
749 change rel_dyn to Output_data_reloc_generic*. Use
750 add_local_generic.
751 (Output_data_got::add_local_with_rela): Remove. Change all
752 callers to use all_local_with_rel.
753 (Output_data_got::add_local_pair_with_rel): Change object to
754 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
755 add_output_section_generic.
756 (Output_data_got::add_local_pair_with_rela): Remove. Change all
757 callers to use add_local_pair_with_rel.
758 (Output_data_got::reserve_local): Change object to Relobj*.
759 * output.h: (class Output_data_reloc_generic): Add pure virtual
760 declarations for add_global_generic, add_local_generic,
761 add_output_section_generic.
762 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
763 functions for Output_data_reloc_generic. Update declarations for
764 changes listed in output.cc.
765 (class Output_data_got): Change template parameter to got_size.
766 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
767 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
768 function.
769 (Sized_relobj_incr::do_local_plt_offset): New function.
770 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
771 add_global_generic.
772
76677ad0
CC
7732011-12-17 Cary Coutant <ccoutant@google.com>
774
775 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
776 * resolve.cc (Symbol_table::resolve): Likewise.
777 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
778 arrays.
779 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
780
8b8dd8d5
ILT
7812011-12-16 Ian Lance Taylor <iant@google.com>
782
783 * output.h (Output_data_reloc_generic::add): Only call
784 add_dynamic_reloc if this is a dynamic reloc section.
785
d55525b9
L
7862011-12-15 H.J. Lu <hongjiu.lu@intel.com>
787
788 PR gold/13505
789 * target-reloc.h (apply_relocation): Replace <64, false> with
790 <size, big_endian>.
791
ff81c7c1
NC
7922011-11-25 Nick Clifton <nickc@redhat.com>
793
794 * po/it.po: New Italian translation.
795
628f39be
SA
7962011-11-17 Sterling Augustine <saugustine@google.com>
797
798 * script.cc (script_include_directive): Implement.
799 (read_script_file): New local variables name and search_path. Update
800 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
801 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
802 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
803
98ef3ea4
SA
8042011-11-11 Sterling Augustine <saugustine@google.com>
805
806 * yyscript.y (section_cmd): Add support for INCLUDE directive.
807 (file_or_sections_cmd): Likewise.
808
f4a8b6d7
DK
8092011-11-11 Doug Kwan <dougkwan@google.com>
810
811 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
812 if --just-symbols is given.
813
29ab395d
DK
8142011-11-10 Doug Kwan <dougkwan@google.com>
815
816 PR gold/13362
817 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
818 when processing data relocs.
819 * reloc.h (Relocate_functions::rel_unaligned): New method.
820 (Relocate_functions::pcrel_unaligned): Ditto.
821 (Relocate_functions::rel32_unaligned): Ditto.
822 (Relocate_functions::pcrel32_unaligned): Ditto.
823
2c339f71
DK
8242011-11-09 Doug Kwan <dougkwan@google.com>
825
826 PR gold/13362
827 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
828 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
829 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
830 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
831 (Relocate_functions::rel_unaligned): New.
832 (Relocate_functions::rel32_unaligned): New.
833 * target-reloc.h (relocate_for_relocatable): Add code to handle
834 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
835 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
836 arm_unaligned_reloc_r): New targets.
837 * testsuite/Makefile.in: Regenerate.
838 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
839 linking.
840
3f3cddf1
ILT
8412011-11-02 Ian Lance Taylor <iant@google.com>
842
843 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
844 NATIVE_LINKER.
845 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
846 * options.cc (General_options::finalize): Use library search path
847 from configure script if specified. If not native and no sysroot,
848 only search TOOLLIBDIR.
849 * options.h (Search_directory::Search_directory): Change name to
850 const std::string&.
851 (General_options::add_to_library_path_with_sysroot): Change arg to
852 const std::string&.
853 * configure, Makefile.in, config.in: Rebuild.
854
a8e2273b
ILT
8552011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
856
857 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
858 we are working around the ARM1176 Erratum.
859 * options.h (General_options::fix_arm1176): Add option.
860 * testsuite/Makefile.am: Add testcases, and keep current ones
861 working.
862 * testsuite/Makefile.in: Regenerate.
863 * testsuite/arm_fix_1176.s: New file.
864 * testsuite/arm_fix_1176.sh: Likewise.
865
cd6eab1c
ILT
8662011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
867
868 * arm.cc (Target_arm::Target_arm): Remove initialisation of
869 may_use_blx_.
870 (Target_arm::may_use_blx): Remove method.
871 (Target_arm::set_may_use_blx): Likewise.
872 (Target_arm::may_use_v4t_interworking): New method.
873 (Target_arm::may_use_v5t_interworking): Likewise.
874 (Target_arm::may_use_blx_): Remove member variable.
875 (Arm_relocate_functions::arm_branch_common): Check for v5T
876 interworking.
877 (Arm_relocate_functions::thumb_branch_common): Likewise.
878 (Reloc_stub::stub_type_for_reloc): Likewise.
879 (Target_arm::do_finalize_sections): Correct interworking checks.
880 * testsuite/Makefile.am: Add new tests.
881 * testsuite/Makefile.in: Regenerate.
882 * testsuite/arm_farcall_arm_arm.s: New test.
883 * testsuite/arm_farcall_arm_arm.sh: Likewise.
884 * testsuite/arm_farcall_arm_thumb.s: Likewise.
885 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
886 * testsuite/arm_farcall_thumb_arm.s: Likewise.
887 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
888 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
889 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
890
286adcf4
CC
8912011-10-31 Cary Coutant <ccoutant@google.com>
892
893 PR gold/13023
894 * expression.cc (Expression::eval_with_dot): Add
895 is_section_dot_assignment parameter.
896 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
897 absolute and assigning to dot within a section.
898 * script-sections.cc
899 (Output_section_element_assignment::set_section_addresses): Pass
900 dot_section to set_if_absolute.
901 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
902 as is_section_dot_assignment flag to eval_with_dot.
903 (Output_section_element_dot_assignment::set_section_addresses):
904 Likewise.
905 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
906 parameter. Also set value if relative to dot_section; set the
907 symbol's output_section.
908 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
909 parameter. Adjust all callers.
910 (Expression::eval_maybe_dot): Likewise.
911 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
912 Adjust all callers.
913 * testsuite/script_test_2.t: Test assignment of an absolute value
914 to dot within an output section element.
915
9634ed06
CC
9162011-10-31 Cary Coutant <ccoutant@google.com>
917
918 * options.h (class General_options): Add --[no-]gnu-unique options.
919 * symtab.cc (Symbol_table::sized_write_globals): Convert
920 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
921
de4101c7
CC
9222011-10-31 Cary Coutant <ccoutant@google.com>
923
924 PR gold/13359
925 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
926 unnecessary assertion.
927 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
928
7257cc92
ST
9292011-10-31 Sriraman Tallam <tmsriram@google.com>
930
931 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
932 gc_mark_symbol.
933 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
934 gc_mark_symbol.
935 Change to just keep the section associated with symbol.
936 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
937 they are externally visible and --export-dynamic is turned on.
938 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
939
bfc34b3f
ILT
9402011-10-19 Ian Lance Taylor <iant@google.com>
941
942 PR gold/13163
943 * script-sections.cc
944 (Output_section_element_dot_assignment::needs_output_section): New
945 function.
946
ea0d8c47
ILT
9472011-10-19 Ian Lance Taylor <iant@google.com>
948
949 PR gold/13204
950 * layout.cc (Layout::segment_precedes): Don't assert failure if a
951 --section-start option was seen.
952 * options.h (General_options::any_section_start): New function.
953
abd242a9
DM
9542011-10-18 David S. Miller <davem@davemloft.net>
955
956 PR binutils/13301
957 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
958 member to track relocation locations that have moved during TLS
959 reloc optimizations.
960 (Target_sparc::Relocate::Relocate): Initialize to NULL.
961 (Target_sparc::Relocate::relocate): Adjust view down by 4
962 bytes if it matches reloc_adjust_addr_.
963 (Target_sparc::Relocate::relocate_tls): Always move the
964 __tls_get_addr call delay slot instruction forward 4 bytes when
965 performing relaxation.
966
bab9090f
CC
9672011-10-18 Cary Coutant <ccoutant@google.com>
968
969 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
970 (Output_file::map_no_anonymous): Check for non-zero
971 return code from posix_fallocate.
972
f7c5b166
CC
9732011-10-17 Cary Coutant <ccoutant@google.com>
974
975 PR gold/13245
976 * plugin.cc (is_visible_from_outside): Check for symbols
977 referenced from dynamic objects.
978 * resolve.cc (Symbol_table::resolve): Don't count references
979 from dynamic objects as references from real ELF files.
980 * testsuite/plugin_test_2.sh: Adjust expected result.
981
b490c0bb
CC
9822011-10-17 Cary Coutant <ccoutant@google.com>
983
984 * gold.cc: Include timer.h.
985 (queue_middle_tasks): Stamp time.
986 (queue_final_tasks): Likewise.
987 * main.cc (main): Store timer in parameters. Print timers
988 for each pass.
989 * parameters.cc (Parameters::Parameters): Initialize timer_.
990 (Parameters::set_timer): New function.
991 (set_parameters_timer): New function.
992 * parameters.h (Parameters::set_timer): New function.
993 (Parameters::timer): New function.
994 (Parameters::timer_): New data member.
995 (set_parameters_timer): New function.
996 * timer.cc (Timer::stamp): New function.
997 (Timer::get_pass_time): New function.
998 * timer.h (Timer::stamp): New function.
999 (Timer::get_pass_time): New function.
1000 (Timer::pass_times_): New data member.
1001
f475cf7b
CC
10022011-10-17 Cary Coutant <ccoutant@google.com>
1003
1004 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1005 task for members of lib groups.
1006
cdd7e244
CC
10072011-10-17 Cary Coutant <ccoutant@google.com>
1008
1009 PR gold/13288
4f95c8b4 1010 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
1011 (File_read::make_view): Move bounds check (replace with assert)...
1012 (File_read::find_or_make_view): ... to here.
1013
dfb45471
CC
10142011-10-12 Cary Coutant <ccoutant@google.com>
1015
4f95c8b4 1016 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
1017 ::read returns less than requested size.
1018
53bbcc1b
CC
10192011-10-10 Cary Coutant <ccoutant@google.com>
1020
4f95c8b4 1021 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
1022 Initialize defined_count_.
1023 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1024 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1025 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1026 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1027 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 1028 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
1029 member.
1030 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 1031 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
1032 Return zeroes instead of internal error.
1033
397b129b
CC
10342011-10-10 Cary Coutant <ccoutant@google.com>
1035
1036 PR gold/13249
4f95c8b4 1037 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 1038 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 1039 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
1040 (Output_reloc::type_): Adjust size of bit field.
1041 (Output_reloc::use_plt_offset_): New bit field.
1042 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1043 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1044 flag. Adjust all callers.
4f95c8b4 1045 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
1046 creating RELATIVE relocations.
1047
d5698657
NC
10482011-10-10 Nick Clifton <nickc@redhat.com>
1049
1050 * po/es.po: Updated Spanish translation.
1051 * po/fi.po: Updated Finnish translation.
1052
6a59a5c2
DN
10532011-10-03 Diego Novillo <dnovillo@google.com>
1054
1055 * options.cc (parse_uint): Fix dereference of RETVAL.
1056
f0558624
ST
10572011-09-29 Sriraman Tallam <tmsriram@google.com>
1058
1059 * layout.h (section_order_map_): New member.
1060 (get_section_order_map): New member function.
1061 * output.cc (Output_section::add_input_section): Check for patterns
1062 only when --section-ordering-file is specified.
1063 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1064 output_sections have been formed.
1065 * layout.cc (Layout_Layout): Initialize section_order_map_.
1066 * plugin.cc (update_section_order): Store order in order_map. Do not
1067 update the order.
1068 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1069 * testsuite/Makefile.in: Regenerate.
1070 * testsuite/plugin_section_order.c: New file.
1071 * testsuite/plugin_final_layout.cc: New file.
1072 * testsuite/plugin_final_layout.sh: New file.
1073
a7dac153
CC
10742011-09-29 Cary Coutant <ccoutant@google.com>
1075
4f95c8b4 1076 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 1077 Check for NULL.
4f95c8b4 1078 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
1079 symbols during incremental update.
1080 (Symbol_table::add_from_dynobj): Likewise.
1081
eebd87a5
ILT
10822011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1083 Ian Lance Taylor <iant@google.com>
1084
1085 * symtab.cc (Symbol_table::define_special_symbol): Always
1086 canonicalize version string.
1087
403a3331
CC
10882011-09-26 Cary Coutant <ccoutant@google.com>
1089
4f95c8b4
CC
1090 * gold.cc (queue_initial_tasks): Move option checks ...
1091 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
1092 some options; make others fatal.
1093
235061c2
CC
10942011-09-26 Cary Coutant <ccoutant@google.com>
1095
1096 gcc PR lto/47247
1097 * plugin.cc (get_symbols_v2): New function.
1098 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1099 (is_referenced_from_outside): New function.
1100 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1101 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1102 (get_symbols): Pass version parameter.
1103 (get_symbols_v2): New function.
1104 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1105 parameter.
1106 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1107 (onload): Add LDPT_GET_SYMBOLS_V2.
1108 (all_symbols_read_hook): Use get_symbols_v2; check for
1109 LDPR_PREVAILING_DEF_IRONLY_EXP.
1110 * testsuite/plugin_test_3.sh: Update expected results.
1111
dc87f620
ILT
11122011-09-23 Simon Baldwin <simonb@google.com>
1113
1114 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1115 configuration options.
1116 * configure: Regenerate.
1117 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1118 * Makefile.in: Regenerate.
1119 * testsuite/Makefile.in: Regenerate.
1120
a8279f82
ST
11212011-09-19 Sriraman Tallam <tmsriram@google.com>
1122
1123 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1124
0c9350c8
CC
11252011-09-19 Cary Coutant <ccoutant@google.com>
1126
1127 * incremental.cc (can_incremental_update): Fix typo in comment.
1128 * incremental.h (can_incremental_update): Likewise.
1129
aa06ae28
CC
11302011-09-18 Cary Coutant <ccoutant@google.com>
1131
1132 * incremental.cc (can_incremental_update): New function.
1133 * incremental.h (can_incremental_update): New function.
1134 * layout.cc (Layout::init_fixed_output_section): Call it.
1135 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1136 * object.cc (Sized_relobj_file::do_layout): Call
1137 can_incremental_update.
1138
ebb300b2
CC
11392011-09-13 Cary Coutant <ccoutant@google.com>
1140
1141 * configure.ac: Check for glibc support for gnu_indirect_function
1142 support with static linking, setting automake conditional
1143 IFUNC_STATIC.
1144 * Makefile.in: Regenerate.
1145 * configure: Regenerate.
1146
1147 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1148 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1149 for IFUNC_STATIC.
1150 * testsuite/Makefile.in: Regenerate.
1151
1206d0d5
CC
11522011-09-13 Cary Coutant <ccoutant@google.com>
1153
1154 * incremental.cc (Sized_relobj_incr::do_layout): Call
1155 report_comdat_group for kept comdat sections.
1156 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1157 * testsuite/Makefile.in: Regenerate.
1158 * testsuite/incr_comdat_test_1.cc: New source file.
1159 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1160 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1161 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1162
40b29874
ILT
11632011-09-13 Ian Lance Taylor <iant@google.com>
1164
1165 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1166 variable external_symbols_offset.
1167
1b045aac
ILT
11682011-09-12 Ian Lance Taylor <iant@google.com>
1169
1170 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1171 triggered if object has no symbols.
1172
24c6c55a
DM
11732011-09-09 David S. Miller <davem@davemloft.net>
1174
1175 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1176 (Output_fill_debug_line::do_write): Likewise.
1177
66570254
CC
11782011-08-29 Cary Coutant <ccoutant@google.com>
1179
1180 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1181 casts to match formatting specs.
1182 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1183
8ea8cd50
CC
11842011-08-26 Cary Coutant <ccoutant@google.com>
1185
1186 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1187 remaining hole size when allocating.
1188 (Layout::make_output_section): Set fill methods for debug sections.
1189 * layout.h (Free_list::Free_list_node): Move from private to
1190 public.
1191 (Free_list::set_min_hole_size): New function.
1192 (Free_list::begin, Free_list::end): New functions.
1193 (Free_list::min_hole_): New data member.
1194 * output.cc: Include dwarf.h.
1195 (Output_fill_debug_info::do_minimum_hole_size): New function.
1196 (Output_fill_debug_info::do_write): New function.
1197 (Output_fill_debug_line::do_minimum_hole_size): New function.
1198 (Output_fill_debug_line::do_write): New function.
1199 (Output_section::Output_section): Initialize new data member.
1200 (Output_section::set_final_data_size): Ensure patch space is larger
1201 than minimum hole size.
1202 (Output_section::do_write): Fill holes in debug sections.
1203 * output.h (Output_fill): New class.
1204 (Output_fill_debug_info): New class.
1205 (Output_fill_debug_line): New class.
1206 (Output_section::set_free_space_fill): New function.
1207 (Output_section::free_space_fill_): New data member.
1208 * testsuite/Makefile.am (incremental_test_3): Add
1209 --incremental-patch option.
1210 (incremental_test_4): Likewise.
1211 (incremental_test_5): Likewise.
1212 (incremental_test_6): Likewise.
1213 (incremental_copy_test): Likewise.
1214 (incremental_common_test_1): Likewise.
1215 * testsuite/Makefile.in: Regenerate.
1216
7cf80422
NC
12172011-08-26 Nick Clifton <nickc@redhat.com>
1218
1219 * po/es.po: Updated Spanish translation.
1220
c3f7b0e5
CC
12212011-08-01 Cary Coutant <ccoutant@google.com>
1222
1223 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1224 * gold/testsuite/Makefile.in: Regenerate.
1225 * gold/testsuite/justsyms_exec.c: New source file.
1226 * gold/testsuite/justsyms_lib.c: New source file.
1227
9590bf25
CC
12282011-08-01 Cary Coutant <ccoutant@google.com>
1229
1230 * layout.cc (Layout::set_segment_offsets): Don't realign text
1231 segment if -Ttext was specified.
1232 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1233 file type.
1234 * object.h (Sized_relobj_file::e_type): New function.
1235 (Sized_relobj_file::e_type_): New data member.
1236 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1237 base address for ET_EXEC files.
1238 * target.cc (Target::do_make_elf_object_implementation): Allow
1239 ET_EXEC files with --just-symbols option.
1240
dcd8d12e
CC
12412011-07-28 Cary Coutant <ccoutant@google.com>
1242
1243 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1244 Add thread_number parameter.
1245 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1246 * workqueue-threads.cc
1247 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1248 current thread if its thread number is greater than desired thread
1249 count.
1250 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1251 Add thread_number parameter.
1252 (Workqueue::should_cancel_thread): Likewise.
1253 (Workqueue::find_runnable_or_wait): Pass thread_number to
1254 should_cancel_thread.
1255 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1256 parameter.
1257
804eb480
ST
12582011-07-22 Sriraman Tallam <tmsriram@google.com>
1259
1260 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1261 only after checking if it cannot be forced local.
1262 * symtab.h (is_externally_visible): Check if the symbol is not forced
1263 local.
1264
f1ddb600
ILT
12652011-07-15 Ian Lance Taylor <iant@google.com>
1266
1267 * options.h (class General_options): Add --print-output-format.
1268 Move -EL next to -EB, for better --help output.
1269 * target-select.cc: Include <cstdio>, "options.h", and
1270 "parameters.h".
1271 (Target_selector::do_target_bfd_name): New function.
1272 (print_output_format): New function.
1273 * target-select.h (class Target_selector): Update declarations.
1274 (Target_selector::target_bfd_name): New function.
1275 (print_output_format): Declare.
1276 * main.cc: Include "target-select.h".
1277 (main): Handle --print-output-format.
1278 * gold.cc: Include "target-select.h".
1279 (queue_initial_tasks): Handle --print-output-format when there are
1280 no input files.
1281 * parameters.cc (parameters_force_valid_target): Give a better
1282 error message if -EB/-EL does not match target.
1283 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1284 function.
1285
7d172687
ILT
12862011-07-15 Ian Lance Taylor <iant@google.com>
1287
1288 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1289 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1290 (Output_data_plt_i386::do_write): Write address of .dynamic
1291 section to first entry in .got.plt section.
1292 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1293 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1294 Initialize layout_.
1295 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1296 section to first entry in .got.plt section.
1297 * layout.h (Layout::dynamic_section): New function.
1298
e9552f7e
ST
12992011-07-13 Sriraman Tallam <tmsriram@google.com>
1300
1301 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1302 to claim_file call.
1303 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1304 input_section_position_, and input_section_glob_.
1305 (read_layout_from_file): Call function section_ordering_specified.
1306 * layout.h (is_section_ordering_specified): New function.
1307 (section_ordering_specified): New function.
1308 (section_ordering_specified_): New boolean member.
1309 * main.cc(main): Call load_plugins after layout object is defined.
1310 * output.cc (Output_section::add_input_section): Use
1311 function section_ordering_specified to check if section ordering is
1312 needed.
1313 * output.cc (Output_section::add_relaxed_input_section): Use
1314 function section_ordering_specified to check if section ordering is
1315 needed.
1316 (Output_section::update_section_layout): New function.
1317 (Output_section::sort_attached_input_sections): Check if input section
1318 must be reordered.
1319 * output.h (Output_section::update_section_layout): New function.
1320 * plugin.cc (get_section_count): New function.
1321 (get_section_type): New function.
1322 (get_section_name): New function.
1323 (get_section_contents): New function.
1324 (update_section_order): New function.
58797674 1325 (allow_section_ordering): New function.
e9552f7e
ST
1326 (Plugin::load): Add the new interfaces to the transfer vector.
1327 (Plugin_manager::load_plugins): New parameter.
1328 (Plugin_manager::all_symbols_read): New parameter.
1329 (Plugin_manager::claim_file): New parameter. Save the elf object for
1330 unclaimed objects.
1331 (Plugin_manager::get_elf_object): New function.
1332 (Plugin_manager::get_view): Change to directly use the bool to check
1333 if get_view is called from claim_file_hook.
1334 * plugin.h (input_objects): New function
1335 (Plugin__manager::load_plugins): New parameter.
1336 (Plugin_manager::claim_file): New parameter.
1337 (Plugin_manager::get_elf_object): New function.
1338 (Plugin_manager::in_claim_file_handler): New function.
1339 (Plugin_manager::in_claim_file_handler_): New member.
1340 (layout): New function.
1341 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1342 handler with an extra parameter. Make the elf object before calling
1343 claim_file handler.
1344 * testsuite/plugin_test.c (get_section_count): New function pointer.
1345 (get_section_type): New function pointer.
1346 (get_section_name): New function pointer.
1347 (get_section_contents): New function pointer.
1348 (update_section_order): New function pointer.
1349 (allow_section_ordering): New function pointer.
1350 (onload): Check if the new interfaces exist.
1351
9446efde
ILT
13522011-07-13 Ian Lance Taylor <iant@google.com>
1353
1354 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1355 relro section.
1356 * x86_64.cc (Target_x86_64::got_section): Likewise.
1357 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1358 (relro_now_test_SOURCES): New variable.
1359 (relro_now_test_DEPENDENCIES): New variable.
1360 (relro_now_test_LDFLAGS): New variable.
1361 (relro_now_test_LDADD): New variable.
1362 (relro_now_test.so): New target.
1363 * testsuite/Makefile.in: Rebuild.
1364
07aa62f2
ILT
13652011-07-12 Ian Lance Taylor <iant@google.com>
1366
1367 PR gold/12980
1368 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1369 GLOB_DAT relocation rather than a RELATIVE relocation for a
1370 protected symbol when creating a shared library.
1371 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1372 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1373 * testsuite/protected_main_1.cc (main): Test that protected
1374 function has same address.
1375
e2153196
ILT
13762011-07-11 Ian Lance Taylor <iant@google.com>
1377
1378 PR gold/12979
1379 * options.h (class General_options): Add -Bgroup.
1380 * options.cc (General_options::finalize): If -Bgroup is set,
1381 default to --unresolved-symbols=report-all.
1382 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1383 * target-reloc.h (issue_undefined_symbol_error): Handle
1384 --unresolved-symbols=report-all.
1385
6daf5215
ILT
13862011-07-08 Ian Lance Taylor <iant@google.com>
1387
1388 PR gold/11985
1389 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1390 if linker script discards key sections.
1391 (Layout::create_dynamic_symtab): Likewise.
1392 (Layout::assign_local_dynsym_offsets): Likewise.
1393 (Layout::sized_create_version_sections): Likewise.
1394 (Layout::create_interp): Likewise.
1395 (Layout::finish_dynamic_section): Likewise.
1396 (Layout::set_dynamic_symbol_size): Likewise.
1397
beabb2c6
ILT
13982011-07-08 Ian Lance Taylor <iant@google.com>
1399
1400 PR gold/12386
1401 * options.h (class General_options): Add --unresolved-symbols.
1402 * target-reloc.h (issue_undefined_symbol_error): Check
1403 --unresolved-symbols. Add comments.
1404
9c16daf1
ILT
14052011-07-08 Ian Lance Taylor <iant@google.com>
1406
1407 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1408 expression more complex.
1409
191f1a2d
ILT
14102011-07-08 Ian Lance Taylor <iant@google.com>
1411
1412 PR gold/11317
1413 * target-reloc.h (issue_undefined_symbol_error): New inline
1414 function, broken out of relocate_section.
1415 (relocate_section): Call issue_undefined_symbol_error.
1416 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1417 there is no TLS segment if we are about to issue an undefined
1418 symbol error.
1419 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1420
62855347
ILT
14212011-07-08 Ian Lance Taylor <iant@google.com>
1422
1423 PR gold/12279
1424 * resolve.cc (Symbol_table::should_override): Add fromtype
1425 parameter. Change all callers. Give error when linking together
1426 TLS and non-TLS symbol.
1427 (Symbol_table::should_override_with_special): Add fromtype
1428 parameter. Change all callers.
1429 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1430 there is no TLS segment if we have reported some errors.
1431 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1432
67181c72
ILT
14332011-07-08 Ian Lance Taylor <iant@google.com>
1434
1435 PR gold/12372
1436 * target.h (Target::plt_address_for_global): New function.
1437 (Target::plt_address_for_local): New function.
1438 (Target::plt_section_for_global): Remove.
1439 (Target::plt_section_for_local): Remove.
1440 (Target::do_plt_address_for_global): New virtual function.
1441 (Target::do_plt_address_for_local): New virtual function.
1442 (Target::do_plt_section_for_global): Remove.
1443 (Target::do_plt_section_for_local): Remove.
1444 (Target::register_global_plt_entry): Add Symbol_table and Layout
1445 parameters.
1446 * output.cc (Output_data_got::Got_entry::write): Use
1447 plt_address_for_global and plt_address_for_local.
1448 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1449 address of output section.
1450 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1451 got_irelative_, and irelative_count_ fields. Update
1452 declarations.
1453 (Output_data_plt_i386::has_irelative_section): New function.
1454 (Output_data_plt_i386::entry_count): Add irelative_count_.
1455 (Output_data_plt_i386::set_final_data_size): Likewise.
1456 (class Target_i386): Add got_irelative_ and rel_irelative_
1457 fields. Update declarations.
1458 (Target_i386::Target_i386): Initialize new fields.
1459 (Target_i386::do_plt_address_for_global): New function replacing
1460 do_plt_section_for_global.
1461 (Target_i386::do_plt_address_for_local): New function replacing
1462 do_plt_section_for_local.
1463 (Target_i386::got_section): Create got_irelative_.
1464 (Target_i386::rel_irelative_section): New function.
1465 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1466 fields. Don't define __rel_iplt_{start,end}.
1467 (Output_data_plt_i386::add_entry): Add symtab and layout
1468 parameters. Change all callers. Use different PLT and GOT for
1469 IFUNC symbols.
1470 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1471 layout parameters. Change all callers. Use different PLT and
1472 GOT.
1473 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1474 (Output_data_plt_i386::rel_irelative): New function.
1475 (Output_data_plt_i386::address_for_global): New function.
1476 (Output_data_plt_i386::address_for_local): New function.
1477 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1478 IRELATIVE GOT when changing IFUNC GOT entries.
1479 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1480 reloc.
1481 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1482 if we didn't create an IRELATIVE GOT.
1483 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1484 plt_address_for_local.
1485 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1486 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1487 got_irelative_, and irelative_count_ fields. Update
1488 declarations.
1489 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1490 Initialize new fields. Remove symtab parameter. Change all
1491 callers.
1492 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1493 irelative_count_.
1494 (Output_data_plt_x86_64::has_irelative_section): New function.
1495 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1496 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1497 fields. Update declarations.
1498 (Target_x86_64::Target_x86_64): Initialize new fields.
1499 (Target_x86_64::do_plt_address_for_global): New function replacing
1500 do_plt_section_for_global.
1501 (Target_x86_64::do_plt_address_for_local): New function replacing
1502 do_plt_section_for_local.
1503 (Target_x86_64::got_section): Create got_irelative_.
1504 (Target_x86_64::rela_irelative_section): New function.
1505 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1506 all callers. Don't create __rel_iplt_{start,end}.
1507 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1508 parameters. Change all callers. Use different PLT and GOT for
1509 IFUNC symbols.
1510 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1511 layout parameters. Change all callers. Use different PLT and
1512 GOT.
1513 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1514 parameters. Change all callers. Use different PLT and GOT for
1515 IFUNC symbols.
1516 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1517 (Output_data_plt_x86_64::rela_irelative): New function.
1518 (Output_data_plt_x86_64::address_for_global): New function.
1519 (Output_data_plt_x86_64::address_for_local): New function.
1520 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1521 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1522 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1523 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1524 parameters.
1525 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1526 reloc.
1527 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1528 symbols if we didn't create an IRELATIVE GOT.
1529 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1530 plt_address_for_local.
1531 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1532 * testsuite/ifuncvar1.c: New test file.
1533 * testsuite/ifuncvar2.c: New test file.
1534 * testsuite/ifuncvar3.c: New test file.
1535 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1536 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1537 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1538 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1539 * testsuite/Makefile.in: Rebuild.
1540
33c15b45
CC
15412011-07-07 Cary Coutant <ccoutant@google.com>
1542
1543 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1544 (two_file_test_1_ndebug.o): Likewise.
1545 (two_file_test_1b_ndebug.o): Likewise.
1546 (two_file_test_2_ndebug.o): Likewise.
1547 (two_file_test_main_ndebug.o): Likewise.
1548 (incremental_test_2): Link with no-debug versions.
1549
f48b5fb7
CC
15502011-07-06 Cary Coutant <ccoutant@google.com>
1551
1552 * gold/incremental.cc
1553 (Output_section_incremental_inputs::write_info_blocks): Check for
1554 hidden and internal symbols.
1555
221597a5
CC
15562011-07-06 Cary Coutant <ccoutant@google.com>
1557
1558 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1559 Check disposition for startup file.
1560 (Incremental_inputs::report_command_line): Ignore
1561 --incremental-startup-unchanged option.
1562 * options.cc (General_options::parse_incremental_startup_unchanged):
1563 New function.
1564 (General_options::General_options): Initialize new data member.
1565 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1566 (General_options): Add --incremental-startup-unchanged option.
1567 (General_options::incremental_startup_disposition): New function.
1568 (General_options::incremental_startup_disposition_): New data member.
1569
e24719f6
CC
15702011-07-06 Cary Coutant <ccoutant@google.com>
1571
1572 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1573 input file index to Script_info ctor.
1574 (Sized_incremental_binary::do_file_has_changed): Find the
1575 command-line argument for files named in scripts.
1576 * incremental.h (Script_info::Script_info): New ctor
1577 with input file index.
1578 (Script_info::input_file_index): New function.
1579 (Script_info::input_file_index_): New data member.
1580 (Incremental_binary::get_library): Add const.
1581 (Incremental_binary::get_script_info): Add const.
1582 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1583 * testsuite/Makefile.am (incremental_test_5): New test case.
1584 (incremental_test_6): New test case.
1585 * testsuite/Makefile.in: Regenerate.
1586
8f7c81e8
CC
15872011-07-06 Cary Coutant <ccoutant@google.com>
1588
1589 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1590 debug output when command lines differ.
1591
9fbd3822
CC
15922011-07-06 Cary Coutant <ccoutant@google.com>
1593
1594 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1595 --incremental-patch option.
1596 * layout.cc (Free_list::allocate): Extend allocation beyond original
1597 end if enabled.
1598 (Layout::make_output_section): Mark sections that should get
1599 patch space.
1600 * options.cc (parse_percent): New function.
1601 * options.h (parse_percent): New function.
1602 (DEFINE_percent): New macro.
1603 (General_options): Add --incremental-patch option.
1604 * output.cc (Output_section::Output_section): Initialize new data
1605 members.
1606 (Output_section::add_input_section): Print section name when out
1607 of patch space.
1608 (Output_section::add_output_section_data): Likewise.
1609 (Output_section::set_final_data_size): Add patch space when
1610 doing --incremental-full.
1611 (Output_section::do_reset_address_and_file_offset): Remove patch
1612 space.
1613 (Output_segment::set_section_list_addresses): Print debug output
1614 only if --incremental-update.
1615 * output.h (Output_section::set_is_patch_space_allowed): New function.
1616 (Output_section::is_patch_space_allowed_): New data member.
1617 (Output_section::patch_space_): New data member.
1618 * parameters.cc (Parameters::incremental_full): New function.
1619 * parameters.h (Parameters::incremental_full): New function
1620 * testsuite/Makefile.am (incremental_test_2): Add test for
1621 --incremental-patch option.
1622 * testsuite/Makefile.in: Regenerate.
1623 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1624 (t18): Remove function body.
1625
f6cccc2c
DK
16262011-07-05 Doug Kwan <dougkwan@google.com>
1627
1628 PR gold/12771
1629 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1630 Arm_Address type for relocation result.
1631 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1632 overflow check.
1633 (Arm_relocate_functions::abs32): Use unaligned access.
1634 (Arm_relocate_functions::rel32): Ditto.
1635 (Arm_relocate_functions::prel31): Ditto.
1636 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1637 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1638 static data relocations.
1639 * testsuite/Makefile.in: Regnerate.
1640 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1641
28a13fec
ILT
16422011-07-05 Ian Lance Taylor <iant@google.com>
1643
1644 PR gold/12392
1645 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1646 symbols if necessary.
1647 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1648
24d47b34
ILT
16492011-07-05 Ian Lance Taylor <iant@google.com>
1650
1651 PR gold/12952
1652 * resolve.cc (Symbol::override_base_with_special): Simply override
1653 version with special symbol version, ignoring previous version.
1654
41f9cbbe
ILT
16552011-07-05 Ian Lance Taylor <iant@google.com>
1656
1657 * object.cc (Sized_relobj_file::include_section_group): Add
1658 information to comment about signature location.
1659
886288f1
ILT
16602011-07-02 Ian Lance Taylor <iant@google.com>
1661
1662 PR gold/12957
1663 * options.h (class General_options): Add -f and -F.
1664 * options.cc (General_options::finalize): Fatal error if -f/-F
1665 are used without -shared.
1666 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1667
ae3a6d4f
ILT
16682011-07-02 Ian Lance Taylor <iant@google.com>
1669
1670 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1671
21131061
ILT
16722011-07-01 Ian Lance Taylor <iant@google.com>
1673
1674 PR gold/12525
1675 PR gold/12952
1676 * resolve.cc (Symbol::override_base_with_special): Don't override
1677 the version if the overriding symbol has a different name.
1678 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1679 all callers. If we give an error about an undefined version,
1680 define the base version if necessary.
1681 * dynobj.h (class Versions): Update declaration.
1682 * testsuite/weak_alias_test_5.cc: New file.
1683 * testsuite/weak_alias_test.script: New file.
1684 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1685 and versioned_alias have the right value, and call t2.
1686 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1687 weak_alias_test_5.so.
1688 (weak_alias_test_LDADD): Likewise.
1689 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1690 * testsuite/Makefile.in: Rebuild.
1691
611062c0
ILT
16922011-07-01 Ian Lance Taylor <iant@google.com>
1693
1694 PR gold/12525
1695 * options.h (class General_options): Support -z notext.
1696 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1697 -Wl,-z,notext.
1698 (two_file_shared_nonpic.so): Likewise.
1699 (two_file_shared_mixed.so): Likewise.
1700 (two_file_shared_mixed_1.so): Likewise.
1701 (weak_undef_lib_nonpic.so): Likewise.
1702 (alt/weak_undef_lib_nonpic.so): Likewise.
1703 (tls_test_shared_nonpic.so): Likewise.
1704 * testsuite/Makefile.in: Rebuild.
1705
328c7c2f
ILT
17062011-07-01 Ian Lance Taylor <iant@google.com>
1707
1708 PR gold/12525
1709 * configure.ac: Test whether static linking works, setting
1710 the automake conditional HAVE_STATIC.
1711 * testsuite/Makefile.am: Disable tests using -static if
1712 HAVE_STATIC is not true.
1713 * configure, testsuite/Makefile.in: Rebuild.
1714
02d7cd44
ILT
17152011-07-01 Ian Lance Taylor <iant@google.com>
1716
1717 PR gold/12525
1718 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1719 Assert if we see DW_EH_PE_indirect.
1720 * target.h (Target::ehframe_datarel_base): New function.
1721 (Target::do_ehframe_datarel_base): New target function.
1722 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1723 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1724 function.
1725
07a60597
ILT
17262011-07-01 Ian Lance Taylor <iant@google.com>
1727
1728 PR gold/12571
1729 * options.h (class General_options): Add
1730 --ld-generated-unwind-info.
1731 * ehframe.cc (Fde::write): Add address parameter. Change all
1732 callers. If associated with PLT, fill in address and size.
1733 (Cie::set_output_offset): Only add merge mapping if there is an
1734 object.
1735 (Cie::write): Add address parameter. Change all callers.
1736 (Eh_frame::add_ehframe_for_plt): New function.
1737 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1738 input_offset_ fields into union u_, with new plt field.
1739 (Fde::Fde): Adjust for new union field.
1740 (Fde::Fde) [Output_data version]: New constructor.
1741 (Fde::add_mapping): Only add merge mapping if there is an object.
1742 (class Cie): Update declarations.
1743 (class Eh_frame): Declare add_ehframe_for_plt.
1744 * layout.cc (Layout::layout_eh_frame): Break out code into
1745 make_eh_frame_section, and call it.
1746 (Layout::make_eh_frame_section): New function.
1747 (Layout::add_eh_frame_for_plt): New function.
1748 * layout.h (class Layout): Update declarations.
1749 * merge.cc (Merge_map::add_mapping): Add assertion.
1750 * i386.cc: Include "dwarf.h".
1751 (class Output_data_plt_i386): Make first_plt_entry,
1752 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1753 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1754 and plt_eh_frame_fde.
1755 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1756 boundary. Call add_eh_frame_for_plt if appropriate.
1757 * x86_64.cc: Include "dwarf.h".
1758 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1759 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1760 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1761 and plt_eh_frame_fde.
1762 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1763 appropriate.
1764
14788a3f
ILT
17652011-06-29 Ian Lance Taylor <iant@google.com>
1766
1767 PR gold/12629
1768 * object.cc (Sized_relobj_file::layout_section): Change shdr
1769 parameter to be const.
1770 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1771 out of do_layout.
1772 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1773 appropriate. Call layout_eh_frame_section.
1774 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1775 sections.
1776 * object.h (class Sized_relobj_file): Update declarations.
1777
6c21fce1
ILT
17782011-06-29 Ian Lance Taylor <iant@google.com>
1779
37e41b03 1780 PR gold/12652
6c21fce1
ILT
1781 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1782 modifier.
1783 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1784
4d5e4e62
ILT
17852011-06-29 Ian Lance Taylor <iant@google.com>
1786
1787 PR gold/12675
1788 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1789 SHT_X86_64_UNWIND.
1790 * layout.cc (Layout::layout_eh_frame): Likewise.
1791
886f533a
ILT
17922011-06-29 Ian Lance Taylor <iant@google.com>
1793
1794 PR gold/12695
1795 * layout.cc (Layout::symtab_section_shndx): New function.
1796 * layout.h (class Layout): Declare symtab_section_shndx.
1797 * output.cc (Output_section::write_header): Call it.
1798
f3ae1b28
ILT
17992011-06-29 Ian Lance Taylor <iant@google.com>
1800
1801 PR gold/12818
1802 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1803 symbols which are not used in a relocation.
1804
aecf301f
ILT
18052011-06-28 Ian Lance Taylor <iant@google.com>
1806
1807 PR gold/12898
1808 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1809 script create indistinguishable segments.
1810 (Layout::set_segment_offsets): Use stable_sort when sorting
1811 segments. Pass this to Compare_segments constructor.
1812 * layout.h (class Layout): Make segment_precedes non-static.
1813 (class Compare_segments): Change from struct to class. Add
1814 layout_ field. Add constructor.
1815 * script-sections.cc
1816 (Script_sections::attach_sections_using_phdrs_clause): Rename
1817 local orphan to is_orphan. Don't report failure to put empty
1818 section in segment. On attachment failure, report name of
1819 section, and attach to first PT_LOAD segment.
1820
03ef7571
ILT
18212011-06-28 Ian Lance Taylor <iant@google.com>
1822
1823 PR gold/12934
1824 * target-select.cc (Target_selector::Target_selector): Add
1825 emulation parameter. Change all callers.
1826 (select_target_by_bfd_name): Rename from select_target_by_name.
1827 Change all callers.
1828 (select_target_by_emulation): New function.
1829 (supported_emulation_names): New function.
1830 * target-select.h (class Target_selector): Add emulation_ field.
1831 Update declarations.
1832 (Target_selector::recognize_by_bfd_name): Rename from
1833 recognize_by_name. Change all callers.
1834 (Target_selector::supported_bfd_names): Rename from
1835 supported_names. Change all callers.
1836 (Target_selector::recognize_by_emulation): New function.
1837 (Target_selector::supported_emulations): New function.
1838 (Target_selector::emulation): New function.
1839 (Target_selector::do_recognize_by_bfd_name): Rename from
1840 do_recognize_by_name. Change all callers.
1841 (Target_selector::do_supported_bfd_names): Rename from
1842 do_supported_names. Change all callers.
1843 (Target_selector::do_recognize_by_emulation): New function.
1844 (Target_selector::do_supported_emulations): New function.
1845 (select_target_by_bfd_name): Change name in declaration.
1846 (select_target_by_emulation): Declare.
1847 (supported_emulation_names): Declare.
1848 * parameters.cc (parameters_force_valid_target): Try to find
1849 target based on emulation from -m option.
1850 * options.h (class General_options): Change doc string for -m.
1851 * options.cc (help): Print emulations.
1852 (General_options::parse_V): Likewise.
1853 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1854 Add emulation parameter. Change all callers.
1855
200b2bb9
ILT
18562011-06-28 Ian Lance Taylor <iant@google.com>
1857
1858 * target.h (class Target): Add osabi_ field.
1859 (Target::osabi): New function.
1860 (Target::set_osabi): New function.
1861 (Target::Target): Initialize osabi_.
1862 (Target::do_adjust_elf_header): Make pure virtual.
1863 (Sized_target::do_adjust_elf_header): Declare.
1864 * target.cc (Sized_target::do_adjust_elf_header): New function.
1865 (class Sized_target): Instantiate all versions.
1866 * freebsd.h (class Target_freebsd): Remove.
1867 (Target_selector_freebsd::do_recognize): Call set_osabi on
1868 Target.
1869 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1870 (Target_selector_freebsd::set_osabi): Remove.
1871 * i386.cc (class Target_i386): Inherit from Sized_target rather
1872 than Target_freebsd.
1873 * x86_64.cc (class Target_x86_64): Likewise.
1874
b3ce541e
ILT
18752011-06-28 Ian Lance Taylor <iant@google.com>
1876
1877 * target.h (Target::can_check_for_function_pointers): Rewrite.
1878 Make non-virtual.
1879 (Target::can_icf_inline_merge_sections): Likewise.
1880 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1881 (Target::Target_info): Add can_icf_inline_merge_sections field.
1882 (Target::do_can_check_for_function_pointers): New virtual
1883 function.
1884 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1885 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1886 from can_check_for_function_pointers, move in file.
1887 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1888 section_may_have_icf_unsafe_poineters, move in file.
1889 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1890 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1891 Rename from can_check_for_function_pointers, move in file.
1892 (Target_i386::can_icf_inline_merge_sections): Remove.
1893 (Target_i386::i386_info): Initialize
1894 can_icf_inline_merge_sections.
1895 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1896 Initialize can_icf_inline_merge_sections.
1897 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1898 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1899 Rename from can_check_for_function_pointers, move in file.
1900 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1901 (Target_x86_64::x86_64_info): Initialize
1902 can_icf_inline_merge_sections.
1903 * testsuite/testfile.cc (Target_test::test_target_info):
1904 Likewise.
1905 * icf.cc (get_section_contents): Correct formatting.
1906
6d1c4efb
ILT
19072011-06-27 Ian Lance Taylor <iant@google.com>
1908
1909 * symtab.cc (Symbol::versioned_name): New function.
1910 (Symbol_table::add_to_final_symtab): Use versioned_name when
1911 appropriate.
1912 (Symbol_table::sized_write_symbol): Likewise.
1913 * symtab.h (class Symbol): Declare versioned_name.
1914 * stringpool.h (class Stringpool_template): Add variant of add
1915 which takes a std::basic_string.
1916 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1917 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1918 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1919 (ver_test_12.o): New target.
1920 * testsuite/Makefile.in: Rebuild.
1921
57eb9b50
DK
19222011-06-27 Doug Kwan <dougkwan@google.com>
1923
1924 * arm.cc (Arm_relocate_functions::thm_jump8,
1925 Arm_relocate_functions::thm_jump11): Use a wider signed
1926 type to compute offset.
1927 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1928 arm_thm_jump8.
1929 * testsuite/Makefile.in: Regenerate.
1930 * testsuite/arm_branch_in_range.sh: Check test results of
1931 arm_thm_jump11 and arm_thm_jump8.
1932 * testsuite/arm_thm_jump11.s: New test source file.
1933 * testsuite/arm_thm_jump11.t: New linker script.
1934 * testsuite/arm_thm_jump8.s: New test source file.
1935 * testsuite/arm_thm_jump8.t: New linker script.
1936
487b39df
ILT
19372011-06-24 Ian Lance Taylor <iant@google.com>
1938
1939 * layout.cc: Include "object.h".
1940 (ctors_sections_in_init_array): New static variable.
1941 (Layout::is_ctors_in_init_array): New function.
1942 (Layout::layout): Add entry to ctors_sections_in_init_array if
1943 appropriate.
1944 * layout.h (class Layout): Declare is_ctors_in_init_array.
1945 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1946 is_ctors_reverse_view is set.
1947 (Sized_relobj_file::write_sections): Add layout parameter. Change
1948 all callers. Set is_ctors_reverse_view field of View_size.
1949 (Sized_relobj_file::reverse_words): New function.
1950 * object.h (Sized_relobj_file::View_size): Add
1951 is_ctors_reverse_view field.
1952 (class Sized_relobj_file): Update declarations.
1953 * testsuite/initpri3.c: New test.
1954 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1955 initpri3b.
1956 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1957 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1958 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1959 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1960 * testsuite/Makefile.in: Rebuild.
1961
472076e4
CC
19622011-06-24 Cary Coutant <ccoutant@google.com>
1963
1964 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1965 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1966 (debug_msg_cdebug.err): New targets.
1967 * testsuite/Makefile.in: Regenerate.
1968 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1969 Fix checks for link with shared library.
1970
a60af0db
DK
19712011-06-24 Doug Kwan <dougkwan@google.com>
1972
1973 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1974 skip empty text sections.
1975 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1976
5393d741
ILT
19772011-06-22 Ian Lance Taylor <iant@google.com>
1978
1979 PR gold/12910
1980 * options.h (class General_options): Add --ctors-in-init-array.
1981 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1982 friends as SHT_PROGBITS for merging sections.
1983 (Layout::layout): Remove special handling of .init_array and
1984 friends. Don't sort if doing relocatable link. Sort for .ctors
1985 and .dtors if ctors_in_init_array.
1986 (Layout::make_output_section): Force correct section types for
1987 .init_array and friends. Don't sort if doing relocatable link,
1988 Don't sort .ctors and .dtors if ctors_in_init_array.
1989 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1990 (Layout::output_section_name): Add relobj parameter. Change all
1991 callers. Handle .ctors. and .dtors. in code rather than table.
1992 Handle .ctors and .dtors if ctors_in_init_array.
1993 (Layout::match_file_name): New function, moved from output.cc.
1994 * layout.h (class Layout): Update declarations.
1995 * output.cc: Include "layout.h".
1996 (Input_section_sort_entry::get_priority): New function.
1997 (Input_section_sort_entry::match_file_name): Just call
1998 Layout::match_file_name.
1999 (Output_section::Input_section_sort_init_fini_compare::operator()):
2000 Handle .ctors and .dtors. Sort by explicit priority rather than
2001 by name.
2002 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2003 * testsuite/initpri2.c: New test.
2004 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2005 (check_PROGRAMS): Add initpri2.
2006 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2007 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2008 * configure, testsuite/Makefile.in: Rebuild.
2009
e1f74f98
ILT
20102011-06-19 Ian Lance Taylor <iant@google.com>
2011
2012 PR gold/12880
2013 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2014 .interp section to a PT_INTERP segment even if we have seen a
2015 --dynamic-linker option. Don't do it if we have seen a PHDRS
2016 clause in a linker script.
2017 (Layout::finalize): Don't create a .interp section if we've
2018 already create a PT_INTERP segment.
2019 (Layout::create_interp): Always call choose_output_section (revert
2020 patch of 2011-06-17). Don't create PT_INTERP segment.
2021 * script-sections.cc
2022 (Script_sections::create_note_and_tls_segments): Add a .interp
2023 section to a PT_INTERP segment even if we have seen a
2024 --dynamic-linker option.
2025
766f91bb
ILT
20262011-06-18 Ian Lance Taylor <iant@google.com>
2027
2028 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2029 merely because a non-PT_LOAD segment has a dynamic reloc.
2030
0d212c3a
ILT
20312011-06-18 Ian Lance Taylor <iant@google.com>
2032
2033 * layout.cc (Layout::finish_dynamic_section): Don't create
2034 DT_FLAGS entry if not needed.
2035
911a5072
ILT
20362011-06-18 Ian Lance Taylor <iant@google.com>
2037
2038 PR gold/12745
2039 * layout.cc (Layout::layout_eh_frame): Correct handling of
2040 writable .eh_frame section.
2041
534b4e5f
ILT
20422011-06-17 Ian Lance Taylor <iant@google.com>
2043
2044 PR gold/12893
2045 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2046 symbol is redefined with the exact same object and value.
2047
10b4f102
ILT
20482011-06-17 Ian Lance Taylor <iant@google.com>
2049
2050 PR gold/12880
2051 * layout.h (class Layout): Add interp_segment_ field.
2052 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2053 (Layout::attach_allocated_section_to_segment): If making shared
2054 library, put .interp section in PT_INTERP segment.
2055 (Layout::finalize): Also call create_interp if -dynamic-linker
2056 option was used.
2057 (Layout::create_interp): Assert that there is no PT_INTERP
2058 segment. If not using a SECTIONS clause, use make_output_section.
2059 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2060 * script-sections.cc
2061 (Script_sections::create_note_and_tls_segments): If making shared
2062 library, put .interp section in PT_INTERP segment.
2063
a29b0dad
ILT
20642011-06-17 Ian Lance Taylor <iant@google.com>
2065
e588ea8d
ILT
2066 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2067 when making a shared library.
2068
20692011-06-17 Ian Lance Taylor <iant@google.com>
2070
2071 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2072 parameter. Change all callers. Don't issue warning about PC32
2073 against locally defined symbol.
a29b0dad 2074
9d3b0698
ILT
20752011-06-16 Ian Lance Taylor <iant@google.com>
2076
2077 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2078 occurs in same object.
2079
85b0f90c
AM
20802011-06-14 Alan Modra <amodra@gmail.com>
2081
2082 * po/POTFILES.in: Regenerate.
2083
a94907d9
ILT
20842011-06-09 Ian Lance Taylor <iant@google.com>
2085
2086 * script-sections.cc
2087 (Orphan_output_section::set_section_addresses): For a relocatable
2088 link set address to 0.
2089
4fb3a1c3
CC
20902011-06-09 Cary Coutant <ccoutant@google.com>
2091
2092 PR gold/12804
2093 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2094 used with --compress-debug-sections.
2095 * gold/object.cc (Sized_relobj_file::do_layout): Report
2096 uncompressed size of compressed input sections.
2097
61220854
CC
20982011-06-08 Cary Coutant <ccoutant@google.com>
2099
2100 PR gold/12804
2101 * testsuite/two_file_test_2_v1.cc: Change initialization of
2102 v2 to keep it in .data.
2103
e6455dfb
CC
21042011-06-07 Cary Coutant <ccoutant@google.com>
2105
2106 * common.cc (Symbol_table::do_allocate_commons_list): Call
2107 gold_fallback.
2108 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2109 (Errors::fallback): New function.
2110 (gold_fallback): New function.
2111 * errors.h (Errors::fallback): New function.
2112 * gold.cc (gold_exit): Change status parameter to enum; adjust
2113 all callers.
2114 (queue_initial_tasks): Call gold_fallback.
2115 * gold.h: Include cstdlib.
2116 (Exit_status): New enum type.
2117 (gold_exit): Change status parameter to enum.
2118 (gold_fallback): New function.
2119 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2120 (Layout::create_symtab_sections): Likewise.
2121 (Layout::create_shdrs): Likewise.
2122 * main.cc (main): Adjust call to gold_exit.
2123 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2124 (Output_data_got::add_got_entry_pair): Likewise.
2125 (Output_section::add_input_section): Likewise.
2126 (Output_section::add_output_section_data): Likewise.
2127 (Output_segment::set_section_list_addresses): Likewise.
2128 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2129
fb0e076f
CC
21302011-06-07 Cary Coutant <ccoutant@google.com>
2131
2132 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2133 for incremental links.
2134 * output.cc (Output_segment::set_section_list_addresses): Remove
2135 FIXME and test for TLS or BSS.
2136
a5ee4d5d
CC
21372011-06-07 Cary Coutant <ccoutant@google.com>
2138
2139 * testsuite/Makefile.am: Add incremental_copy_test,
2140 incremental_common_test_1.
2141 * testsuite/Makefile.in: Regenerate.
2142 * testsuite/common_test_1_v1.c: New source file.
2143 * testsuite/common_test_1_v2.c: New source file.
2144 * testsuite/copy_test_v1.cc: New source file.
2145
5146f448
CC
21462011-06-07 Cary Coutant <ccoutant@google.com>
2147
2148 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2149 update, allocate common from bss section's free list.
2150 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2151 linker-defined symbols.
2152 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2153 Skip GOT and PLT entries that are no longer referenced.
2154 (Output_section_incremental_inputs::write_info_blocks): Mark
2155 linker-defined symbols.
2156 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2157 * output.cc (Output_section::allocate): New function.
2158 * output.h (Output_section::allocate): New function.
2159 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2160 linker-defined symbols.
2161 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2162 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2163 (Symbol::init_base_output_data): Likewise.
2164 (Symbol::init_base_output_segment): Likewise.
2165 (Symbol::init_base_constant): Likewise.
2166 (Sized_symbol::init_output_data): Likewise.
2167 (Sized_symbol::init_output_segment): Likewise.
2168 (Sized_symbol::init_constant): Likewise.
2169 (Symbol_table::do_define_in_output_data): Likewise.
2170 (Symbol_table::do_define_in_output_segment): Likewise.
2171 (Symbol_table::do_define_as_constant): Likewise.
2172 * symtab.h (Symbol::is_predefined): New function.
2173 (Symbol::init_base_output_data): Add is_predefined parameter.
2174 (Symbol::init_base_output_segment): Likewise.
2175 (Symbol::init_base_constant): Likewise.
2176 (Symbol::is_predefined_): New data member.
2177 (Sized_symbol::init_output_data): Add is_predefined parameter.
2178 (Sized_symbol::init_output_segment): Likewise.
2179 (Sized_symbol::init_constant): Likewise.
2180 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2181
26d3c67d
CC
21822011-06-07 Cary Coutant <ccoutant@google.com>
2183
2184 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2185 instead of emit_copy_reloc.
2186 (Copy_relocs::emit_copy_reloc): Refactor.
2187 (Copy_relocs::make_copy_reloc): New function.
2188 (Copy_relocs::add_copy_reloc): Remove.
2189 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2190 section.
2191 (Copy_relocs::make_copy_reloc): New function.
2192 (Copy_relocs::add_copy_reloc): Remove.
2193 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2194 unchanged input files.
2195 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2196 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2197 Reserve BSS space for COPY relocations.
2198 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2199 (Output_section_incremental_inputs::write_info_blocks): Record
2200 whether a symbol is copied from a shared object.
2201 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2202 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2203 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2204 (Incremental_input_entry_reader::get_output_symbol_index): Add
2205 is_copy parameter.
2206 (Incremental_binary::emit_copy_relocs): New function.
2207 (Incremental_binary::do_emit_copy_relocs): New function.
2208 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2209 new data member.
2210 (Sized_incremental_binary::add_copy_reloc): New function.
2211 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2212 (Sized_incremental_binary::Copy_reloc): New struct.
2213 (Sized_incremental_binary::Copy_relocs): New typedef.
2214 (Sized_incremental_binary::copy_relocs_): New data member.
2215 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2216 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2217 * target.h (Sized_target::emit_copy_reloc): New function.
2218 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2219
7cdb37d9
CC
22202011-06-02 Cary Coutant <ccoutant@google.com>
2221
2222 PR gold/12163
2223 * gold/archive.cc (Archive::Archive): Initialize new data member.
2224 (Archive::include_all_members): Return if archive has already been
2225 included.
2226 * gold/archive.h (Archive::include_all_members_): New data member.
2227
cc643b88
NC
22282011-06-02 Nick Clifton <nickc@redhat.com>
2229
2230 * dynobj.h: Fix spelling mistake in comment.
2231 * output.cc: Likewise.
2232
f62a3ca7 22332011-05-31 Doug Kwan <dougkwan@google.com>
2e702c99 2234 Asier Llano
f62a3ca7
DK
2235
2236 PR gold/12826
cc643b88 2237 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
2238 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2239 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2240 redundant arm_exidx_test.so.
2241 * testsuite/Makefile.in: Regenerate.
2242 (check_SCRIPTS): Add pr12826.sh
2243 (check_DATA): Add pr12826.stdout
2244 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2245 * testsuite/pr12826.sh: New file.
2246 * testsuite/pr12826_1.s: Ditto.
2247 * testsuite/pr12826_1.s: Ditto.
2248
8dbe1edc
ILT
22492011-05-30 Ian Lance Taylor <iant@google.com>
2250
2251 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2252 sections.
2253
c49875be
ILT
22542011-05-29 Ian Lance Taylor <iant@google.com>
2255
2256 PR gold/12804
2257 * testsuite/Makefile.am: Use different file name for two_file_test
2258 temporary file for each incremental test.
2259 * testsuite/Makefile.in: Rebuild.
2260
69d53f7a
ILT
22612011-05-29 Ian Lance Taylor <iant@google.com>
2262
2263 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2264 binary input file is empty.
2265
41d0ab5f
ILT
22662011-05-27 Ian Lance Taylor <iant@google.com>
2267
2268 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2269 (ver_test_9.so): Likewise.
2270 * testsuite/Makefile.in: Rebuild.
2271
89d8a36b
CC
22722011-05-26 Cary Coutant <ccoutant@google.com>
2273
2274 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2275 * incremental.cc (Incremental_inputs::report_input_section): Fix
2276 comment, indentation.
2277 (Incremental_inputs::report_comdat_group): New function.
2278 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2279 of data for incremental input file entry.
2280 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2281 group count, COMDAT group signatures.
2282 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2283 an unchanged input file.
2284 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2285 Initialize new data member.
2286 (Incremental_object_entry::add_comdat_group): New function.
2287 (Incremental_object_entry::get_comdat_group_count): New function.
2288 (Incremental_object_entry::get_comdat_signature_key): New function.
2289 (Incremental_object_entry::groups_): New data member.
2290 (Incremental_inputs::report_comdat_group): New function.
2291 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2292 data for incremental input file entry.
2293 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2294 (Incremental_input_entry_reader::get_input_section): Adjust size of
2295 data for incremental input file entry.
2296 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2297 (Incremental_input_entry_reader::get_comdat_group_signature): New
2298 function.
2299 * object.cc (Sized_relobj::include_section_group): Report kept
2300 COMDAT groups for incremental links.
2301
1706a06f
ILT
23022011-05-24 David Meyer <pdox@google.com>
2303
2304 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2305 with name parameter. Add found_name parameter.
2306 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2307 * dirsearch.h (class Dirsearch): Update declaration.
2308
a10ae760
ILT
23092011-05-24 Ian Lance Taylor <iant@google.com>
2310
2311 * archive.cc (Library_base::should_include_member): Pull in object
2312 from archive if it defines the entry symbol.
2313 * parameters.cc (Parameters::entry): New function.
2314 * parameters.h (class Parameters): Declare entry.
2315 * output.h (class Output_file_header): Remove entry_ field.
2316 * output.cc (Output_file_header::Output_file_header): Remove entry
2317 parameter. Change all callers.
2318 (Output_file_header::entry): Use parameters->entry.
2319 * gold.cc (queue_middle_tasks): Likewise.
2320 * plugin.cc (Plugin_hook::run): Likewise.
2321
aa92d6ed
CC
23222011-05-24 Cary Coutant <ccoutant@google.com>
2323
2324 * gold.cc (queue_initial_tasks): Pass incremental base filename
2325 to Output_file::open_base_file; don't print error message.
2326 * incremental-dump.cc (main): Adjust call to
2327 Output_file::open_for_modification.
2328 * incremental-dump.cc (main): Likewise.
2329 * incremental.cc (Incremental_inputs::report_command_line):
2330 Ignore --incremental-base option when comparing command lines.
2331 Ignore parameter when given as separate argument.
2332 * options.h (class General_options): Add --incremental-base.
2333 * output.cc (Output_file::Output_file):
2334 (Output_file::open_base_file): Add base_name and writable parameters;
2335 read base file into new file; print error message here.
2336 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2337 callers.
2338 * output.h (Output_file::open_for_modification): Rename to...
2339 (Output_file::open_base_file): ...this; add base_name and
2340 writable parameters; adjust all callers.
2341 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2342 callers.
2343 * testsuite/Makefile.am (incremental_test_4): Test
2344 --incremental-base.
2345 * testsuite/Makefile.in: Regenerate.
2346
2eedd706
CC
23472011-05-24 Cary Coutant <ccoutant@google.com>
2348
2349 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2350 incremental_test_4.
2351 * testsuite/Makefile.in: Regenerate.
2352 * testsuite/two_file_test_1_v1.cc: New test source file.
2353 * testsuite/two_file_test_1b_v1.cc: New test source file.
2354 * testsuite/two_file_test_2_v1.cc: New test source file.
2355
0f1c85a6
CC
23562011-05-24 Cary Coutant <ccoutant@google.com>
2357
2358 * dynobj.h (Dynobj::do_dynobj): New function.
2359 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2360 flag and soname for shared objects.
2361 * incremental.cc (Incremental_inputs::report_object): Make
2362 either Incremental_object_entry or Incremental_dynobj_entry; add
2363 soname to string table.
2364 (Incremental_inputs::report_input_section): Add assertion.
2365 (Output_section_incremental_inputs::set_final_data_size): Adjust
2366 type of input file entry for shared libraries; adjust size of
2367 shared library info entry.
2368 (Output_section_incremental_inputs::write_input_files): Write
2369 as_needed flag for shared libraries.
2370 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2371 of input file entry for shared libraries; write soname.
2372 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2373 soname from incremental info.
2374 * incremental.h (enum Incremental_input_flags): Add
2375 INCREMENTAL_INPUT_AS_NEEDED.
2376 (Incremental_input_entry::Incremental_input_entry): Initialize new
2377 data member.
2378 (Incremental_input_entry::set_as_needed): New function.
2379 (Incremental_input_entry::as_needed): New function.
2380 (Incremental_input_entry::do_dynobj_entry): New function.
2381 (Incremental_input_entry::as_needed_): New data member.
2382 (Incremental_object_entry::Incremental_object_entry): Don't check
2383 for shared library.
2384 (Incremental_object_entry::do_type): Likewise.
2385 (class Incremental_dynobj_entry): New class.
2386 (Incremental_input_entry_reader::as_needed): New function.
2387 (Incremental_input_entry_reader::get_soname): New function.
2388 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2389 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2390 size of shared library info entry.
58797674 2391 * layout.cc (Layout::finish_dynamic_section): Don't test for
0f1c85a6
CC
2392 incremental link when adding DT_NEEDED entries.
2393 * object.h (Object::Object): Initialize new data member.
2394 (Object::dynobj): New function.
2395 (Object::set_as_needed): New function.
2396 (Object::as_needed): New function.
2397 (Object::do_dynobj): New function.
2398 (Object::as_needed_): New data member.
2399
6fa2a40b
CC
24002011-05-24 Cary Coutant <ccoutant@google.com>
2401
2402 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2403 info; adjust display of GOT entries.
2404 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2405 vector of input objects; remove file_status_.
2406 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2407 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2408 got_plt reader; call target hooks to reserve GOT entries.
2409 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2410 of input file info header and GOT info entry.
2411 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2412 relocation info.
2413 (Got_plt_view_info::got_descriptor): Remove.
2414 (Got_plt_view_info::sym_index): New data member.
2415 (Got_plt_view_info::input_index): New data member.
2416 (Local_got_offset_visitor::visit): Write input file index.
2417 (Global_got_offset_visitor::visit): Write 0 for input file index.
2418 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2419 with sym_index and input_index.
2420 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2421 incremental info GOT entry; replace got_descriptor with input_index.
2422 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2423 map from input file index to object.
2424 (Sized_relobj_incr::do_layout): Replace direct data member reference
2425 with accessor function.
2426 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2427 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2428 Adjust size of input file info header.
2429 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2430 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2431 (Incremental_input_entry_reader::get_input_section): Adjust size of
2432 input file info header.
2433 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2434 of incremental info GOT entry.
2435 (Incremental_got_plt_reader::get_got_desc): Remove.
2436 (Incremental_got_plt_reader::get_got_symndx): New function.
2437 (Incremental_got_plt_reader::get_got_input_index): New function.
2438 (Sized_incremental_binary::Sized_incremental_binary): Remove
2439 file_status_; add input_objects_.
2440 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2441 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2442 (Sized_incremental_binary::file_is_unchanged): Remove.
2443 (Sized_incremental_binary::set_input_object): New function.
2444 (Sized_incremental_binary::input_object): New function.
2445 (Sized_incremental_binary::file_status_): Remove.
2446 (Sized_incremental_binary::input_objects_): New data member.
2447 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2448 references.
2449 (Sized_relobj_incr::invalid_address): Move to base class.
2450 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2451 class.
2452 (Sized_relobj_incr::do_output_section_offset): Likewise.
2453 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2454 (Sized_relobj_incr::section_offsets_): Likewise.
2455 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2456 function.
2457 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2458 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2459 with accessor function.
2460 (Sized_relobj_file::do_layout): Likewise.
2461 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2462 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2463 (Sized_relobj_file::compute_final_local_value): Replace refs to
2464 section_offsets_ with accessor function.
2465 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2466 * object.h (Relobj::Relobj): Initialize new data members.
2467 (Relobj::add_dyn_reloc): New function.
2468 (Relobj::first_dyn_reloc): New function.
2469 (Relobj::dyn_reloc_count): New function.
2470 (Relobj::first_dyn_reloc_): New data member.
2471 (Relobj::dyn_reloc_count_): New data member.
2472 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2473 references.
2474 (Sized_relobj::Address): New typedef.
2475 (Sized_relobj::invalid_address): Move here from child class.
2476 (Sized_relobj::Sized_relobj): Initialize new data members.
2477 (Sized_relobj::sized_relobj): New function.
2478 (Sized_relobj::is_output_section_offset_invalid): Move here from
2479 child class.
2480 (Sized_relobj::get_output_section_offset): Likewise.
2481 (Sized_relobj::local_has_got_offset): Likewise.
2482 (Sized_relobj::local_got_offset): Likewise.
2483 (Sized_relobj::set_local_got_offset): Likewise.
2484 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2485 (Sized_relobj::clear_got_offsets): New function.
2486 (Sized_relobj::section_offsets): Move here from child class.
2487 (Sized_relobj::do_output_section_offset): Likewise.
2488 (Sized_relobj::do_set_section_offset): Likewise.
2489 (Sized_relobj::Local_got_offsets): Likewise.
2490 (Sized_relobj::local_got_offsets_): Likewise.
2491 (Sized_relobj::section_offsets_): Likewise.
2492 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2493 references.
2494 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2495 class.
2496 (Sized_relobj_file::sized_relobj): New function
2497 (Sized_relobj_file::local_has_got_offset): Move to base class.
2498 (Sized_relobj_file::local_got_offset): Likewise.
2499 (Sized_relobj_file::set_local_got_offset): Likewise.
2500 (Sized_relobj_file::get_output_section_offset): Likewise.
2501 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2502 (Sized_relobj_file::do_output_section_offset): Likewise.
2503 (Sized_relobj_file::do_set_section_offset): Likewise.
2504 (Sized_relobj_file::Local_got_offsets): Likewise.
2505 (Sized_relobj_file::local_got_offsets_): Likewise.
2506 (Sized_relobj_file::section_offsets_): Likewise.
2507 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2508 (all constructors).
2509 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2510 (Output_reloc::get_symbol_index): Likewise.
2511 (Output_reloc::local_section_offset): Likewise.
2512 (Output_reloc::get_address): Likewise.
2513 (Output_reloc::symbol_value): Likewise.
2514 (Output_data_got::reserve_slot): Move to class definition.
2515 (Output_data_got::reserve_local): New function.
2516 (Output_data_got::reserve_slot_for_global): Remove.
2517 (Output_data_got::reserve_global): New function.
2518 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2519 (all constructors, two instantiations).
2520 (Output_reloc::get_relobj): New function (two instantiations).
2521 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2522 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2523 (Output_data_reloc::add_global): Adjust type of relobj.
2524 (Output_data_reloc::add_global_relative): Likewise.
2525 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2526 (Output_data_reloc::add_local): Likewise.
2527 (Output_data_reloc::add_local_relative): Likewise.
2528 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2529 (Output_data_reloc::add_local_section): Likewise.
2530 (Output_data_reloc::add_output_section): Likewise.
2531 (Output_data_reloc::add_absolute): Likewise.
2532 (Output_data_reloc::add_target_specific): Likewise.
2533 (Output_data_got::reserve_slot): Move definition here.
2534 (Output_data_got::reserve_local): New function.
2535 (Output_data_got::reserve_global): New function.
2536 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2537 section_offsets_ with accessor function.
2538 (Sized_relobj_file::write_sections): Likewise.
2539 (Sized_relobj_file::do_relocate_sections): Likewise.
2540 * target.h (Sized_target::reserve_local_got_entry): New function.
2541 (Sized_target::reserve_global_got_entry): New function.
2542 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2543 (Target_x86_64::reserve_global_got_entry): New function.
2544 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2545
4829d394
CC
25462011-05-23 Cary Coutant <ccoutant@google.com>
2547
2548 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2549 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2550 bit when checking got_type.
2551 * incremental.cc (Sized_incremental_binary::setup_readers):
2552 Store symbol table and string table locations; initialize bit vector
2553 of file status flags.
2554 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2555 unchanged files.
2556 (Sized_incremental_binary::do_process_got_plt): New function.
2557 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2558 (Output_section_incremental_inputs::set_final_data_size): Record
2559 file index for each input file.
2560 (Output_section_incremental_inputs::write_got_plt): Store file index
2561 instead of input entry offset for each GOT entry.
2562 * incremental.h
2563 (Incremental_input_entry::Incremental_input_entry): Initialize new
2564 data member.
2565 (Incremental_input_entry::set_offset): Store file index.
2566 (Incremental_input_entry::get_file_index): New function.
2567 (Incremental_input_entry::file_index_): New data member.
2568 (Incremental_binary::process_got_plt): New function.
2569 (Incremental_binary::do_process_got_plt): New function.
2570 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2571 data members.
2572 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2573 (Sized_incremental_binary::set_file_is_unchanged): New function.
2574 (Sized_incremental_binary::file_is_unchanged): New function.
2575 (Sized_incremental_binary::do_process_got_plt): New function.
2576 (Sized_incremental_binary::file_status_): New data member.
2577 (Sized_incremental_binary::main_symtab_loc_): New data member.
2578 (Sized_incremental_binary::main_strtab_loc_): New data member.
2579 * output.cc (Output_data_got::Got_entry::write): Add case
2580 RESERVED_CODE.
2581 (Output_data_got::add_global): Call add_got_entry.
2582 (Output_data_got::add_global_plt): Likewise.
2583 (Output_data_got::add_global_with_rel): Likewise.
2584 (Output_data_got::add_global_with_rela): Likewise.
2585 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2586 (Output_data_got::add_global_pair_with_rela): Likewise.
2587 (Output_data_got::add_local): Call add_got_entry.
2588 (Output_data_got::add_local_plt): Likewise.
2589 (Output_data_got::add_local_with_rel): Likewise.
2590 (Output_data_got::add_local_with_rela): Likewise.
2591 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2592 (Output_data_got::add_local_pair_with_rela): Likewise.
2593 (Output_data_got::reserve_slot): New function.
2594 (Output_data_got::reserve_slot_for_global): New function.
2595 (Output_data_got::add_got_entry): New function.
2596 (Output_data_got::add_got_entry_pair): New function.
2597 (Output_section::add_output_section_data): Edit FIXME.
2598 * output.h
2599 (Output_section_data_build::Output_section_data_build): New
2600 constructor with size parameter.
2601 (Output_data_space::Output_data_space): Likewise.
2602 (Output_data_got::Output_data_got): Initialize new data member; new
2603 constructor with size parameter.
2604 (Output_data_got::add_constant): Call add_got_entry.
2605 (Output_data_got::reserve_slot): New function.
2606 (Output_data_got::reserve_slot_for_global): New function.
2607 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2608 (Output_data_got::add_got_entry): New function.
2609 (Output_data_got::add_got_entry_pair): New function.
2610 (Output_data_got::free_list_): New data member.
2611 * target.h (Sized_target::init_got_plt_for_update): New function.
2612 (Sized_target::register_global_plt_entry): New function.
2613 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2614 Initialize new data member; call init; add constructor with PLT count.
2615 (Output_data_plt_x86_64::init): New function.
2616 (Output_data_plt_x86_64::add_relocation): New function.
2617 (Output_data_plt_x86_64::reserve_slot): New function.
2618 (Output_data_plt_x86_64::free_list_): New data member.
2619 (Target_x86_64::init_got_plt_for_update): New function.
2620 (Target_x86_64::register_global_plt_entry): New function.
2621 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2622 incremental updates.
2623 (Output_data_plt_x86_64::add_relocation): New function.
2624 * testsuite/object_unittest.cc (Object_test): Set default options.
2625
ec69d6da
ILT
26262011-05-16 Ian Lance Taylor <iant@google.com>
2627
2628 * options.h (class General_options): Make -i a synonym for -r.
2629
732e31de
ILT
26302011-05-16 Ian Lance Taylor <iant@google.com>
2631
2632 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2633
403676b5
CC
26342011-05-10 Cary Coutant <ccoutant@google.com>
2635
2636 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2637 strip_all (-s).
2638
5b7b7d6e
ILT
26392011-05-06 Ian Lance Taylor <iant@google.com>
2640
2641 * layout.cc (Layout::layout): If the output section flags change,
2642 update the ordering.
2643
f0f9babf
CC
26442011-04-25 Cary Coutant <ccoutant@google.com>
2645
2646 * incremental-dump.cc (dump_incremental_inputs): Print local
2647 symbol info for each input file.
2648 * incremental.cc
2649 (Output_section_incremental_inputs::set_final_data_size): Add local
2650 symbol info to input file entries in incremental info.
2651 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2652 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2653 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2654 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2655 implementation.
2656 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2657 (Sized_incr_relobj::do_relocate): Write the local symbols.
2658 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2659 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2660 Adjust size of input file header.
2661 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2662 (Incremental_inputs_reader::get_local_symbol_count): New function.
2663 (Incremental_inputs_reader::get_input_section): Adjust size of input
2664 file header.
2665 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2666 (Sized_incr_relobj::This): New typedef.
2667 (Sized_incr_relobj::sym_size): New const data member.
2668 (Sized_incr_relobj::Local_symbol): New struct.
2669 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2670 (Sized_incr_relobj::do_local_symbol_offset): New function.
2671 (Sized_incr_relobj::local_symbol_count_): New data member.
2672 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2673 (Sized_incr_relobj::local_symbol_index_): New data member.
2674 (Sized_incr_relobj::local_symbol_offset_): New data member.
2675 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2676 (Sized_incr_relobj::local_symbols_): New data member.
2677 * object.h (Relobj::output_local_symbol_count): New function.
2678 (Relobj::local_symbol_offset): New function.
2679 (Relobj::do_output_local_symbol_count): New function.
2680 (Relobj::do_local_symbol_offset): New function.
2681 (Sized_relobj::do_output_local_symbol_count): New function.
2682 (Sized_relobj::do_local_symbol_offset): New function.
2683
d0a9ace3
ILT
26842011-04-22 Vladimir Simonov <sv@sw.ru>
2685
2686 * descriptors.cc (set_close_on_exec): New function.
2687 (Descriptors::open): Use set_close_on_exec.
2688 * output.cc (S_ISLNK): Define if not defined.
2689
94a3fc8b
CC
26902011-04-22 Cary Coutant <ccoutant@google.com>
2691
2692 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2693 global symbol map.
2694 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2695 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2696 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2697 relocations.
2698 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2699 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2700 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2701 * incremental.h
2702 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2703 function.
2704 (Incremental_binary::apply_incremental_relocs): New function.
2705 (Incremental_binary::do_apply_incremental_relocs): New function.
2706 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2707 data member.
2708 (Sized_incremental_binary::add_global_symbol): New function.
2709 (Sized_incremental_binary::global_symbol): New function.
2710 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2711 (Sized_incremental_binary::symbol_map_): New data member.
2712 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2713 * target.h (Sized_target::apply_relocation): New function.
2714 * target-reloc.h (apply_relocation): New function.
2715 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2716
c87e4302
DK
27172011-04-22 Doug Kwan <dougkwan@google.com>
2718
2719 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2720 flag of a SHT_ARM_EXIDX section.
2e702c99 2721 * testsuite/Makefile.am (arm_exidx_test): New test rules.
c87e4302
DK
2722 * testsuite/Makefile.in: Regenerate.
2723 * testsuite/arm_exidx_test.s: New file.
2724 * testsuite/arm_exidx_test.sh: Same.
2725
e7782cf6
CC
27262011-04-20 Cary Coutant <ccoutant@google.com>
2727
2728 PR gold/12689
2729 * archive.h (Incremental_archive_entry::Archive_member):
2730 Initialize arg_serial_ (second constructor).
2731
308ecdc7
ILT
27322011-04-17 Ian Lance Taylor <iant@google.com>
2733
2734 * object.cc (Relocate_info::location): Simplify location string.
2735 * errors.cc (Errors::error_at_location): Don't print program
2736 name.
2737 (Errors::warning_at_location): Likewise.
2738 (Errors::undefined_symbol): Likewise.
2739 * testsuite/debug_msg.sh: Update accordingly.
2740
bec5b579
CC
27412011-04-14 Cary Coutant <ccoutant@google.com>
2742
2743 * gold/layout.cc (Layout::symtab_section_offset): New function.
2744 * gold/layout.h (Layout::symtab_section_offset): New function.
2745 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2746
88597d34
ILT
27472011-04-12 Ian Lance Taylor <iant@google.com>
2748
2749 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2750 with MREMAP_MAYMOVE.
2751 * output.h (class Output_file): Add map_is_allocated_ field.
2752 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2753 not available, provide stubs. If mremap is not available, #define
2754 it to gold_mremap.
2755 (MREMAP_MAYMOVE): Define if not defined.
2756 (Output_file::Output_file): Initialize map_is_allocated_.
2757 (Output_file::resize): Check map_is_allocated_.
2758 (Output_file::map_anonymous): If mmap fails, use malloc.
2759 (Output_file::unmap): Don't do anything for an anonymous map.
2760 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2761 is not available, provide stubs.
2762 (File_read::View::~View): Use free rather than delete[].
2763 (File_read::make_view): Use malloc rather than new[]. If mmap
2764 fails, use malloc.
2765 (File_read::find_or_make_view): Use malloc rather than new[].
2766 * gold.h: Remove HAVE_REMAP code.
2767 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2768 exists. Rename mremap to gold_mremap. If mmap is not available
2769 don't do anything.
2770 * configure, config.in: Rebuild.
2771
11e361bc
ILT
27722011-04-11 Ian Lance Taylor <iant@google.com>
2773
2774 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2775 initialize local variable v.
2776
cdc29364
CC
27772011-04-11 Cary Coutant <ccoutant@google.com>
2778
2779 * archive.cc (Archive::include_member): Adjust call to
2780 report_object.
2781 (Add_archive_symbols::run): Track argument serial numbers.
2782 (Lib_group::include_member): Likewise.
2783 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2784 * archive.h (Incremental_archive_entry::Archive_member):
2785 Initialize arg_serial_.
2786 (Archive_member::arg_serial_): New data member.
2787 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2788 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2789 incremental link.
2790 (Sized_dynobj::do_for_all_local_got_entries): New function.
2791 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2792 function.
2793 * fileread.cc (get_mtime): New function.
2794 * fileread.h (get_mtime): New function.
2795 * gold.cc (queue_initial_tasks): Check for incremental update.
2796 (process_incremental_input): New function.
2797 (queue_middle_tasks): Don't force valid target for incremental
2798 update.
2799 * incremental-dump.cc (find_input_containing_global): Adjust
2800 size of symbol info entry.
2801 (dump_incremental_inputs): Dump argument serial number and
2802 in_system_directory flag; bias shndx by 1; print symbol names
2803 when dumping per-file symbol lists; use new symbol info readers.
2804 * incremental.cc
2805 (Output_section_incremental_inputs:update_data_size): New function.
2806 (Sized_incremental_binary::setup_readers): Setup input readers
2807 for each input file; build maps for files added from libraries
2808 and scripts.
2809 (Sized_incremental_binary::check_input_args): New function.
2810 (Sized_incremental_binary::do_check_inputs): Build map of argument
2811 serial numbers to input arguments.
2812 (Sized_incremental_binary::do_file_has_changed): Rename
2813 do_file_is_unchanged to this; compare file modification times.
2814 (Sized_incremental_binary::do_init_layout): New function.
2815 (Sized_incremental_binary::do_reserve_layout): New function.
2816 (Sized_incremental_binary::do_get_input_reader): Remove.
2817 (Sized_incremental_binary::get_symtab_view): New function.
2818 (Incremental_checker::can_incrementally_link_output_file): Remove.
2819 (Incremental_inputs::report_command_line): Exclude --debug options.
2820 (Incremental_inputs::report_archive_begin): Add parameter; track
2821 argument serial numbers; don't put input file entry for archive
2822 before archive members.
2823 (Incremental_inputs::report_archive_end): Put input file entry
2824 for archive after archive members.
2825 (Incremental_inputs::report_object): Add parameter; track argument
2826 serial numbers and in_system_directory flag.
2827 (Incremental_inputs::report_script): Add parameter; track argument
2828 serial numbers.
2829 (Output_section_incremental_inputs::set_final_data_size): Adjust
2830 size of symbol info entry; check for forwarding symbols.
2831 (Output_section_incremental_inputs::write_input_files): Write
2832 in_system_directory flag and argument serial number.
2833 (Output_section_incremental_inputs::write_info_blocks): Map section
2834 indices between incremental info and original input file; store
2835 input section index for each symbol.
2836 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2837 change operator() to visit().
2838 (class Global_got_offset_visitor): Likewise.
2839 (class Global_symbol_visitor_got_plt):
2840 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2841 classes.
2842 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2843 (Sized_incr_relobj::do_read_symbols): New function.
2844 (Sized_incr_relobj::do_layout): New function.
2845 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2846 (Sized_incr_relobj::do_add_symbols): New function.
2847 (Sized_incr_relobj::do_should_include_member): New function.
2848 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2849 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2850 (Sized_incr_relobj::do_section_size): New function.
2851 (Sized_incr_relobj::do_section_name): New function.
2852 (Sized_incr_relobj::do_section_contents): New function.
2853 (Sized_incr_relobj::do_section_flags): New function.
2854 (Sized_incr_relobj::do_section_entsize): New function.
2855 (Sized_incr_relobj::do_section_address): New function.
2856 (Sized_incr_relobj::do_section_type): New function.
2857 (Sized_incr_relobj::do_section_link): New function.
2858 (Sized_incr_relobj::do_section_info): New function.
2859 (Sized_incr_relobj::do_section_addralign): New function.
2860 (Sized_incr_relobj::do_initialize_xindex): New function.
2861 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2862 (Sized_incr_relobj::do_read_relocs): New function.
2863 (Sized_incr_relobj::do_gc_process_relocs): New function.
2864 (Sized_incr_relobj::do_scan_relocs): New function.
2865 (Sized_incr_relobj::do_count_local_symbols): New function.
2866 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2867 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2868 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2869 (Sized_incr_relobj::do_relocate): New function.
2870 (Sized_incr_relobj::do_set_section_offset): New function.
2871 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2872 (Sized_incr_dynobj::do_read_symbols): New function.
2873 (Sized_incr_dynobj::do_layout): New function.
2874 (Sized_incr_dynobj::do_add_symbols): New function.
2875 (Sized_incr_dynobj::do_should_include_member): New function.
2876 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2877 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2878 (Sized_incr_dynobj::do_section_size): New function.
2879 (Sized_incr_dynobj::do_section_name): New function.
2880 (Sized_incr_dynobj::do_section_contents): New function.
2881 (Sized_incr_dynobj::do_section_flags): New function.
2882 (Sized_incr_dynobj::do_section_entsize): New function.
2883 (Sized_incr_dynobj::do_section_address): New function.
2884 (Sized_incr_dynobj::do_section_type): New function.
2885 (Sized_incr_dynobj::do_section_link): New function.
2886 (Sized_incr_dynobj::do_section_info): New function.
2887 (Sized_incr_dynobj::do_section_addralign): New function.
2888 (Sized_incr_dynobj::do_initialize_xindex): New function.
2889 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2890 (make_sized_incremental_object): New function.
2891 (Incremental_library::copy_unused_symbols): New function.
2892 (Incremental_library::do_for_all_unused_symbols): New function.
2893 * incremental.h (enum Incremental_input_flags): New type.
2894 (class Incremental_checker): Remove.
2895 (Incremental_input_entry::Incremental_input_entry): Add argument
2896 serial number.
2897 (Incremental_input_entry::arg_serial): New function.
2898 (Incremental_input_entry::set_is_in_system_directory): New function.
2899 (Incremental_input_entry::is_in_system_directory): New function.
2900 (Incremental_input_entry::arg_serial_): New data member.
2901 (Incremental_input_entry::is_in_system_directory_): New data member.
2902 (class Script_info): Move here from script.h.
2903 (Script_info::Script_info): Add filename parameter.
2904 (Script_info::filename): New function.
2905 (Script_info::filename_): New data member.
2906 (Incremental_script_entry::Incremental_script_entry): Add argument
2907 serial number.
2908 (Incremental_object_entry::Incremental_object_entry): Likewise.
2909 (Incremental_object_entry::add_input_section): Build list of input
2910 sections with map to original shndx.
2911 (Incremental_object_entry::get_input_section_index): New function.
2912 (Incremental_object_entry::shndx_): New data member.
2913 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2914 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2915 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2916 serial number.
2917 (Incremental_inputs::report_archive_begin): Likewise.
2918 (Incremental_inputs::report_object): Likewise.
2919 (Incremental_inputs::report_script): Likewise.
2920 (class Incremental_global_symbol_reader): New class.
2921 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2922 and store flags and input file type.
2923 (Incremental_input_entry_reader::arg_serial): New function.
2924 (Incremental_input_entry_reader::type): Extract type from flags.
2925 (Incremental_input_entry_reader::is_in_system_directory): New function.
2926 (Incremental_input_entry_reader::get_input_section_count): Call
2927 accessor function for type.
2928 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2929 function for type; adjust size of global symbol entry.
2930 (Incremental_input_entry_reader::get_global_symbol_count): Call
2931 accessor function for type.
2932 (Incremental_input_entry_reader::get_object_count): Likewise.
2933 (Incremental_input_entry_reader::get_object_offset): Likewise.
2934 (Incremental_input_entry_reader::get_member_count): Likewise.
2935 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2936 (Incremental_input_entry_reader::get_member_offset): Likewise.
2937 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2938 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2939 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2940 (Incremental_input_entry_reader::get_global_symbol_reader): New
2941 function.
2942 (Incremental_input_entry_reader::get_output_symbol_index): New
2943 function.
2944 (Incremental_input_entry_reader::type_): Remove.
2945 (Incremental_input_entry_reader::flags_): New data member.
2946 (Incremental_inputs_reader::input_file_offset): New function.
2947 (Incremental_inputs_reader::input_file_index): New function.
2948 (Incremental_inputs_reader::input_file): Call input_file_offset.
2949 (Incremental_inputs_reader::input_file_at_offset): New function.
2950 (Incremental_relocs_reader::get_r_type): Reformat.
2951 (Incremental_relocs_reader::get_r_shndx): Reformat.
2952 (Incremental_relocs_reader::get_r_offset): Reformat.
2953 (Incremental_relocs_reader::data): New function.
2954 (Incremental_binary::Incremental_binary): Initialize new data members.
2955 (Incremental_binary::check_inputs): Add cmdline parameter.
2956 (Incremental_binary::file_is_unchanged): Remove.
2957 (Input_reader::arg_serial): New function.
2958 (Input_reader::get_unused_symbol_count): New function.
2959 (Input_reader::get_unused_symbol): New function.
2960 (Input_reader::do_arg_serial): New function.
2961 (Input_reader::do_get_unused_symbol_count): New function.
2962 (Input_reader::do_get_unused_symbol): New function.
2963 (Incremental_binary::input_file_count): New function.
2964 (Incremental_binary::get_input_reader): Change signature to use
2965 index instead of filename.
2966 (Incremental_binary::file_has_changed): New function.
2967 (Incremental_binary::get_input_argument): New function.
2968 (Incremental_binary::get_library): New function.
2969 (Incremental_binary::get_script_info): New function.
2970 (Incremental_binary::init_layout): New function.
2971 (Incremental_binary::reserve_layout): New function.
2972 (Incremental_binary::output_file): New function.
2973 (Incremental_binary::do_check_inputs): New function.
2974 (Incremental_binary::do_file_is_unchanged): Remove.
2975 (Incremental_binary::do_file_has_changed): New function.
2976 (Incremental_binary::do_init_layout): New function.
2977 (Incremental_binary::do_reserve_layout): New function.
2978 (Incremental_binary::do_input_file_count): New function.
2979 (Incremental_binary::do_get_input_reader): Change signature.
2980 (Incremental_binary::input_args_map_): New data member.
2981 (Incremental_binary::library_map_): New data member.
2982 (Incremental_binary::script_map_): New data member.
2983 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2984 new data members.
2985 (Sized_incremental_binary::output_section): New function.
2986 (Sized_incremental_binary::inputs_reader): Add const.
2987 (Sized_incremental_binary::symtab_reader): Add const.
2988 (Sized_incremental_binary::relocs_reader): Add const.
2989 (Sized_incremental_binary::got_plt_reader): Add const.
2990 (Sized_incremental_binary::get_symtab_view): New function.
2991 (Sized_incremental_binary::Inputs_reader): New typedef.
2992 (Sized_incremental_binary::Input_entry_reader): New typedef.
2993 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2994 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2995 (Sized_incremental_binary::do_file_has_changed): New function.
2996 (Sized_incremental_binary::do_init_layout): New function.
2997 (Sized_incremental_binary::do_reserve_layout): New function.
2998 (Sized_input_reader::Inputs_reader): Remove.
2999 (Sized_input_reader::Input_entry_reader): Remove.
3000 (Sized_input_reader::do_arg_serial): New function.
3001 (Sized_input_reader::do_get_unused_symbol_count): New function.
3002 (Sized_input_reader::do_get_unused_symbol): New function.
3003 (Sized_incremental_binary::do_input_file_count): New function.
3004 (Sized_incremental_binary::do_get_input_reader): Change signature;
3005 use index instead of filename.
3006 (Sized_incremental_binary::section_map_): New data member.
3007 (Sized_incremental_binary::input_entry_readers_): New data member.
3008 (class Sized_incr_relobj): New class.
3009 (class Sized_incr_dynobj): New class.
3010 (make_sized_incremental_object): New function.
3011 (class Incremental_library): New class.
3012 * layout.cc (Free_list::num_lists): New static data member.
3013 (Free_list::num_nodes): New static data member.
3014 (Free_list::num_removes): New static data member.
3015 (Free_list::num_remove_visits): New static data member.
3016 (Free_list::num_allocates): New static data member.
3017 (Free_list::num_allocate_visits): New static data member.
3018 (Free_list::init): New function.
3019 (Free_list::remove): New function.
3020 (Free_list::allocate): New function.
3021 (Free_list::dump): New function.
3022 (Free_list::print_stats): New function.
3023 (Layout_task_runner::run): Resize output file for incremental updates.
3024 (Layout::Layout): Initialize new data members.
3025 (Layout::set_incremental_base): New function.
3026 (Layout::init_fixed_output_section): New function.
3027 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3028 incremental updates.
3029 (Layout::create_gold_note): Do not create gold note section for
3030 incremental updates.
3031 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3032 for incremental updates.
3033 (Layout::set_section_offsets): For incremental updates, allocate space
3034 from free list.
3035 (Layout::create_symtab_sections): Layout with offsets relative to
3036 start of section; for incremental updates, allocate space from free
3037 list.
3038 (Layout::create_shdrs): For incremental updates, allocate space from
3039 free list.
3040 (Layout::finish_dynamic_section): For incremental updates, do not
3041 check --as-needed (fixed in subsequent patch).
3042 * layout.h (class Free_list): New class.
3043 (Layout::set_incremental_base): New function.
3044 (Layout::incremental_base): New function.
3045 (Layout::init_fixed_output_section): New function.
3046 (Layout::allocate): New function.
3047 (Layout::incremental_base_): New data member.
3048 (Layout::free_list_): New data member.
3049 * main.cc (main): Print Free_list statistics.
3050 * object.cc (Relobj::finalize_incremental_relocs): Add
3051 clear_counts parameter; clear counts only when clear_counts is set.
3052 (Sized_relobj::Sized_relobj): Initialize new base class.
3053 (Sized_relobj::do_layout): Don't report special sections.
3054 (Sized_relobj::do_for_all_local_got_entries): New function.
3055 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3056 symtab_off to all symbol table offsets.
3057 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3058 * object.h (class Got_offset_list): Move to top of file.
3059 (Object::Object): Allow case where input_file == NULL.
3060 (Object::~Object): Likewise.
3061 (Object::input_file): Assert that input_file != NULL.
3062 (Object::lock): Allow case where input_file == NULL.
3063 (Object::unlock): Likewise.
3064 (Object::is_locked): Likewise.
3065 (Object::token): Likewise.
3066 (Object::release): Likewise.
3067 (Object::is_incremental): New function.
3068 (Object::get_mtime): New function.
3069 (Object::for_all_local_got_entries): New function.
3070 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3071 (Object::set_is_in_system_directory): New function.
3072 (Object::is_in_system_directory): New function.
3073 (Object::do_is_incremental): New function.
3074 (Object::do_get_mtime): New function.
3075 (Object::do_for_all_local_got_entries): New function.
3076 (Object::is_in_system_directory_): New data member.
3077 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3078 (class Sized_relobj_base): New class.
3079 (class Sized_relobj): Derive from Sized_relobj_base.
3080 (class Sized_relobj::Symbols): Redeclare from base class.
3081 (class Sized_relobj::local_got_offset_list): Remove.
3082 (class Sized_relobj::Output_sections): Redeclare from base class.
3083 (class Sized_relobj::do_for_all_local_got_entries): New function.
3084 (class Sized_relobj::write_local_symbols): Add offset parameter.
3085 (class Sized_relobj::local_symbol_offset_): Update comment.
3086 (class Sized_relobj::local_dynsym_offset_): Update comment.
3087 * options.cc (Input_arguments::add_file): Remove const.
3088 * options.h (Input_file_argument::Input_file_argument):
3089 Initialize arg_serial_ (all constructors).
3090 (Input_file_argument::set_arg_serial): New function.
3091 (Input_file_argument::arg_serial): New function.
3092 (Input_file_argument::arg_serial_): New data member.
3093 (Input_arguments::Input_arguments): Initialize file_count_.
3094 (Input_arguments::add_file): Remove const.
3095 (Input_arguments::number_of_input_files): New function.
3096 (Input_arguments::file_count_): New data member.
3097 (Command_line::number_of_input_files): Call
3098 Input_arguments::number_of_input_files.
3099 * output.cc (Output_segment_headers::Output_segment_headers):
3100 Set current size.
3101 (Output_section::Input_section::current_data_size): New function.
3102 (Output_section::Output_section): Initialize new data members.
3103 (Output_section::add_input_section): Don't do merge sections for
3104 an incremental link; allocate space from free list for an
3105 incremental update.
3106 (Output_section::add_output_section_data): Allocate space from
3107 free list for an incremental update.
3108 (Output_section::update_data_size): New function.
3109 (Output_section::set_fixed_layout): New function.
3110 (Output_section::reserve): New function.
3111 (Output_segment::set_section_addresses): Remove const.
3112 (Output_segment::set_section_list_addresses): Remove const; allocate
3113 space from free list for an incremental update.
3114 (Output_segment::set_offset): Adjust size of RELRO segment for an
3115 incremental update.
3116 * output.h (Output_data::current_data_size): Move here from
3117 child classes.
3118 (Output_data::pre_finalize_data_size): New function.
3119 (Output_data::update_data_size): New function.
3120 (Output_section_headers::update_data_size): new function.
3121 (Output_section_data_build::current_data_size): Move to Output_data.
3122 (Output_data_strtab::update_data_size): New function.
3123 (Output_section::current_data_size): Move to Output_data.
3124 (Output_section::set_fixed_layout): New function.
3125 (Output_section::has_fixed_layout): New function.
3126 (Output_section::reserve): New function.
3127 (Output_section::update_data_size): New function.
3128 (Output_section::has_fixed_layout_): New data member.
3129 (Output_section::free_list_): New data member.
3130 (Output_segment::set_section_addresses): Remove const.
3131 (Output_segment::set_section_list_addresses): Remove const.
3132 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3133 New function.
3134 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3135 New function.
3136 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3137 parameter when calling Add_symbols constructor; store argument
3138 serial number for members of a lib group.
3139 (Add_symbols::locks): Allow case where token == NULL.
3140 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3141 (Read_member::~Read_member): New function.
3142 (Read_member::is_runnable): New function.
3143 (Read_member::locks): New function.
3144 (Read_member::run): New function.
3145 (Check_script::~Check_script): New function.
3146 (Check_script::is_runnable): New function.
3147 (Check_script::locks): New function.
3148 (Check_script::run): New function.
3149 (Check_library::~Check_library): New function.
3150 (Check_library::is_runnable): New function.
3151 (Check_library::locks): New function.
3152 (Check_library::run): New function.
3153 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3154 (Add_symbols::library_): New data member.
3155 (class Read_member): New class.
3156 (class Check_script): New class.
3157 (class Check_library): New class.
3158 * reloc.cc (Read_relocs::is_runnable): Allow case where
3159 token == NULL.
3160 (Read_relocs::locks): Likewise.
3161 (Scan_relocs::locks): Likewise.
3162 (Relocate_task::locks): Likewise.
3163 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3164 to clear counters.
3165 (Sized_relobj::incremental_relocs_scan): Fix comment.
3166 (Sized_relobj::do_relocate): Pass output file offset to
3167 write_local_symbols.
3168 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3169 from class declaration.
3170 * script.cc (read_input_script): Allocate Script_info; pass
3171 argument serial number to report_script.
3172 * script.h (class Script_info): Move to incremental.h.
3173 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3174 * symtab.h (Symbol_table::add_from_incrobj): New function.
3175 (Symbol_table::set_file_offset): New function.
3176
b961d0d7
CC
31772011-04-05 Cary Coutant <ccoutant@google.com>
3178
3179 * incremental-dump.cc (dump_incremental_inputs): Change signature
3180 to take a Sized_incremental_binary; change caller. Use readers
3181 in Sized_incremental_binary.
3182 * incremental.cc
3183 (Sized_incremental_binary::find_incremental_inputs_sections):
3184 Rename do_find_incremental_inputs_sections to this.
3185 (Sized_incremental_binary::setup_readers): New function.
3186 (Sized_incremental_binary::do_check_inputs): Check
3187 has_incremental_info_ flag; move setup code to setup_readers;
3188 use input readers.
3189 (Sized_incremental_binary::do_file_is_unchanged): New function.
3190 (Sized_incremental_binary::do_get_input_reader): New function.
3191 * incremental.h (class Incremental_binary): Move to end of file.
3192 (Incremental_binary::file_is_unchanged): New function.
3193 (Incremental_binary::do_file_is_unchanged): New function.
3194 (Incremental_binary::Input_reader): New class.
3195 (Incremental_binary::get_input_reader): New function.
3196 (class Sized_incremental_binary): Move to end of file.
3197 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3198 input section reader classes.
3199 (Sized_incremental_binary::has_incremental_info): New function.
3200 (Sized_incremental_binary::inputs_reader): New function.
3201 (Sized_incremental_binary::symtab_reader): New function.
3202 (Sized_incremental_binary::relocs_reader): New function.
3203 (Sized_incremental_binary::got_plt_reader): New function.
3204 (Sized_incremental_binary::do_file_is_unchanged): New function.
3205 (Sized_incremental_binary::Sized_input_reader): New class.
3206 (Sized_incremental_binary::get_input_reader): New function.
3207 (Sized_incremental_binary::find_incremental_inputs_sections):
3208 Rename do_find_incremental_inputs_sections to this.
3209 (Sized_incremental_binary::setup_readers): New function.
3210 (Sized_incremental_binary::has_incremental_info_): New data member.
3211 (Sized_incremental_binary::inputs_reader_): New data member.
3212 (Sized_incremental_binary::symtab_reader_): New data member.
3213 (Sized_incremental_binary::relocs_reader_): New data member.
3214 (Sized_incremental_binary::got_plt_reader_): New data member.
3215 (Sized_incremental_binary::current_input_file_): New data member.
3216
a869183f
PP
32172011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3218
3219 PR gold/12640
3220 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3221 violation.
3222
32232011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
3224
3225 * archive.cc (Archive::include_member): Adjust call to report_object.
3226 (Add_archive_symbols::run): Add script_info to call to
3227 report_archive_begin.
3228 (Lib_group::include_member): Adjust call to report_object.
3229 (Add_lib_group_symbols::run): Adjust call to report_object.
3230 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3231 blocks. Add object count for script input files.
3232 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3233 script_info parameter; change all callers.
3234 (Incremental_inputs::report_object): Add script_info parameter;
3235 change all callers.
3236 (Incremental_inputs::report_script): Store backpointer to
3237 incremental info entry.
3238 (Output_section_incremental_inputs::set_final_data_size): Record
3239 additional information for scripts.
3240 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3241 * incremental.h (Incremental_script_entry::add_object): New function.
3242 (Incremental_script_entry::get_object_count): New function.
3243 (Incremental_script_entry::get_object): New function.
3244 (Incremental_script_entry::objects_): New data member; adjust
3245 constructor.
3246 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3247 (Incremental_inputs::report_object): Add script_info parameter.
3248 (Incremental_inputs_reader::get_object_count): New function.
3249 (Incremental_inputs_reader::get_object_offset): New function.
3250 * options.cc (Input_arguments::add_file): Return reference to
3251 new input argument.
3252 * options.h (Input_argument::set_script_info): New function.
3253 (Input_argument::script_info): New function.
3254 (Input_argument::script_info_): New data member; adjust all
3255 constructors.
3256 (Input_file_group::add_file): Return reference to new input argument.
3257 (Input_file_lib::add_file): Likewise.
3258 (Input_arguments::add_file): Likewise.
3259 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3260 * script.cc (Parser_closure::Parser_closure): Add script_info
3261 parameter; adjust all callers.
3262 (Parser_closure::script_info): New function.
3263 (Parser_closure::script_info_): New data member.
3264 (read_input_script): Report scripts earlier to incremental info.
3265 (script_add_file): Set script_info in Input_argument.
3266 (script_add_library): Likewise.
3267 * script.h (Script_options::Script_info): Rewrite class.
3268
a869183f 32692011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
3270
3271 * archive.cc (Library_base::should_include_member): Move
3272 method here from class Archive.
3273 (Archive::Archive): Initialize base class.
3274 (Archive::should_include_member): Move to base class.
3275 (Archive::do_for_all_unused_symbols): New function.
3276 (Add_archive_symbols::run): Remove redundant access to
3277 incremental_inputs.
3278 (Lib_group::Lib_group): Initialize base class.
3279 (Lib_group::do_filename): New function.
3280 (Lib_group::include_member): Pass pointer to Lib_group to
3281 report_object.
3282 (Lib_group::do_for_all_unused_symbols): New function.
3283 (Add_lib_group_symbols::run): Report archive information for
3284 incremental links.
3285 * archive.h (class Library_base): New base class.
3286 (class Archive): Derive from Library_base.
3287 (Archive::filename): Move to base class.
3288 (Archive::set_incremental_info): Likewise.
3289 (Archive::incremental_info): Likewise.
3290 (Archive::Should_include): Likewise.
3291 (Archive::should_include_member): Likewise.
3292 (Archive::Armap_entry): Remove.
3293 (Archive::Unused_symbol_iterator): Remove.
3294 (Archive::unused_symbols_begin): Remove.
3295 (Archive::unused_symbols_end): Remove.
3296 (Archive::do_filename): New function.
3297 (Archive::do_get_mtime): New function.
3298 (Archive::do_for_all_unused_symbols): New function.
3299 (Archive::task_): Move to base class.
3300 (Archive::incremental_info_): Likewise.
3301 (class Lib_group): Derive from Library_base.
3302 (Lib_group::do_filename): New function.
3303 (Lib_group::do_get_mtime): New function.
3304 (Lib_group::do_for_all_unused_symbols): New function.
3305 (Lib_group::task_): Move to base class.
3306 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3307 function.
3308 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3309 function.
3310 * incremental.cc (Incremental_inputs::report_archive_begin):
3311 Use Library_base; call library's get_mtime; add incremental inputs
3312 entry before members.
3313 (class Unused_symbol_visitor): New class.
3314 (Incremental_inputs::report_archive_end): Use Library_base; use
3315 visitor class to record unused symbols; don't add incremental inputs
3316 entry after members.
3317 (Incremental_inputs::report_object): Use Library_base.
3318 * incremental.h
3319 (Incremental_archive_entry::Incremental_archive_entry): Remove
3320 unused Archive parameter.
3321 (Incremental_inputs::report_archive_begin): Use Library_base.
3322 (Incremental_inputs::report_archive_end): Likewise.
3323 (Incremental_inputs::report_object): Likewise.
3324 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3325 function.
3326 * object.h (Object::for_all_global_symbols): New function.
3327 (Object::do_for_all_global_symbols): New function.
3328 (Sized_relobj::do_for_all_global_symbols): New function.
3329 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3330 function.
3331 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3332 function.
3333
61ab3e40
ILT
33342011-03-27 Ian Lance Taylor <iant@google.com>
3335
3336 * archive.cc (Archive::interpret_header): Return -1 if something
3337 goes wrong. Change callers accordingly.
3338
30e1f9e6
CC
33392011-03-25 Cary Coutant <ccoutant@google.com>
3340
3341 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3342 * testsuite/Makefile.in: Regenerate.
3343
9370ce59 33442011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
3345
3346 * plugin.cc (get_view): New.
3347 (Plugin::load): Pass get_view to the plugin.
3348 (Plugin_manager::get_view): New.
3349
9312bb0a
ILT
33502011-03-21 Ian Lance Taylor <iant@google.com>
3351
3352 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 3353 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 3354
7e12ba9e
ST
33552011-03-21 Sriraman Tallam <tmsriram@google.com>
3356
3357 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3358 Change == to -eq.
3359 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3360 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3361 Change == to -eq.
3362 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3363 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3364
fd7a005d
ILT
33652011-03-14 Ian Lance Taylor <iant@google.com>
3366
3367 * script-sections.cc (Sort_output_sections::script_compare):
3368 Rename from is_before, change return type.
3369 (Sort_output_sections::operator()): Adjust accordingly.
3370
ed16fd1b
ILT
33712011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3372
3373 PR gold/12572
3374 * testsuite/odr_violation2.cc: Add comment to make all error line
3375 numbers double digits.
3376 * testsuite/debug_msg.sh: Adjust expected errors.
3377
71ff8986
ILT
33782011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3379
3380 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3381 but mark earlier ones as non-canonical
3382 (offset_to_iterator): Update search target and example
3383 (do_addr2line): Return extra lines in a vector*
3384 (format_file_lineno): Extract from do_addr2line
3385 (one_addr2line): Add vector* out-param
3386 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3387 when a lineno entry appeared last for its instruction
3388 (Dwarf_line_info): Add vector* out-param
3389 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3390 * symtab.cc (Odr_violation_compare): Include the lineno in the
3391 comparison again.
3392 (linenos_from_loc): New. Combine the canonical line for an
3393 address with its other lines.
3394 (True_if_intersect): New. Helper functor to make
3395 std::set_intersection a query.
3396 (detect_odr_violations): Compare sets of lines instead of just
3397 one line for each function. This became less deterministic, but
3398 has fewer false positives.
3399 * symtab.h: Declarations.
3400 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3401 mix an optimized and non-optimized object in the same binary
3402 (odr_violation2.so): Same.
3403 * testsuite/Makefile.in: Regenerate from Makefile.am.
3404 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3405 * testsuite/debug_msg.sh: Update line numbers and add
3406 assertions.
3407 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3408 non-optimized context.
3409 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3410 isn't inlined, and use OdrDerived in an optimized context.
3411 * testsuite/odr_header1.h: Defines OdrDerived, where
3412 optimization will change the
3413 first-instruction-in-the-destructor's file and line number.
3414 * testsuite/odr_header2.h: Defines OdrBase.
3415
a19fefdc
ILT
34162011-03-09 Ian Lance Taylor <iant@google.com>
3417
3418 * fileread.cc (File_read::clear_views): Don't delete the whole
3419 file view.
3420
ecb351e9
ILT
34212011-03-08 Ian Lance Taylor <iant@google.com>
3422
3423 PR gold/12525
3424 * fileread.cc: #include <climits>.
3425 (GOLD_IOV_MAX): Define.
3426 (File_read::read_multiple): Limit number of entries by iov_max.
3427 * fileread.h (class File_read): Always set max_readv_entries to
3428 128.
3429
b821d13c
ILT
34302011-03-07 Ian Lance Taylor <iant@google.com>
3431
3432 PR gold/12525
3433 * options.h (class General_options): Add -dy and -dn.
3434
89243142
CC
34352011-03-02 Cary Coutant <ccoutant@google.com>
3436
3437 * testsuite/script_test_9.t: Add TLS segment.
3438
d0773f31
ILT
34392011-03-02 Simon Baldwin <simonb@google.com>
3440
3441 * configure.ac: Add check for gnu_indirect_function support in
3442 the toolchain building binutils.
3443 * configure: Rebuild.
3444
9370ce59 34452011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
3446
3447 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3448 plugin only symbols.
3449 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3450 in plugin files as not needed in the symbol table.
3451
4cf7a849
ST
34522011-02-11 Sriraman Tallam <tmsriram@google.com>
3453
3454 * output.cc (Output_section::add_input_section): Delay fill
3455 generation for section ordering.
3456
b578bd7d
ILT
34572011-02-09 Ian Lance Taylor <iant@google.com>
3458
3459 PR gold/12316
3460 * object.h (class Sized_relobj): Remove clear_local_symbols.
3461 * reloc.cc (Sized_relobj::do_relocate): Don't call
3462 clear_local_symbols.
3463
9370ce59 34642011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
3465
3466 * plugin.cc (is_visible_from_outside): Return true for symbols
3467 in the -u option.
3468
55382fb7
ILT
34692011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3470
3471 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3472 filename.
3473
4e271fff
ST
34742011-02-02 Sriraman Tallam <tmsriram@google.com>
3475
3476 * icf.h (is_section_foldable_candidate): Change type of parameter
2e702c99 3477 to std::string.
4e271fff 3478 * icf.cc (Icf::find_identical_sections): Change type of local variable
2e702c99 3479 section_name to be std::string.
4e271fff
ST
3480 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3481
d433c3ac
ILT
34822011-01-25 Ian Lance Taylor <iant@google.com>
3483
3484 * script.cc (script_add_extern): Rewrite to use
3485 add_symbol_reference.
3486
880473a6
DK
34872011-01-25 Doug Kwan <dougkwan@google.com>
3488
d433c3ac 3489 * icf.cc (get_section_contents): Always lock section's object.
880473a6 3490
f30f86fa
ILT
34912011-01-24 Ian Lance Taylor <iant@google.com>
3492
3493 * options.h (class General_options): Accept
3494 --no-detect-odr-violations.
3495
8e51a0b9
ILT
34962011-01-24 Ian Lance Taylor <iant@google.com>
3497
3498 * version.cc (version_string): Bump to 1.11.
3499
0f3b89d8
ILT
35002011-01-24 Ian Lance Taylor <iant@google.com>
3501
3502 * plugin.cc (class Plugin_rescan): Define new class.
3503 (Plugin_manager::claim_file): Set any_claimed_.
3504 (Plugin_manager::save_archive): New function.
3505 (Plugin_manager::save_input_group): New function.
3506 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3507 necessary.
3508 (Plugin_manager::new_undefined_symbol): New function.
3509 (Plugin_manager::rescan): New function.
3510 (Plugin_manager::rescannable_defines): New function.
3511 (Plugin_manager::add_input_file): Set any_added_.
3512 * plugin.h (class Plugin_manager): define new fields rescannable_,
3513 undefined_symbols_, any_claimed_, and any_added_. Declare
3514 Plugin_rescan as friend. Declare new functions.
3515 (Plugin_manager::Rescannable): Define type.
3516 (Plugin_manager::Rescannable_list): Define type.
3517 (Plugin_manager::Undefined_symbol_list): Define type.
3518 (Plugin_manager::Plugin_manager): Initialize new fields.
3519 * archive.cc (Archive::defines_symbol): New function.
3520 (Add_archive_symbols::run): Pass archive to plugins if any.
3521 * archive.h (class Archive): Declare defines_symbol.
3522 * readsyms.cc (Input_group::~Input_group): New function.
3523 (Finish_group::run): Pass input_group to plugins if any.
3524 * readsyms.h (class Input_group): Declare destructor.
3525 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3526 any.
3527
3bb951e5
ILT
35282011-01-10 Ian Lance Taylor <iant@google.com>
3529
3530 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3531 section as relro.
3532 (Layout::set_segment_offsets): Reset increase_relro before calling
3533 set_section_addresses a second time.
3534
0aa45fac
CC
35352011-01-04 Cary Coutant <ccoutant@google.com>
3536
3537 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3538 sections before NOBITS sections.
3539
0db46eb4
L
35402011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3541
3542 * version.cc (print_version): Update copyright to 2011.
3543
829c9745
CC
35442010-12-23 Cary Coutant <ccoutant@google.com>
3545
3546 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3547 of OS to this->add. Add OD parameter to second form of the function.
3548
7500420b
ILT
35492010-12-20 Ian Lance Taylor <iant@google.com>
3550
3551 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3552 second of two consecutive entries with same offset.
3553
f8e9a930
RW
35542010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3555
3556 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3557 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3558 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3559 to avoid unneeded links against $(LDADD).
3560 * testsuite/Makefile.in: Regenerate.
3561
2fbb4320
ILT
35622010-12-15 Ian Lance Taylor <iant@google.com>
3563
3564 PR gold/12324
3565 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3566 for R_X86_64_32 and R_X86_64_PC32.
3567 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3568 ver_matching_def_pic.o.
3569 (ver_matching_def_pic.o): New target.
3570
fedb228d
RW
35712010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3572
3573 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3574 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3575 Move definition before File_read::View member definitions.
3576 (File_read::View::~View): Initialize and hold lock before
3577 updating current_mapped_bytes.
3578
9b547ce6
RW
35792010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3580
3581 * dwarf_reader.cc: Remove outdated comment.
3582 * gold-threads.cc: Fix typo in error message.
3583 * archive.cc: Fix typos in comments.
3584 * archive.h: Likewise.
3585 * arm-reloc-property.cc: Likewise.
3586 * arm-reloc-property.h: Likewise.
3587 * arm-reloc.def: Likewise.
3588 * arm.cc: Likewise.
3589 * attributes.h: Likewise.
3590 * cref.cc: Likewise.
3591 * ehframe.cc: Likewise.
3592 * fileread.h: Likewise.
3593 * gold.h: Likewise.
3594 * i386.cc: Likewise.
3595 * icf.cc: Likewise.
3596 * incremental.h: Likewise.
3597 * int_encoding.cc: Likewise.
3598 * layout.h: Likewise.
3599 * main.cc: Likewise.
3600 * merge.h: Likewise.
3601 * object.cc: Likewise.
3602 * object.h: Likewise.
3603 * options.cc: Likewise.
3604 * readsyms.cc: Likewise.
3605 * reduced_debug_output.cc: Likewise.
3606 * reloc.cc: Likewise.
3607 * script-sections.cc: Likewise.
3608 * sparc.cc: Likewise.
3609 * symtab.h: Likewise.
3610 * target-reloc.h: Likewise.
3611 * target.cc: Likewise.
3612 * target.h: Likewise.
3613 * timer.cc: Likewise.
3614 * timer.h: Likewise.
3615 * x86_64.cc: Likewise.
3616
83e17bd5
CC
36172010-12-09 Cary Coutant <ccoutant@google.com>
3618
3619 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3620 stack.
3621 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3622 parameter; change all callers.
3623 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3624 * options.h (warn_execstack): New option.
3625
017257f8
DK
36262010-12-07 Doug Kwan <dougkwan@google.com>
3627
3628 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3629 like function call relocations.
3630
c20cbc06
ILT
36312010-12-07 Ian Lance Taylor <iant@google.com>
3632
3633 * archive.cc (Archive::get_elf_object_for_member): Permit
3634 punconfigured to be NULL.
3635 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3636 (Archive::include_member): Pass NULL to get_elf_object_for_member
3637 if we searched for the archive and this is the first included
3638 object.
3639
4dbfafcc
ILT
36402010-12-01 Ian Lance Taylor <iant@google.com>
3641
3642 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3643 track_relocs_type_ field.
3644 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3645 Set track_relocs_type_.
3646 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3647 contents when using RELA relocs.
3648 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3649 reloc_map_.
3650 * reloc.cc (Track_relocs::next_addend): New function.
3651 * reloc.h (class Track_relocs): Declare next_addend.
3652
e5e19edd
ILT
36532010-12-01 Ian Lance Taylor <iant@google.com>
3654
3655 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3656 virtual destructor.
3657
9a5ce24c
ILT
36582010-12-01 Ian Lance Taylor <iant@google.com>
3659
3660 * README: Update compilers known to work and fail.
3661
c7791212
NC
36622010-11-23 Matthias Klose <doko@ubuntu.com>
3663
3664 * configure.in: For --enable-gold, handle value `default' instead of
3665 `both*'. Always install ld as ld.bfd, install as ld if gold is
3666 not the default.
3667 * configure: Regenerate.
3668
0ad220c9
DK
36692010-11-18 Doug Kwan <dougkwan@google.com>
3670
3671 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3672 and right_alignment to be zero. Store result alignment only if it is
3673 greater than existing alignment.
3674
ab8056e0
CC
36752010-11-16 Cary Coutant <ccoutant@google.com>
3676
3677 PR gold/12220
3678 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3679 Check for ".zdebug_line".
3680
fd064a5b
CC
36812010-11-16 Doug Kwan <dougkwan@google.com>
3682 Cary Coutant <ccoutant@google.com>
3683
3684 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3685 by reference; adjust all callers.
3686 * output.cc (Output_segment::set_section_addresses): Adjust references
3687 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3688 list is empty.
3689 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3690 end at page boundary.
3691
6fc6ea19
CC
36922010-11-16 Cary Coutant <ccoutant@google.com>
3693
3694 PR gold/12220
3695 * layout.cc (Layout::choose_output_section): Transform names of
3696 compressed sections even when using a script with a SECTIONS clause.
3697 (Layout::output_section_name): Remove code to transform
3698 compressed debug section names.
3699 * output.cc (Output_section::add_input_section): Use uncompressed
3700 section size when tracking input sections.
3701
95a2c8d6
RS
37022010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
3703
3704 * symtab.h (Symbol::NON_PIC_REF): Remove.
3705 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3706 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
3707 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3708 (Symbol::use_plt_offset): Take a flags argument and pass it
3709 directly to needs_dynamic_reloc. Restrict check for undefined
3710 weak symbols to function calls.
3711 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3712 (Target_arm::Scan::global): Use it.
3713 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3714 (Target_arm::Relocate::relocate): Likewise.
3715 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3716 parameter with an r_type parameter. Use get_reference_flags
3717 to get the flags.
3718 (Target_arm::Relocate::relocate): Update accordingly.
3719 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3720 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3721 (Target_i386::Scan::global): Likewise.
3722 (Target_i386::Relocate::relocate): Likewise.
3723 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3724 parameter with an r_type parameter. Use get_reference_flags
3725 to get the flags.
3726 (Target_i386::Relocate::relocate): Update accordingly.
3727 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3728 (Target_powerpc::Scan::global): Use it.
3729 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3730 (Target_powerpc::Relocate::relocate): Likewise.
3731 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3732 (Target_sparc::Scan::global): Use it.
3733 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3734 (Target_sparc::Relocate::relocate): Likewise.
3735 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3736 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3737 (Target_x86_64::Scan::global): Likewise.
3738 (Target_x86_64::Relocate::relocate): Likewise.
3739
f625ae50
DK
37402010-11-08 Doug Kwan <dougkwan@google.com>
3741 Cary Coutant <ccoutant@google.com>
3742
3743 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3744 (Arm_exidx_merge_section::section_contents_): New data member.
3745 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3746 (Arm_input_section::~Arm_input_section): De-allocate memory.
58797674 3747 (Arm_input_section::original_contents_): New data member.
f625ae50
DK
3748 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3749 in parameters instead of calling Object::section_contents without
3750 locking.
3751 (Arm_output_section::group_section): New parameter TASK. Pass it
3752 to callees that need locking objects.
3753 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3754 to lock EXIDX input sections. Fix a formatting issue. Call
3755 Arm_exidx_merged_section::build_contents to create merged section
3756 contents.
3757 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3758 to lock object of stub table owner.
3759 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3760 TEXT_SIZE to initialize data member TEXT_SIZE_.
3761 (Arm_exidx_input_section::addralign): Fix typo in comment.
3762 (Arm_exidx_input_section::text_size): New method.
3763 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3764 that require locking objects. Lock objects before scanning for stubs
3765 and updating local symbols.
3766 (Arm_input_section<big_endian>::init): Copy contents of original
3767 input section.
2e702c99 3768 (Arm_input_section<big_endian>::do_write): Use saved contents of
f625ae50
DK
3769 original input section instead of calling Object::section_contents
3770 without locking.
3771 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3772 size without calling Object::section_size().
3773 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3774 for size. Allocate a buffer for merged EXIDX entries.
3775 (Arm_exidx_merged_section::build_contents): New method.
2e702c99 3776 (Arm_exidx_merged_section::do_write): Move merge section contents
f625ae50
DK
3777 building code to Arm_exidx_merged_section::build_contetns. Write
3778 out contetns in buffer instead of building it on the fly.
3779 (Arm_relobj::make_exidx_input_section): Also pass text section size
3780 to Arm_exidx_input_section constructor.
3781 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3782 (Arm_dynobj::do_read_symbols): Fix memory leak.
3783 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3784 * target.h: (class Task): Add forward declaration.
3785 (Target::relax): Add new parameter TASK and pass it to
3786 Target::do_relax().
3787 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3788
5f9bcf58
CC
37892010-11-05 Cary Coutant <ccoutant@google.com>
3790
3791 PR gold/10708
3792 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3793 object when reading from the file.
3794 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3795 second layout pass.
3796 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3797 when reading section contents.
3798 (get_section_contents): Likewise.
3799 (icf::find_identical_sections): Likewise.
3800 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3801 object when reading from the file.
3802 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3803 the object when doing deferred section layout.
3804
e597fa08
NC
38052010-11-03 Nick Clifton <nickc@redhat.com>
3806
3807 PR gold/12001
3808 * script.h (class Symbol_assignment: name): New member. Returns
3809 the name of the symbol.
3810 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3811 Returns true if the given symbol name is on the list of
3812 assignments wating to be processed.
3813 * archive.cc (should_incldue_member): If the symbol is undefined,
3814 check to see if it is on the list of symbols pending assignment.
3815
3f9a3278
ILT
38162010-11-03 Ryan Mansfield <rmansfield@qnx.com>
3817
3818 * script-sections.cc (Script_sections::find_memory_region): Check
3819 for a NULL output section pointer.
3820
d06fb4d1
DK
38212010-10-29 Doug Kwan <dougkwan@google.com>
3822
3823 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3824 Output_section::add_relaxed_input_section.
3825 * output.cc (Output_section::add_relaxed_input_section): Add new
3826 arguments LAYOUT and NAME. Set section order index.
3827 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3828 Copy section order index.
3829 * output.h (Output_section::add_relaxed_input_section): Add new
3830 arguments LAYOUT and NAME.
3831
90e24de5
ILT
38322010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3833
3834 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2e702c99 3835 NATIVE_OR_CROSS_LINKER.
90e24de5
ILT
3836 * testsuite/Makefile.in: Regenerate.
3837
c9484ea5
DK
38382010-10-20 Doug Kwan <dougkwan@google.com>
3839
3840 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3841 without SHF_LINK_ORDER flags.
3842 * layout.cc (Layout::choose_output_section): Do not filter
3843 SHF_LINK_ORDER flag in a relocatable link.
3844
5bc2f5be
CC
38452010-10-17 Cary Coutant <ccoutant@google.com>
3846
3847 * output.h (Output_segment::set_section_addresses): Change function
3848 signature. Update all callers.
3849 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3850 sections.
3851 (Output_segment::set_section_addresses): Align after last TLS
3852 section. Add padding before last relro section instead of after.
3853
0c91cf04
DK
38542010-10-17 Doug Kwan <dougkwan@google.com>
3855
3856 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3857 GOT output section to be writable.
3858
8c21d9d3
CC
38592010-10-14 Cary Coutant <ccoutant@google.com>
3860
3861 * debug.h (DEBUG_INCREMENTAL): New flag.
2e702c99
RM
3862 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3863 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3864 mode.
3865 * incremental.cc (report_command_line): Ignore all forms of
3866 --incremental.
3867 * layout.cc (Layout::Layout): Check parameters for incremental link
3868 mode.
3869 * options.cc (General_options::parse_incremental): New function.
3870 (General_options::parse_no_incremental): New function.
3871 (General_options::parse_incremental_full): New function.
3872 (General_options::parse_incremental_update): New function.
3873 (General_options::incremental_mode_): New data member.
3874 (General_options::finalize): Check incremental_mode_.
3875 * options.h (General_options): Update help text for --incremental.
3876 Add --no-incremental, --incremental-full, --incremental-update.
3877 (General_options::Incremental_mode): New enum type.
3878 (General_options::incremental_mode): New function.
3879 (General_options::incremental_mode_): New data member.
3880 * parameters.cc (Parameters::incremental_mode_): New data member.
3881 (Parameters::set_options): Set incremental_mode_.
3882 (Parameters::set_incremental_full): New function.
3883 (Parameters::incremental): New function.
3884 (Parameters::incremental_update): New function.
3885 (set_parameters_incremental_full): New function.
3886 * parameters.h (Parameters::set_incremental_full): New function.
3887 (Parameters::incremental): New function.
3888 (Parameters::incremental_update): New function.
3889 (Parameters::incremental_mode_): New data member.
3890 (set_parameters_incremental_full): New function.
3891 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3892 incremental link mode.
3893 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3894 (Sized_relobj::do_relocate_sections): Likewise.
3895 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3896 option.
3897 * testsuite/Makefile.in: Regenerate.
3898 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8c21d9d3 3899
bb32aa18 39002010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
3901
3902 * script-sections.h (class Script_sections): Make
3903 Sections_elements typedef public.
3904 * script-sections.cc (class Sort_output_sections): Add elements_
3905 field. Add constructor which sets it; change all callers.
3906 (Sort_output_sections::is_before): New function.
3907 (Sort_output_sections::operator()): Call is_before.
3908 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3909 conditional.
3910 * testsuite/script_test_10.sh: New test. Test script section
3911 order.
3912 * testsuite/script_test_10.t: Likewise.
3913 * testsuite/script_test_10.s: Likewise.
3914 * testsuite/Makefile.am: Wrap the cross linker tests and the
3915 common tests into NATIVE_OR_CROSS_LINKER.
3916 (check_SCRIPTS): Add script_test_10.sh.
3917 (check_DATA): Add script_test_10.stdout.
3918 (script_test_10.o, script_test_10): New targets.
3919 (script_test_10.stdout): New target.
3920 * configure, testsuite/Makefile.in: Regenerate.
3921
3cef7179
ILT
39222010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3923
3924 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3925 error for the deprecated relocations.
3926 (Target_arm::Scan::global): Likewise.
3927 (Target_arm::Relocate::relocate): Likewise.
3928
7411e9a8
RS
39292010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3930
3931 * fileread.cc (Input_file::find_file): Initialize *found_name
3932 and *namep when using the fallback search for case 4.
3933
6a9da32a
CC
39342010-10-11 Cary Coutant <ccoutant@google.com>
3935
3936 * options.h (class General_options): Redefine -z lazy as an alias for
3937 the negation of -z now.
3938
ac897c20
ILT
39392010-10-11 Ian Lance Taylor <iant@google.com>
3940
3941 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3942 binding.
3943
ea5cae92
NC
39442010-10-06 Nick Clifton <nickc@redhat.com>
3945
3946 * script-sections.cc(class Memory_region): Remove
3947 current_lma_offset_ field. Rename current_vma_offset_ to
3948 current_offset_. Add last_section_ field.
3949 (Memory_region::get_current_vma_address): Rename to
3950 get_current_address.
3951 (Memory_region::get_current_lma_address): Delete.
3952 (Memory_region::increment_vma_offset): Rename to
3953 increment_offset.
3954 (Memory_region::increment_lma_offset): Delete.
3955 (Memory_region::attributes_compatible): New method. Returns
3956 true if the provided section is compatible with the region.
3957 (Memory_region::get_last_section): New method. Returns the last
3958 section to use the region.
3959 (Memory_region::set_last_section): New method. Stores the last
3960 section to use the region.
3961 (Script_sections::block_in_region): New method. Returns true if
3962 a block of memory is contained within a region.
3963 (Script_sections::find_memory_region): New method. Locates a
3964 memory region to be used to set a VMA or LMA address.
3965 (Output_section_definition::set_section_addresses): Add code to
3966 check for addresses set by memory regions.
3967 (Output_segment::set_section_addresses): Remove memory region
3968 walking code.
3969 (Script_sections::create_segment): Add a warning if a header
3970 segment is created outside of any region.
3971 * script-sections.h (class Script_sections): Add prototypes for
3972 find_memory_region and block_in_region methods.
3973 * testsuite/memory_test.s: Use .long instead of .word.
3974 * testsuite/memory_test.t: Add some more output sections.
3975 * testsuite/memory_test.sh: Update expected output.
3976
a9bfd952
DK
39772010-10-02 Doug Kwan <dougkwan@google.com>
3978
3979 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3980 defintion to symtab.h
3981 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3982 declaration to defintion.
3983
bacff3ab
NC
39842010-10-01 Nick Clifton <nickc@redhat.com>
3985
3986 * expression.cc (eval): Replace dummy argument with NULL.
3987 (eval_maybe_dot): Check for a NULL result section pointer.
3988 (Symbol_expression::value): Likewise.
3989 (Dot_expression::value): Likewise.
3990 (BINARY_EXPRESSION): Likewise.
3991 (Max_expression::value): Likewise.
3992 (Min_expression::value): Likewise.
3993 (Absolute_expression::value): Likewise.
3994 (Addr_expression::value_from_output_section): Likewise.
3995 (Loaddddr_expression::value_from_output_section): Likewise.
3996 (Segment_start_expression::value): Likewise.
3997 * script-sections.cc
3998 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3999 argument with NULL.
4000 (Sections_elememt_dot_assignment::set_section_addresses):
4001 Likewise.
4002 (Output_data_expression::do_write_to_buffer): Likewise.
4003 (Output_section_definition::finalize_symbols): Likewise.
4004 (Output_section_definition::set_section_addresses): Likewise.
4005
f81bc8b5
DK
40062010-09-30 Doug Kwan <dougkwan@google.com>
4007
4008 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4009
c95e9f27
ST
40102010-09-28 Sriraman Tallam <tmsriram@google.com>
4011
4012 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 4013 function.
c95e9f27
ST
4014 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4015 virtual function.
4016 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4017 virtual function.
4018 * icf.cc (get_section_contents): Inline merge sections only when
4019 target allows it.
4020
3cac54d2
RW
40212010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4022
4023 * configure: Regenerate.
4024
2904037a
ILT
40252010-09-17 Ian Lance Taylor <iant@google.com>
4026
4027 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
4028 * testsuite/Makefile.am (memory_test.o): New target.
4029 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4030 memory_test.t.
4031 * testsuite/Makefile.in: Rebuild.
2904037a 4032
bca7fb63
DK
40332010-09-17 Doug Kwan <dougkwan@google.com>
4034
4035 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4036 defintion if relocation uses GOT entries of the symbol.
4037 * testsuite/icf_safe_test.sh: Fix test.
4038 * testsuite/icf_safe_so_test.sh: Fix test.
4039
4ef28648
CC
40402010-09-16 Cary Coutant <ccoutant@google.com>
4041
4042 * script_sections.cc (class Memory_region): Remove "NULL" from
4043 vector initializations.
4044
793990de
CC
40452010-09-15 Cary Coutant <ccoutant@google.com>
4046
4047 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4048 Resolve forwarding symbols.
4049
81e015e2
DK
40502010-09-15 Doug Kwan <dougkwan@google.com>
4051
4052 * gold/testsuite/script_test_3.t: Add ARM special sections.
4053 * gold/testsuite/script_test_4.t: Same.
4054 * gold/testsuite/script_test_5.t: Same.
4055 * gold/testsuite/script_test_6.t: Same.
4056 * gold/testsuite/script_test_7.t: Same.
4057 * gold/testsuite/script_test_7.t: Same.
4058 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4059
36171d64
CC
40602010-09-14 Cary Coutant <ccoutant@google.com>
4061
4062 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4063 (Target_x86_64::Relocate::relocate_tls): Replace check for
4064 saw_tls_block_reloc_ with test for executable section.
4065
d89051bd
CC
40662010-09-12 Cary Coutant <ccoutant@google.com>
4067
4068 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4069 position-independent executables to shared libraries need dynamic
4070 relocations.
4071 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4072 position-independent executables.
4073 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4074 * testsuite/Makefile.in: Regenerate.
4075
fca41f0f
NC
40762010-09-10 Nick Clifton <nickc@redhat.com>
4077
4078 PR gold/11997
4079 * testsuite/memory_test.t: Discard any sections that are not
4080 needed.
4081
6695e4b3
L
40822010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4083
4084 PR gold/11996
4085 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4086 "This::" to work around a bug in gcc 4.2.
4087
4088 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4089
0f72bf6f
RÁE
40902010-09-09 Rafael Espindola <espindola@google.com>
4091
4092 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4093 sections with different PF_X flags in the same segment.
4094 (Layout::find_first_load_seg): Search all segments to find the first
4095 one.
4096 * options.h (rosegment): New.
4097
40982010-09-08 Rafael Espindola <espindola@google.com>
a6577478 4099
05a79166 4100 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 4101
aa98ff75
DK
41022010-09-08 Doug Kwan <dougkwan@google.com>
4103
4104 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4105 (Arm_relobj::do_relocate_sections): Add new parameter for output
4106 file to match the parent.
4107 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4108 of local symbols instead of input values. Update code to track
4109 changes in gold::relocate_section.
4110 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4111 (Sized_relobj::compute_final_local_value_internal): New methods.
4112 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4113 body into private version of Sized_relobj::compute_final_local_value.
4114 Call the inline method.
4115 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4116 merged symbol value if there is one.
4117 (Symbol_value::has_output_value): New method defintiion.
4118 (Sized_relobj::Compute_final_local_value_status): New enum type.
4119 (Sized_relobj::compute_final_local_value): New methods.
4120 (Sized_relobj::compute_final_local_value_internal): New methods.
4121 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4122 and arm_cortex_a8.sh.
4123 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4124 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4125 New tests.
4126 * Makefile.in: Regenerate.
4127 * testsuite/arm_bl_out_of_range.s: Update test.
4128 * testsuite/thumb_bl_out_of_range.s: Ditto.
4129 * testsuite/thumb_blx_out_of_range.s: Ditto.
4130 * testsuite/arm_branch_out_of_range.sh: New file.
4131 * testsuite/arm_cortex_a8.sh: Ditto.
4132 * testsuite/arm_cortex_a8_b.s: Ditto.
4133 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4134 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4135 * testsuite/arm_cortex_a8_bl.s: Ditto.
4136 * testsuite/arm_cortex_a8_blx.s: Ditto.
4137 * testsuite/arm_cortex_a8_local.s: Ditto.
4138 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4139 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4140
05a79166
L
41412010-09-08 Rafael Espindola <espindola@google.com>
4142
4143 * Makefile.am (memory_test.stdout): Run readelf with -W.
4144 * Makefile.in: Regenerate.
4145 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4146 64 bit output.
4147
33dbc701
RÁE
41482010-09-08 Rafael Espindola <espindola@google.com>
4149
4150 * script-sections.cc (Script_sections::add_memory_region): Convert
4151 field precision to int.
4152 * script.cc (script_set_section_region, script_set_section_region):
4153 Convert field precision to int.
4154
731ca54a
RÁE
41552010-09-08 Rafael Espindola <espindola@google.com>
4156
4157 * arm.cc (do_finalize_sections): Create the __exidx_start and
4158 __exdix_end symbols even when the section is missing.
4159
7f8cd844
NC
41602010-09-08 Nick Clifton <nickc@redhat.com>
4161
4162 * README: Remove claim that MEMORY is not supported.
4163 * expression.cc (script_exp_function_origin)
4164 (script_exp_function_length): Move from here to ...
4165 * script.cc: ... here.
4166 (script_set_section_region, script_add_memory)
4167 (script_parse_memory_attr, script_include_directive): New
4168 functions.
4169 * script-sections.cc
4170 (class Memory_region): New class.
4171 (class Output_section_definition): Add set_memory_region,
4172 set_section_vma, set_section_lma and get_section_name methods.
4173 (class Script_Sections): Add add_memory_region,
4174 find_memory_region, find_memory_region_origin,
4175 find_memory_region_length and set_memory_region methods.
4176 Have set_section_addresses method walk the list of set memory
4177 regions.
4178 Extend the print methos to display memory regions.
4179 * script-sections.h: Add prototypes for new methods.
4180 Add enum for MEMORY region attributes.
4181 * yyscript.y: Add support for parsing MEMORY regions.
4182 * script-c.h: Add prototypes for new functions.
4183 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4184 * testsuite/Makefile.in: Regenerate.
4185 * testsuite/memory_test.sh: New script.
4186 * testsuite/memory_test.s: New assembler source file.
4187 * testsuite/memory_test.t: New linker script.
4188
a4649286
DK
41892010-08-27 Doug Kwan <dougkwan@google.com>
4190
4191 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4192 reference override an existing dynamic weak reference.
4193 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4194 * testsuite/Makefile.in: Regenerate.
4195 * testsuite/dyn_weak_ref.sh: New file.
4196 * testsuite/dyn_weak_ref_1.c: Ditto.
4197 * testsuite/dyn_weak_ref_2.c: Ditto.
4198
b56648ad
ILT
41992010-08-27 Ian Lance Taylor <iant@google.com>
4200
4201 * incremental.h (class Incremental_input_entry): Add virtual
4202 destructor.
4203
809313cb
ILT
42042010-08-27 Ian Lance Taylor <iant@google.com>
4205
4206 * testsuite/start_lib_test_3.c: Mark t3 as used.
4207
11e32464
NC
42082010-08-27 Nick Clifton <nickc@redhat.com>
4209
4210 * options.cc (version_script): Fix small typo in previous
4211 whitespace tidyup.
4212
ca09d69a
NC
42132010-08-25 Nick Clifton <nickc@redhat.com>
4214
4215 * archive.cc: Formatting fixes: Remove whitespace between
4216 typename and following asterisk. Remove whitespace between
4217 function name and opening parenthesis.
4218 * archive.h: Likewise.
4219 * arm.cc: Likewise.
4220 * attributes.cc: Likewise.
4221 * attributes.h: Likewise.
4222 * common.cc: Likewise.
4223 * copy-relocs.cc: Likewise.
4224 * dirsearch.h: Likewise.
4225 * dynobj.cc: Likewise.
4226 * ehframe.cc: Likewise.
4227 * ehframe.h: Likewise.
4228 * expression.cc: Likewise.
4229 * fileread.cc: Likewise.
4230 * fileread.h: Likewise.
4231 * gc.h: Likewise.
4232 * gold-threads.cc: Likewise.
4233 * gold.cc: Likewise.
4234 * i386.cc: Likewise.
4235 * icf.h: Likewise.
4236 * incremental-dump.cc: Likewise.
4237 * incremental.cc: Likewise.
4238 * layout.cc: Likewise.
4239 * layout.h: Likewise.
4240 * main.cc: Likewise.
4241 * merge.cc: Likewise.
4242 * merge.h: Likewise.
4243 * object.cc: Likewise.
4244 * object.h: Likewise.
4245 * options.cc: Likewise.
4246 * options.h: Likewise.
4247 * output.cc: Likewise.
4248 * output.h: Likewise.
4249 * plugin.cc: Likewise.
4250 * plugin.h: Likewise.
4251 * powerpc.cc: Likewise.
4252 * reloc.cc: Likewise.
4253 * script-c.h: Likewise.
4254 * script-sections.cc: Likewise.
4255 * script.cc: Likewise.
4256 * stringpool.cc: Likewise.
4257 * symtab.cc: Likewise.
4258 * symtab.h: Likewise.
4259 * target.cc: Likewise.
4260 * timer.cc: Likewise.
4261 * timer.h: Likewise.
4262 * version.cc: Likewise.
4263 * x86_64.cc: Likewise.
4264
b8fa8750
NC
42652010-08-24 Nick Clifton <nickc@redhat.com>
4266
4267 PR 11899
4268 * layout.cc (segment_precedes): Sort segments by their physical
4269 addresses, if they have been set.
4270
9919d93b
CC
42712010-08-23 Cary Coutant <ccoutant@google.com>
4272
4273 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4274 symbols data.
4275 (Lib_group::include_member): Unlock object after deleting its
4276 symbols data.
4277 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4278 the bug fixed here.
4279
97b4be1c
CC
42802010-08-19 Neil Vachharajani <nvachhar@google.com>
4281 Cary Coutant <ccoutant@google.com>
4282
4283 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4284 constructor, and set_blocker.
4285 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4286 readsyms_blocker_.
4287 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4288 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4289 * testsuite/Makefile.am (start_lib_test): New test case.
4290 * testsuite/Makefile.in: Regenerate.
4291 * testsuite/start_lib_test_main.c: New file.
4292 * testsuite/start_lib_test_1.c: New file.
4293 * testsuite/start_lib_test_2.c: New file.
4294 * testsuite/start_lib_test_3.c: New file.
4295
dd0b1884
ILT
42962010-08-19 Ian Lance Taylor <iant@google.com>
4297
4298 * Makefile.in: Rebuild with automake 1.11.1.
4299 * aclocal.m4: Likewise.
4300 * testsuite/Makefile.in: Likewise.
4301
7223e9ca
ILT
43022010-08-19 Ian Lance Taylor <iant@google.com>
4303
4304 PR 10893
4305 * i386.cc (class Output_data_plt_i386): Update declarations.
4306 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4307 local_ifuncs_ fields.
4308 (Target_i386::do_plt_section_for_global): New function.
4309 (Target_i386::do_plt_section_for_local): New function.
4310 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4311 parameter; change all callers. Initialize global_ifuncs_ and
4312 local_ifuncs_. If doing a static link define __rel_iplt_start and
4313 __rel_iplt_end.
4314 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4315 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4316 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4317 symbols.
4318 (Target_i386::make_plt_section): New function, broken out of
4319 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4320 (Target_i386::make_plt_entry): Call make_plt_section.
4321 (Target_i386::make_local_ifunc_plt_entry): New function.
4322 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4323 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4324 R_386_IRELATIVE to switch.
4325 (Target_i386::Scan::global): Likewise.
4326 (Target_i386::Relocate::relocate): Likewise.
4327 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4328 switch.
4329 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4330 (Target_x86_64::do_plt_section_for_global): New function.
4331 (Target_x86_64::do_plt_section_for_local): New function.
4332 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4333 parameter; change all callers. If doing a static link define
4334 __rela_iplt_start and __rela_iplt_end.
4335 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4336 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4337 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4338 to point to .plt.
4339 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4340 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4341 switch.
4342 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4343 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4344 R_X86_64_IRELATIVE to switch.
4345 (Target_x86_64::Scan::global): Likewise.
4346 (Target_x86_64::Relocate::relocate): Likewise.
4347 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4348 switch.
4349 * target.h (class Target): Add plt_section_for_global and
4350 plt_section_for_local functions. Add do_plt_section_for_global
4351 and do_plt_section_for_local virtual functions.
4352 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4353 clarifying comments.
4354 (Symbol::use_plt_offset): Handle IFUNC symbol.
4355 * object.cc (Sized_relobj::Sized_relobj): Initialize
4356 local_plt_offsets_.
4357 (Sized_relobj::local_has_plt_offset): New function.
4358 (Sized_relobj::local_plt_offset): New function.
4359 (Sized_relobj::set_local_plt_offset): New function.
4360 (Sized_relobj::do_count): Handle IFUNC symbol.
4361 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4362 a bit away from input_shndx_ field. Add set_is_func_symbol and
4363 is_ifunc_symbol functions.
4364 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4365 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4366 local_plt_offsets_ field.
4367 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4368 * output.h (class Output_section_data): Add non-const
4369 output_section function.
4370 (class Output_data_got): Update declarations.
4371 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4372 Add use_plt_offset parameter to global and local constructors.
4373 Change all callers. Change local_sym_index_ field to 31 bits.
4374 Change GSYM_CODE and CONSTANT_CODE accordingly.
4375 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4376 doing a static link don't set sh_link field.
4377 (Output_data_got::Got_entry::write): Use PLT offset if
4378 appropriate.
4379 (Output_data_got::add_global_plt): New function.
4380 (Output_data_got::add_local_plt): New function.
4381 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4382 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4383 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4384 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4385 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4386 IFUNC conditional.
4387 * testsuite/ifunc-sel.h: New file.
4388 * testsuite/ifuncmain1.c: New file.
4389 * testsuite/ifuncmain1vis.c: New file.
4390 * testsuite/ifuncmod1.c: New file.
4391 * testsuite/ifuncdep2.c: New file.
4392 * testsuite/ifuncmain2.c: New file.
4393 * testsuite/ifuncmain3.c: New file.
4394 * testsuite/ifuncmod3.c: New file.
4395 * testsuite/ifuncmain4.c: New file.
4396 * testsuite/ifuncmain5.c: New file.
4397 * testsuite/ifuncmod5.c: New file.
4398 * testsuite/ifuncmain6pie.c: New file.
4399 * testsuite/ifuncmod6.c: New file.
4400 * testsuite/ifuncmain7.c: New file.
4401 * configure, testsuite/Makefile.in: Rebuild.
4402
56f75c03
ILT
44032010-08-18 Ian Lance Taylor <iant@google.com>
4404
4405 * incremental.cc
4406 (Output_section_incremental_inputs::write_input_files): Add cast
4407 to avoid signed/unsigned comparison warning.
4408 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4409
55455f89
CC
44102010-08-12 Cary Coutant <ccoutant@google.com>
4411
4412 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4413
e2054bcb
ILT
44142010-08-13 Ian Lance Taylor <iant@google.com>
4415
4416 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4417
74f67560
DK
44182010-08-12 Cary Coutant <ccoutant@google.com>
4419 Doug Kwan <dougkwan@google.com>
4420
4421 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4422 defintion overrides non-weak undef, remember that the original undef
4423 is not weak.
4424 * symtab.cc (Symbol_table::sized_write_global): For undef without
4425 an original weak binding, set binding to global in output.
4426 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4427 * testsuite/Makefile.in: Regenerate.
4428 * testsuite/strong_ref_weak_def.sh: New file.
4429 * testsuite/strong_ref_weak_def_1.c: Ditto.
4430 * testsuite/strong_ref_weak_def_2.c: Ditto.
4431
d1238d12
CC
44322010-08-12 Cary Coutant <ccoutant@google.com>
4433
4434 * testsuite/incremental_test.sh: Rewrite.
4435 * testsuite/incremental_test_1.c: Rewrite.
4436 * testsuite/incremental_test_2.c: Rewrite.
4437
0e70b911
CC
44382010-08-12 Cary Coutant <ccoutant@google.com>
4439
4440 * arm.cc (Target_arm::got_size): Add const.
4441 (Target_arm::got_entry_count): New function.
4442 (Target_arm::plt_entry_count): New function.
4443 (Target_arm::first_plt_entry_offset): New function.
4444 (Target_arm::plt_entry_size): New function.
4445 (Output_data_plt_arm::entry_count): New function.
4446 (Output_data_plt_arm::first_plt_entry_offset): New function.
4447 (Output_data_plt_arm::get_plt_entry_size): New function.
4448 * i386.cc (Target_i386::got_size): Add const.
4449 (Target_i386::got_entry_count): New function.
4450 (Target_i386::plt_entry_count): New function.
4451 (Target_i386::first_plt_entry_offset): New function.
4452 (Target_i386::plt_entry_size): New function.
4453 (Output_data_plt_i386::entry_count): New function.
4454 (Output_data_plt_i386::first_plt_entry_offset): New function.
4455 (Output_data_plt_i386::get_plt_entry_size): New function.
4456 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4457 find_incremental_inputs_sections. Dump incremental_got_plt section.
4458 * incremental.cc: Include target.h.
4459 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4460 parameter. Adjust all callers. Find incremental_got_plt section.
4461 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4462 section.
4463 (Output_section_incremental_inputs::set_final_data_size): Calculate
4464 size of incremental_got_plt section.
4465 (Output_section_incremental_inputs::do_write): Write the
4466 incremental_got_plt section.
4467 (Got_plt_view_info): New struct.
4468 (Local_got_offset_visitor): New class.
4469 (Global_got_offset_visitor): New class.
4470 (Global_symbol_visitor_got_plt): New class.
4471 (Output_section_incremental_inputs::write_got_plt): New function.
4472 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4473 Add parameter. Adjust all callers.
4474 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4475 (Incremental_inputs::got_plt_section): New function.
4476 (Incremental_inputs::got_plt_section_): New data member.
4477 (Incremental_got_plt_reader): New class.
4478 * layout.cc (Layout::create_incremental_info_sections): Add the
4479 incremental_got_plt section.
4480 * object.h (Got_offset_list::get_list): New function.
4481 (Got offset_list::for_all_got_offsets): New function.
4482 (Sized_relobj::local_got_offset_list): New function.
4483 * powerpc.cc (Target_powerpc::got_size): Add const.
4484 (Target_powerpc::got_entry_count): New function.
4485 (Target_powerpc::plt_entry_count): New function.
4486 (Target_powerpc::first_plt_entry_offset): New function.
4487 (Target_powerpc::plt_entry_size): New function.
4488 (Output_data_plt_powerpc::entry_count): New function.
4489 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4490 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4491 * sparc.cc (Target_sparc::got_size): Add const.
4492 (Target_sparc::got_entry_count): New function.
4493 (Target_sparc::plt_entry_count): New function.
4494 (Target_sparc::first_plt_entry_offset): New function.
4495 (Target_sparc::plt_entry_size): New function.
4496 (Output_data_plt_sparc::entry_count): New function.
4497 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4498 (Output_data_plt_sparc::get_plt_entry_size): New function.
4499 * symtab.h (Symbol::got_offset_list): New function.
4500 (Symbol_table::for_all_symbols): New function.
4501 * target.h (Sized_target::got_entry_count): New function.
4502 (Sized_target::plt_entry_count): New function.
4503 (Sized_target::plt_entry_size): New function.
4504 * x86_64.cc (Target_x86_64::got_size): Add const.
4505 (Target_x86_64::got_entry_count): New function.
4506 (Target_x86_64::plt_entry_count): New function.
4507 (Target_x86_64::first_plt_entry_offset): New function.
4508 (Target_x86_64::plt_entry_size): New function.
4509 (Output_data_plt_x86_64::entry_count): New function.
4510 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4511 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4512
09ec0418
CC
45132010-08-12 Cary Coutant <ccoutant@google.com>
4514
4515 * archive.cc: Include incremental.h.
4516 (Archive::Archive): Initialize incremental_info_.
4517 (Archive::include_member): Record archive members in incremental info.
4518 (Add_archive_symbols::run): Record begin and end of an archive in
4519 incremental info.
4520 (Lib_group::include_member): Record objects in incremental info.
4521 * archive.h (Incremental_archive_entry): Forward declaration.
4522 (Archive::set_incremental_info): New member function.
4523 (Archive::incremental_info): New member function.
4524 (Archive::Unused_symbol_iterator): New class.
4525 (Archive::unused_symbols_begin): New member function.
4526 (Archive::unused_symbols_end): New member function.
4527 (Archive::incremental_info_): New data member.
4528 * incremental-dump.cc (find_input_containing_global): New function.
4529 (dump_incremental_inputs): Dump new incremental info sections.
4530 * incremental.cc: Include symtab.h.
4531 (Output_section_incremental_inputs): New class.
4532 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4533 new incremental info sections.
4534 (Sized_incremental_binary::do_check_inputs): Likewise.
4535 (Incremental_inputs::report_archive): Remove.
4536 (Incremental_inputs::report_archive_begin): New function.
4537 (Incremental_inputs::report_archive_end): New function.
4538 (Incremental_inputs::report_object): New function.
4539 (Incremental_inputs::finalize_inputs): Remove.
4540 (Incremental_inputs::report_input_section): New function.
4541 (Incremental_inputs::report_script): Rewrite.
4542 (Incremental_inputs::finalize): Do nothing but finalize string table.
4543 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4544 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4545 (Incremental_inputs::create_data_sections): New function.
4546 (Incremental_inputs::relocs_entsize): New function.
4547 (Output_section_incremental_inputs::set_final_data_size): New function.
4548 (Output_section_incremental_inputs::do_write): New function.
4549 (Output_section_incremental_inputs::write_header): New function.
4550 (Output_section_incremental_inputs::write_input_files): New function.
4551 (Output_section_incremental_inputs::write_info_blocks): New function.
4552 (Output_section_incremental_inputs::write_symtab): New function.
4553 * incremental.h (Incremental_script_entry): Forward declaration.
4554 (Incremental_object_entry): Forward declaration.
4555 (Incremental_archive_entry): Forward declaration.
4556 (Incremental_inputs): Forward declaration.
4557 (Incremental_inputs_header_data): Remove.
4558 (Incremental_inputs_header): Remove.
4559 (Incremental_inputs_header_write): Remove.
4560 (Incremental_inputs_entry_data): Remove.
4561 (Incremental_inputs_entry): Remove.
4562 (Incremental_inputs_entry_write): Remove.
4563 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4564 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4565 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4566 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4567 Likewise.
4568 (Incremental_input_entry): New class.
4569 (Incremental_script_entry): New class.
4570 (Incremental_object_entry): New class.
4571 (Incremental_archive_entry): New class.
4572 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4573 (Incremental_inputs::report_inputs): Remove.
4574 (Incremental_inputs::report_archive): Remove.
4575 (Incremental_inputs::report_archive_begin): New function.
4576 (Incremental_inputs::report_archive_end): New function.
4577 (Incremental_inputs::report_object): Change prototype.
4578 (Incremental_inputs::report_input_section): New function.
4579 (Incremental_inputs::report_script): Change prototype.
4580 (Incremental_inputs::get_reloc_count): New function.
4581 (Incremental_inputs::set_reloc_count): New function.
4582 (Incremental_inputs::create_data_sections): New function.
4583 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4584 (Incremental_inputs::inputs_section): New function.
4585 (Incremental_inputs::symtab_section): New function.
4586 (Incremental_inputs::relocs_section): New function.
4587 (Incremental_inputs::get_stringpool): Add const.
4588 (Incremental_inputs::command_line): Add const.
4589 (Incremental_inputs::inputs): Remove.
4590 (Incremental_inputs::command_line_key): New function.
4591 (Incremental_inputs::input_file_count): New function.
4592 (Incremental_inputs::input_files): New function.
4593 (Incremental_inputs::relocs_entsize): New function.
4594 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4595 (Incremental_inputs::finalize_inputs): Remove.
4596 (Incremental_inputs::Input_info): Remove.
4597 (Incremental_inputs::lock_): Remove.
4598 (Incremental_inputs::inputs_): Change type.
4599 (Incremental_inputs::inputs_map_): Remove.
4600 (Incremental_inputs::current_object_entry_): New data member.
4601 (Incremental_inputs::inputs_section_): New data member.
4602 (Incremental_inputs::symtab_section_): New data member.
4603 (Incremental_inputs::relocs_section_): New data member.
4604 (Incremental_inputs::reloc_count_): New data member.
4605 (Incremental_inputs_reader): New class.
4606 (Incremental_symtab_reader): New class.
4607 (Incremental_relocs_reader): New class.
4608 * layout.cc (Layout::finalize): Move finalization of incremental info
4609 and creation of incremental info sections to follow finalization of
4610 symbol table. Set offsets for postprocessing sections.
4611 (Layout::create_incremental_info_sections): Call
4612 Incremental_inputs::create_data_sections. Add incremental symtab
4613 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4614 sections to layout after input sections.
4615 * layout.h (struct Timespec): Forward declaration.
4616 (Layout::incremental_inputs): Add const.
4617 (Layout::create_incremental_info_sections): Add parameter.
4618 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4619 * object.cc: Include incremental.h.
4620 (Relobj::finalize_incremental_relocs): New function.
4621 (Sized_relobj::do_layout): Record input sections in incremental info.
4622 * object.h (Object::output_section): New function.
4623 (Object::output_section_offset): Moved from Relobj.
4624 (Object::get_incremental_reloc_base): New function.
4625 (Object::get_incremental_reloc_count): New function.
4626 (Object::do_output_section): New function.
4627 (Object::do_output_section_offset): Moved from Relobj.
4628 (Object::do_get_incremental_reloc_base): New function.
4629 (Object::do_get_incremental_reloc_count): New function.
4630 (Object::Object): Initialize new data members.
4631 (Relobj::output_section): Renamed do_output_section and moved to
4632 protected.
4633 (Relobj::output_section_offset): Moved to Object.
4634 (Relobj::do_get_incremental_reloc_base): New function.
4635 (Relobj::do_get_incremental_reloc_count): New function.
4636 (Relobj::allocate_incremental_reloc_counts): New function.
4637 (Relobj::count_incremental_reloc): New function.
4638 (Relobj::finalize_incremental_relocs): New function.
4639 (Relobj::next_incremental_reloc_index): New function.
4640 (Relobj::reloc_counts_): New data member.
4641 (Relobj::reloc_bases_): New data member.
4642 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4643 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4644 (Sized_relobj::incremental_relocs_scan): New function.
4645 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4646 (Sized_relobj::incremental_relocs_write): New function.
4647 (Sized_relobj::incremental_relocs_write_reltype): New function.
4648 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4649 incremental link.
4650 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4651 archives and object files elsewhere.
4652 (Add_symbols::run): Report object files here.
4653 (Finish_group::run): Report end of archive at end of group.
4654 * reloc.cc: Include layout.h, incremental.h.
4655 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4656 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4657 (Sized_relobj::incremental_relocs_scan): New function.
4658 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4659 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4660 (Sized_relobj::incremental_relocs_write): New function.
4661 (Sized_relobj::incremental_relocs_write_reltype): New function.
4662 * script.cc (read_input_script): Rewrite test for incremental link.
4663 Change call to Incremental_inputs::report_script.
4664 * symtab.h (Symbol_table::first_global_index): New function.
4665 (Symbol_table::output_count): New function.
4666
ce0d1972
DK
46672010-08-12 Doug Kwan <dougkwan@google.com>
4668
4669 * arm.cc (Target_arm::merge_object_attributes): Check command line
4670 options --no-wchar-size-warning and --no-enum-size-warning.
4671 * options.h (General_options): Add ld-compatible options
4672 --no-enum-size-warning and --no-wchar-size-warning.
4673
6e5710ce
ILT
46742010-08-04 Ian Lance Taylor <iant@google.com>
4675
4676 * x86_64.cc (Target_x86_64::Scan::local): Use
4677 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4678 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4679 (Target_x86_64::Scan::global): Likewise.
4680 (Target_x86_64::Relocate::relocate): Likewise.
4681 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4682 Likewise.
4683
fef830db
CC
46842010-08-03 Cary Coutant <ccoutant@google.com>
4685
4686 * merge.cc (Output_merge_string::do_add_input_section): Count strings
4687 to reserve space in merged_strings vector. Keep total input size
4688 for stats.
4689 (Output_merge_string::do_print_merge_stats): Print total input size.
4690 * merge.h (Output_merge_string): Add input_size_ field.
4691 * stringpool.cc (Stringpool_template::string_length): Move
4692 implementations out of Stringpool_template class and place in
4693 stringpool.h.
4694 * stringpool.h (string_length): Move out of Stringpool_template.
4695
1e3811b0
ILT
46962010-08-03 Ian Lance Taylor <iant@google.com>
4697
4698 PR 11712
4699 * layout.cc (relaxation_loop_body): If address of load segment is
4700 set, adjust address to include headers if possible.
4701
7af0c620
ILT
47022010-08-03 Ian Lance Taylor <iant@google.com>
4703
4704 * version.cc (version_string): Bump to 1.10.
4705
22f0da72
ILT
47062010-08-03 Ian Lance Taylor <iant@google.com>
4707
4708 PR 11805
4709 * layout.h (enum Output_section_order): Define.
4710 (class Layout): Update declarations.
4711 * layout.cc (Layout::get_output_section): Add order parameter.
4712 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4713 is_first_non_relro parameters. Change all callers.
4714 (Layout::choose_output_section): Likewise.
4715 (Layout::add_output_section_data): Likewise.
4716 (Layout::make_output_section): Likewise. Set order.
4717 (Layout::default_section_order): New function.
4718 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4719 * output.cc (Output_section::Output_section): Initialize order_.
4720 Don't initialize deleted fields.
4721 (Output_segment::Output_segment): Don't initialize deleted
4722 fields.
4723 (Output_segment::add_output_section_to_load): New function
4724 replacing add_output_section. Change all callers to call this or
4725 add_output_section_to_nonload.
4726 (Output_segment::add_output_section_to_nonload): New function.
4727 (Output_segment::remove_output_section): Rewrite.
4728 (Output_segment::add_initial_output_data): Likewise.
4729 (Output_segment::has_any_data_sections): Likewise.
4730 (Output_segment::is_first_section_relro): Likewise.
4731 (Output_segment::maximum_alignment): Likewise.
4732 (Output_segment::has_dynamic_reloc): New function replacing
4733 dynamic_reloc_count. Change all callers.
4734 (Output_segment::has_dynamic_reloc_list): New function replacing
4735 dynamic_reloc_count_list. Change all callers.
4736 (Output_segment::set_section_addresses): Rewrite.
4737 (Output_segment::set_offset): Rewrite.
4738 (Output_segment::find_first_and_last_list): Remove.
4739 (Output_segment::set_tls_offsets): Rewrite.
4740 (Output_segment::first_section_load_address): Likewise.
4741 (Output_segment::output_section_count): Likewise.
4742 (Output_segment::section_with_lowest_load_address): Likewise.
4743 (Output_segment::write_section_headers): Likewise.
4744 (Output_segment::print_sections_to_map): Likewise.
4745 * output.h (class Output_data): Remove dynamic_reloc_count_
4746 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4747 (Output_data::add_dynamic_reloc): Rewrite.
4748 (Output_data::has_dynamic_reloc): New function.
4749 (Output_data::dynamic_reloc_count): Remove.
4750 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4751 is_last_relro_, is_first_non_relro_, is_interp_,
4752 is_dynamic_linker_section_ fields. Add order and set_order
4753 functions. Remove is_relro_local, set_is_relro_local,
4754 is_last_relro, set_is_last_relro, is_first_non_relro,
4755 set_is_first_non_relro functions, is_interp, set_is_interp,
4756 is_dynamic_linker_section, and set_is_dynamic_linker_section
4757 functions.
4758 (class Output_segment): Change Output_data_list from std::list to
4759 std:;vector. Add output_lists_ field. Remove output_data_ and
4760 output_bss_ fields. Update declarations.
4761
3ff2ccb0
ILT
47622010-08-02 Ian Lance Taylor <iant@google.com>
4763
4764 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4765 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4766 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4767
88a4108b
ILT
47682010-08-02 Ian Lance Taylor <iant@google.com>
4769
4770 PR 11855
4771 * script.cc (Script_options::Script_options): Initialize
4772 symbol_definitions_ and symbol_references_.
4773 (Script_options::add_symbol_assignment): Update
4774 symbol_definitions_ and symbol_references_.
4775 (Script_options::add_symbol_reference): New function.
4776 (script_symbol): New function.
4777 * script.h (class Script_options): Add symbol_definitions_ and
4778 symbol_references_ fields.
4779 (Script_options::referenced_const_iterator): New type.
4780 (Script_options::referenced_begin): New function.
4781 (Script_options::referenced_end): New function.
4782 (Script_options::is_referenced): New function.
4783 (Script_options::any_unreferenced): New function.
4784 * script-c.h (script_symbol): Declare.
4785 * yyscript.y (exp): Call script_symbol.
4786 * symtab.cc: Include "script.h".
4787 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4788 Change all callers. Check symbols referenced by scripts.
4789 (Symbol_table::add_undefined_symbols_from_command_line): Add
4790 layout parameter. Change all callers.
4791 (Symbol_table::do_add_undefined_symbols_from_command_line):
4792 Likewise. Break out loop body. Check symbols referenced by
4793 scripts.
4794 (Symbol_table::add_undefined_symbol_from_command_line): New
4795 function broken out of
4796 do_add_undefined_symbols_from_command_line.
4797 * symtab.h (class Symbol_table): Update declarations.
4798 * archive.cc: Include "layout.h".
4799 (Archive::should_include_member): Add layout parameter. Change
4800 all callers. Check for symbol mentioned in expression.
4801 * archive.h (class Archive): Update declaration.
4802 * object.cc (Sized_relobj::do_should_include_member): Add layout
4803 parameter.
4804 * object.h (Object::should_include_member): Add layout parameter.
4805 Change all callers.
4806 (Object::do_should_include_member): Add layout parameter.
4807 (class Sized_relobj): Update declaration.
4808 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4809 parameter.
4810 * dynobj.h (class Sized_dynobj): Update declaration.
4811 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4812 layout parameter.
4813 * plugin.h (class Sized_pluginobj): Update declaration.
4814
5f1ab67a
ILT
48152010-08-02 Ian Lance Taylor <iant@google.com>
4816
4817 PR 11866
4818 * output.cc (Output_segment::set_offset): Search for the first and
4819 last sections rather than assuming that the list is in order.
4820 (Output_segment::find_first_and_last_list): New function.
4821 * output.h (class Output_segment): Update declarations.
4822 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4823 (relro_strip_test_SOURCES): New variable.
4824 (relro_strip_test_DEPENDENCIES): New variable.
4825 (relro_strip_test_LDFLAGS): New variable.
4826 (relro_strip_test_LDADD): New variable.
4827 (relro_strip_test.so): New target.
4828
a8df5856
ILT
48292010-08-02 Ian Lance Taylor <iant@google.com>
4830
4831 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4832 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4833 (Target_i386::got_tlsdesc_section): New function.
4834 (Target_i386::got_section): Create space for GOT entries for
4835 TLSDESC relocations.
4836 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4837 R_386_TLS_GOTDESC.
4838 (Target_i386::Scan::global): Likewise.
4839 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4840 using TLSDESC GOT.
4841 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4842 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4843 (Target_x86_64::got_tlsdesc_section): New function.
4844 (Target_x86_64::got_section): Create space for GOT entries for
4845 TLSDESC relocations.
4846 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4847 R_386_TLS_GOTDESC.
4848 (Target_x86_64::Scan::global): Likewise.
4849 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4850 using TLSDESC GOT.
4851
0c10a0a6
ILT
48522010-08-02 Ian Lance Taylor <iant@google.com>
4853
4854 * testsuite/final_layout.sh: Use dc to convert from hex to
4855 decimal.
4856
41cbeecc
ST
48572010-07-29 Sriraman Tallam <tmsriram@google.com>
4858
4859 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4860 paramter to the call to gold::gc_process_relocs.
4861 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4862 paramter to the call to gold::gc_process_relocs.
4863 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4864 parameter to the call to gold::gc_process_relocs.
4865 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4866 template parameter to the call to gold::gc_process_relocs.
4867 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4868 paramter to the call to gold::gc_process_relocs.
4869 * gc.h (get_embedded_addend_size): New function.
4870 (gc_process_relocs): Save the size of the reloc for use by ICF.
4871 * icf.cc (get_section_contents): Get the addend from the text section
4872 for SHT_REL relocation sections.
4873 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4874 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4875 * int_encoding.h (read_from_pointer): New overloaded function.
4876 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4877 * testsuite/icf_sht_rel_addend_test.sh: New file.
4878 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4879 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4880
6ea55b82
RW
48812010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4882
4883 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4884 * Makefile.in: Regenerate.
4885 * testsuite/Makefile.in: Regenerate.
4886
9691462b
ILT
48872010-07-27 Jeffrey Yasskin <jyasskin@google.com>
4888
4889 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4890 * gold/testsuite/debug_msg.cc: Likewise.
4891 * gold/testsuite/odr_violation1.cc
4892 * gold/testsuite/odr_violation2.cc
4893
76897331
CC
48942010-07-21 Cary Coutant <ccoutant@google.com>
4895
4896 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4897 string, and length fields.
4898 (Output_merge_string::Merged_strings_list): New type.
4899 (Output_merge_string::Merged_strings_lists): New typedef.
4900 (Output_merge_string): Replace merged_strings_ with
4901 merged_strings_lists_.
4902 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4903 Merged_strings_list per input object and section. Don't store pointer
4904 to the string. Don't store length with each merged string entry.
4905 (Output_merge_string::finalize_merged_data): Loop over list of merged
4906 strings lists. Recompute length of each merged string.
4907
78384e8f
CC
49082010-07-15 Cary Coutant <ccoutant@google.com>
4909
4910 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4911 here.
4912
783659f9
ILT
49132010-07-14 Ian Lance Taylor <iant@google.com>
4914
4915 * descriptors.cc (Descriptors::open): Report correct name in error
4916 message.
4917
131687b4
DK
49182010-07-13 Doug Kwan <dougkwan@google.com>
4919
4920 * arm.cc (Arm_input_section::Arm_input_section): For a
4921 SHT_ARM_EXIDX section, always keeps the input sections.
4922 (Arm_input_section::set_exidx_section_link): New method.
4923 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4924 has_errors_ to false.
4925 (Arm_exidx_input_section::has_errors,
4926 Arm_exidx_input_section::set_has_errors): New methods.
4927 (Arm_exidx_input_section::has_errors_): New data member.
4928 (Arm_relobj::get_exidx_shndx_list): New method.
4929 (Arm_output_section::append_text_sections_to_list): Do not skip
4930 section without SHF_EXECINSTR.
4931 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4932 errors.
2e702c99 4933 (Arm_relobj::make_exidx_input_section): Add new parameter for text
131687b4
DK
4934 section header. Make error messages more verbose. Check for
4935 a non-executable section linked to an EXIDX section.
4936 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4937 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4938 check that there is no deferred EXIDX section if we exit early.
4939 Instead of not making an EXIDX section in case of an error, make one
4940 and set the has_errors flag of it.
4941 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4942 in a relocatable link.
4943 (Target_arm::do_relax): Look for the EXIDX output section instead of
4944 assuming that it is called .ARM.exidx.
2e702c99 4945 (Target_arm::fix_exidx_coverage): Add a new parameter for input
131687b4
DK
4946 section list. Do not check for SHF_EXECINSTR section flags but
4947 skip any input section with errors.
4948 * output.cc (Output_section::Output_section): Initialize
4949 always_keeps_input_sections_ to false.
4950 (Output_section::add_input_section): Check for
4951 always_keeps_input_sections_.
4952 * output.h (Output_section::always_keeps_input_sections,
4953 Output_section::set_always_keeps_input_sections): New methods.
4954 (Output_section::always_keeps_input_sections): New data member.
4955
69517287
RÁE
49562010-07-13 Rafael Espindola <espindola@google.com>
4957
4958 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4959 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4960
82742395
ILT
49612010-07-13 Philip Herron <herron.philip@googlemail.com>
4962 Ian Lance Taylor <iant@google.com>
4963
4964 * output.h (Output_section_lookup_maps::add_merge_section):
4965 Correct check of whether value was inserted.
4966 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4967 (Output_section_lookup_maps::add_relaxed_input_section):
4968 Likewise.
4969 * arm.cc (Target_arm::got_section): Remove used local os.
4970 * i386.cc (Target_i386::got_section): Likewise.
4971 * x86_64.cc (Target_x86_64::got_section): Likewise.
4972 * sparc.cc (Target_sparc::got_section): Likewise.
4973 (Target_sparc::relocate): Remove unused local have_got_offset.
4974 * powerpc.cc (Target_powerpc::relocate): Likewise.
4975
f2d707b5
ILT
49762010-07-13 Ian Lance Taylor <iant@google.com>
4977
241531d6
ILT
4978 * compressed_output.cc (zlib_decompress): Fix signature in
4979 !HAVE_ZLIB_H case.
4980
f2d707b5
ILT
4981 * archive.cc (Archive::include_member): Unlock an external member
4982 of a thin archive. Don't bother to delete an object we know is
4983 NULL.
4984
a2e47362
CC
49852010-07-12 Cary Coutant <ccoutant@google.com>
4986
4987 * compressed_output.cc (zlib_decompress): New function.
4988 (get_uncompressed_size): New function.
4989 (decompress_input_section): New function.
4990 * compressed_output.h (get_uncompressed_size): New function.
4991 (decompress_input_section): New function.
4992 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4993 Handle compressed debug sections.
4994 * layout.cc (is_compressed_debug_section): New function.
4995 (Layout::output_section_name): Map compressed section names to
4996 canonical names.
4997 * layout.h (is_compressed_debug_section): New function.
4998 (is_debug_info_section): Recognize compressed debug sections.
4999 * merge.cc: Include compressed_output.h.
5000 (Output_merge_data::do_add_input_section): Handle compressed
5001 debug sections.
5002 (Output_merge_string::do_add_input_section): Handle compressed
5003 debug sections.
5004 * object.cc: Include compressed_output.h.
5005 (Sized_relobj::Sized_relobj): Initialize new data members.
5006 (build_compressed_section_map): New function.
5007 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5008 * object.h (Object::section_is_compressed): New method.
5009 (Object::do_section_is_compressed): New method.
5010 (Sized_relobj::Compressed_section_map): New type.
5011 (Sized_relobj::do_section_is_compressed): New method.
5012 (Sized_relobj::compressed_sections_): New data member.
5013 * output.cc (Output_section::add_input_section): Handle compressed
5014 debug sections.
5015 * reloc.cc: Include compressed_output.h.
5016 (Sized_relobj::write_sections): Handle compressed debug sections.
5017
ce279a62
CC
50182010-07-08 Cary Coutant <ccoutant@google.com>
5019
5020 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5021 weak when resolving to a dynamic def.
5022 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5023 for weak undef/dynamic def cases. Adjust callers.
5024 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5025 undef_binding_weak_.
5026 (Symbol_table::sized_write_globals): Adjust symbol binding.
5027 (Symbol_table::sized_write_symbol): Add binding parameter.
5028 * symtab.h (Symbol::set_undef_binding): New method.
5029 (Symbol::is_undef_binding_weak): New method.
5030 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5031 (Symbol_table::should_override): Add new parameter.
5032 (Symbol_table::sized_write_symbol): Add new parameter.
5033
5034 * testsuite/weak_undef_file1.cc: Add new test case.
5035 * testsuite/weak_undef_file2.cc: Fix header comment.
5036 * testsuite/weak_undef_test.cc: Add new test case.
5037
b2286c10
DK
50382010-06-29 Doug Kwan <dougkwan@google.com>
5039
5040 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5041 Initialize USE_SYMBOL_.
5042 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5043 definition.
5044 (Arm_reloc_property::uses_symbol_): New data member declaration.
5045 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5046 uses symbol value and symbol is undefined but not weakly undefined.
5047
4802450a
RÁE
50482010-06-28 Rafael Espindola <espindola@google.com>
5049
5050 * plugin.cc (Plugin::load): Use dlerror.
5051
e5ca47ba
ILT
50522010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5053
5054 * symtab.cc (detect_odr_violations): When reporting an ODR
5055 violation, report an object where the symbol is defined.
5056
8a75a161
DK
50572010-06-25 Doug Kwan <dougkwan@google.com>
5058
5059 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5060 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5061 definition.
5062 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5063 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5064 target hook to detect function points.
5065 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5066 * icf.h (Icf::check_section_for_function_pointers): Change type of
5067 parameter SECTION_NAME to const reference to std::string. Use
5068 target hook to determine if section may have unsafe pointers.
5069 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5070 method definition.
5071
42218b9f
RÁE
50722010-06-21 Rafael Espindola <espindola@google.com>
5073
5074 * fileread.cc (Input_file::find_fie): New
5075 (Input_file::open): Use Input_file::find_fie.
5076 * fileread.h (Input_file::find_fie): New
5077 * plugin.cc (set_extra_library_path): New.
5078 (Plugin::load): Add set_extra_library_path to the transfer vector.
5079 (Plugin_manager::set_extra_library_path): New.
5080 (Plugin_manager::add_input_file): Use the extra search path if set.
5081 (set_extra_library_path(): New.
5082 * plugin.h (Plugin_manager): Add set_extra_library_path and
5083 extra_search_path_.
5084
a0506cca
CC
50852010-06-19 Cary Coutant <ccoutant@google.com>
5086
5087 * layout.cc (gdb_sections): Add .debug_types.
5088 (lines_only_debug_sections): Likewise.
5089
6508b958
RÁE
50902010-06-18 Rafael Espindola <espindola@google.com>
5091
5092 * plugin.cc (add_input_file,add_input_library)
5093 (Plugin_manager::add_input_file): Make filename arguments const.
5094 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5095 const.
5096
3e235302
DK
50972010-06-16 Doug Kwan <dougkwan@google.com>
5098
5099 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5100 .ARM.attributes section if we have not merged any input
5101 attributes sections.
5102
106e8a6c
DK
51032010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5104
5105 * arm.cc: Allow combining objects with no EABI version
5106 information.
5107
91ff43fe
RÁE
51082010-06-15 Rafael Espindola <espindola@google.com>
5109
5110 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5111
68ed838c
ILT
51122010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5113
5114 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5115 (struct iovec): Correct !HAVE_READV definition.
5116
f3a2388f
CC
51172010-06-10 Cary Coutant <ccoutant@google.com>
5118
5119 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5120 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5121 reloc sections.
5122 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5123
5124 PR 11683
5125 * symtab.h (Symbol::is_placeholder): New member function.
5126 * target-reloc.h (relocate_section): Check for placeholder symbols.
5127
5128 * testsuite/Makefile.am (plugin_test_8): New test.
5129 (plugin_test_9): New test.
5130 * testsuite/Makefile.in: Regenerate.
5131
e1df38aa
NC
51322010-06-09 Nick Clifton <nickc@redhat.com>
5133
5134 * yyscript.y (input_list_element): Allow strings prefixed with
5135 the '-' character. Treat these as libraries.
5136 * script.cc (script_add_library): New function. Adds a library
5137 specified by "-l<name>" found in an input script.
5138 * script-c.h: Add prototype for script_add_library.
5139
25bbe950
DK
51402010-06-07 Doug Kwan <dougkwan@google.com>
5141
5142 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5143 Restrict stub-group size to be within long conditional branch
5144 range when working around cortex-A8 erratum.
5145
0f32ea4c
ILT
51462010-06-07 Damien Diederen <dd@crosstwine.com>
5147
5148 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5149 #ifdef typo.
5150
8fe2a369
ST
51512010-06-03 Sriraman Tallam <tmsriram@google.com>
5152
5153 PR gold/11658
5154 * output.cc
5155 (Output_section::Input_section_sort_entry::compare_section_ordering):
5156 Change to return non-zero correctly.
5157 (Output_section::Input_section_sort_section_order_index_compare
5158 ::operator()): Change to fix ambiguity in comparisons.
5159
6e9ba2ca
ST
51602010-06-01 Sriraman Tallam <tmsriram@google.com>
5161
5162 * gold.h (is_wildcard_string): New function.
5163 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5164 (Layout::layout_eh_frame): Ditto.
5165 (Layout::find_section_order_index): New method.
5166 (Layout::read_layout_from_file): New method.
5167 * layout.h (Layout::find_section_order_index): New method.
5168 (Layout::read_layout_from_file): New method.
5169 (Layout::input_section_position_): New private member.
5170 (Layout::input_section_glob_): New private member.
5171 * main.cc (main): Call read_layout_from_file here.
5172 * options.h (--section-ordering-file): New option.
5173 * output.cc (Output_section::input_section_order_specified_): New
5174 member.
5175 (Output_section::Output_section): Initialize new member.
5176 (Output_section::add_input_section): Add new parameter.
5177 Keep input sections when --section-ordering-file is used.
5178 (Output_section::set_final_data_size): Sort input sections when
5179 section ordering file is specified.
5180 (Output_section::Input_section_sort_entry): Add new parameter.
5181 Check sorting type.
5182 (Output_section::Input_section_sort_entry::compare_section_ordering):
5183 New method.
5184 (Output_section::Input_section_sort_compare::operator()): Change to
5185 consider section_order_index.
5186 (Output_section::Input_section_sort_init_fini_compare::operator()):
5187 Change to consider section_order_index.
5188 (Output_section::Input_section_sort_section_order_index_compare
5189 ::operator()): New method.
5190 (Output_section::sort_attached_input_sections): Change to sort
5191 according to section order when specified.
e1df38aa
NC
5192 (Output_section::add_input_section<32, true>): Add new parameter.
5193 (Output_section::add_input_section<64, true>): Add new parameter.
5194 (Output_section::add_input_section<32, false>): Add new parameter.
5195 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
5196 * output.h (Output_section::add_input_section): Add new parameter.
5197 (Output_section::input_section_order_specified): New
5198 method.
5199 (Output_section::set_input_section_order_specified): New method.
5200 (Input_section::Input_section): Initialize section_order_index_.
5201 (Input_section::section_order_index): New method.
5202 (Input_section::set_section_order_index): New method.
5203 (Input_section::section_order_index_): New member.
5204 (Input_section::Input_section_sort_section_order_index_compare): New
5205 struct.
5206 (Output_section::input_section_order_specified_): New member.
5207 * script-sections.cc (is_wildcard_string): Delete and move modified
5208 method to gold.h.
5209 (Output_section_element_input::Output_section_element_input): Modify
5210 call to is_wildcard_string.
5211 (Output_section_element_input::Input_section_pattern
5212 ::Input_section_pattern): Ditto.
5213 (Output_section_element_input::Output_section_element_input): Ditto.
5214 * testsuite/Makefile.am (final_layout): New test case.
5215 * testsuite/Makefile.in: Regenerate.
5216 * testsuite/final_layout.cc: New file.
5217 * testsuite/final_layout.sh: New file.
5218
3537c84b
RÁE
52192010-06-01 Rafael Espindola <espindola@google.com>
5220
5221 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5222
105b6afd
RÁE
52232010-06-01 Rafael Espindola <espindola@google.com>
5224
5225 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5226 visibility of symbols.
5227
29e11421
DK
52282010-05-27 Doug Kwan <dougkwan@google.com>
5229
5230 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5231 from start of output section instead of address for a local symbol
5232 in a merged or relaxed section when doing a relocatable link.
5233
5e0f337e
RÁE
52342010-05-26 Rafael Espindola <espindola@google.com>
5235
5236 PR 11604
5237 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5238 adding sections the garbage collector removed.
5239 * gold/testsuite/Makefile.am: Add test.
5240 * gold/testsuite/Makefile.in: Regenerate.
5241 * gold/testsuite/plugin_test_7.sh: New.
5242 * gold/testsuite/plugin_test_7_1.c: New.
5243 * gold/testsuite/plugin_test_7_2.c: New.
5244
f4187277
RÁE
52452010-05-26 Rafael Espindola <espindola@google.com>
5246
5247 * script-sections.cc (Output_section_definition::set_section_addresses):
5248 Check for --section-start.
5249
5c388529
DK
52502010-05-26 Doug Kwan <dougkwan@google.com>
5251
5252 * arm.cc (Arm_scan_relocatable_relocs): New class.
5253 (Target_arm::relocate_special_relocatable): New method.
5254 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5255 (Arm_relocate_functions::thumb_branch_common): Same.
5256 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5257 instead of Default_scan_relocatable_relocs.
5258 * target-reloc.h (relocate_for_relocatable): Let target handle
5259 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5260 * target.h (Sized_target::relocate_special_relocatable): New method.
5261
bca1c3ae
ILT
52622010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5263
5264 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5265
0439c796
DK
52662010-05-23 Doug Kwan <dougkwan@google.com>
5267
5268 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5269 instead of a cast.
5270 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5271 with a direct branch, not a conditional branch, to a stub.
5272 * merge.cc (Output_merge_base::record_input_section): New method
5273 defintion.
5274 (Output_merge_data::do_add_input_section): Record input section if
5275 keeps-input-sections flag is set.
5276 (Output_merge_string::do_add_input_section): Ditto.
5277 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5278 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5279 INPUT_SECTIONS_.
5280 (Output_merge_base::keeps_input_sections,
5281 Output_merge_base::set_keeps_input_sections,
5282 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5283 method definitions.
5284 (Output_merge_base::Input_sections): New type declaration.
5285 (Output_merge_base::input_sections_begin,
5286 Output_merge_base::input_sections_end,
5287 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5288 (Output_merge_base::bool keeps_input_sections_,
5289 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5290 Output_merge_base::input_sections_): New data members.
5291 (Output_merge_data::do_set_keeps_input_sections): New method
5292 defintion.
5293 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5294 * output.cc (Output_section::Input_section::relobj): Move method
5295 defintion from class declaration to here and handle merge sections.
5296 (Output_section::Input_section::shndx): Ditto.
5297 (Output_section::Output_section): Remove initializations of removed
5298 data members and initialize new data member LOOKUP_MAPS_.
5299 (Output_section::add_input_section): Set keeps-input-sections flag
5300 for a newly created merge output section as appropriate. Adjust code
5301 to use Output_section_lookup_maps class.
5302 (Output_section::add_relaxed_input_section): Adjst code for lookup
5303 maps code refactoring.
2e702c99 5304 (Output_section::add_merge_input_section): Add a new parameter
0439c796
DK
5305 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5306 class. If adding input section to a newly created merge output
5307 section fails, remove the new merge section.
5308 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 5309 Adjust code for use of the Output_section_lookup_maps class.
2e702c99 5310 (Output_section::find_merge_section): Ditto.
0439c796 5311 (Output_section::build_lookup_maps): New method defintion.
2e702c99 5312 (Output_section::find_relaxed_input_section): Adjust code to use
0439c796
DK
5313 Output_section_lookup_maps class.
5314 (Output_section::get_input_sections): Export merge sections. Adjust
5315 code to use Output_section_lookup_maps class.
5316 (Output_section:::add_script_input_section): Adjust code to use
5317 Output_section_lookup_maps class. Update lookup maps for merge
5318 sections also.
5319 (Output_section::discard_states): Use Output_section_lookup_maps.
5320 (Output_section::restore_states): Same.
5321 * output.h (Merge_section_properties): Move class defintion out of
5322 Output_section.
5323 (Output_section_lookup_maps): New class.
5324 (Output_section::Input_section::is_merge_section): New method
5325 defintion.
5326 (Output_section::Input_section::relobj): Move defintion out of class
5327 defintion. Declare method only.
5328 (Output_section::Input_section::shndx): Ditto.
5329 (Output_section::Input_section::output_merge_base): New method defintion.
2e702c99 5330 (Output_section::Input_section::u2_.pomb): New union field.
0439c796
DK
5331 (Output_section::Merge_section_by_properties_map,
5332 Output_section::Output_section_data_by_input_section_map,
5333 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5334 Remove types.
2e702c99 5335 (Output_section::add_merge_input_section): Add new parameter
0439c796
DK
5336 KEEPS_INPUT_SECTIONS.
5337 (Output_section::build_lookup_maps): New method declaration.
5338 (Output_section::merge_section_map_,
5339 Output_section::merge_section_by_properties_map_,
5340 Output_section::relaxed_input_section_map_,
5341 Output_section::is_relaxed_input_section_map_valid_): Remove data
5342 members.
5343 (Output_section::lookup_maps_): New data member.
5344
76295588
L
53452010-05-21 Doug Kwan <dougkwan@google.com>
5346
5347 PR gold/11619
5348 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5349 avoid a compilation error.
5350
d103a984
RÁE
53512010-05-19 Rafael Espindola <espindola@google.com>
5352
5353 * script-sections.cc (Output_section_definition::allocate_to_segment):
5354 Update the phdrs_list even when the output section is NULL.
5355 * testsuite/Makefile.am: Add test.
5356 * testsuite/Makefile.in: Regenerate.
5357 * testsuite/script_test_9.cc: New.
5358 * testsuite/script_test_9.sh: New.
5359 * testsuite/script_test_9.t: New.
5360
6625d24e
DK
53612010-05-19 Doug Kwan <dougkwan@google.com>
5362
5363 * arm.cc (Arm_input_section::original_size): New method.
5364 (Arm_input_section::do_addralign): Add a cast.
5365 (Arm_input_section::do_output_offset): Remove static cast.
5366 (Arm_input_section::original_addralign,
5367 Arm_input_section::original_size_): Change type to uint32_t.
5368 (Arm_input_section::init): Add safe casts for section alignment
5369 and size.
5370 (Arm_input_section::set_final_data_size): Do not set address and
5371 offset of stub table.
5372 (Arm_output_section::fix_exidx_coverage): Change use of of
5373 Output_section::Simple_input_section to that of
5374 Output_section::Input_section.
5375 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5376 except for the first pass.
5377 * output.cc (Output_section::get_input_sections): Change type of
5378 input_sections to std::list<Input_section>.
5379 (Output_section::add_script_input_section): Rename from
5380 Output_section::add_simple_input_section. Change type of SIS
5381 parameter from Simple_input_section to Input_section.
5382 * output.h (Output_section::Simple_input_section): Remove class.
5383 (Output_section::Input_section): Change class visibility to public.
5384 (Output_section::Input_section::addralign): Use stored alignments
5385 for special input sections if set.
5386 (Output_section::Input_section::set_addralign): New method.
5387 (Output_section::get_input_sections): Change parameter type from
5388 list of Simple_input_section to list of Input_section.
5389 (Output_section::add_script_input_section): Rename from
5390 Output_section::add_simple_input_section. Change first parameter's
5391 type from Simple_input_section to Input_section and remove the
5392 second and third parameters.
5393 * script-sections.cc (Input_section::Input_section_list): Change
5394 type to list of Output_section::Input_section/
5395 (Input_section_info::Input_section_info): Change parameter type of
5396 INPUT_SECTION to Output_section::Input_section.
5397 (Input_section_info::input_section): Change return type.
5398 (Input_section_info::input_section_): Change type to
5399 Output_section::Input_section.
5400 (Output_section_element_input::set_section_addresses): Adjust code
5401 to use Output_section::Input_section instead of
5402 Output_section::Simple_input_section. Adjust code for renaming
5403 of Output_section::add_simple_input_section.
5404 (Orphan_output_section::set_section_addresses): Ditto.
5405
e1e82ea4
RW
54062010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5407
5408 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5409 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5410
91e75c8a
RÁE
54112010-05-18 Rafael Espindola <espindola@google.com>
5412
5413 * options.cc (General_options::finalize): Handle -nostdlib.
5414 * options.h (nostdlib): New option.
5415 * script.cc (script_add_search_dir): Handle -nostdlib.
5416
da59ad79
DK
54172010-05-12 Doug Kwan <dougkwan@google.com>
5418
5419 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5420 attributes section only if there no attributes section after merging.
5421 (Target_arm::merge_object_attributes): Move value of
e1df38aa 5422 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
5423 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5424 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5425 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5426 and arm_attr_merge_7.stdout.
5427 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5428 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5429 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5430 arm_attr_merge_7b.o): New rules.
5431 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5432 arm_attr_merge_7
5433 * testsuite/Makefile.in: Regenerate.
5434 * testsuite/arm_attr_merge.sh: New file.
5435 * testsuite/arm_attr_merge_[67][ab].s: Same.
5436
3e01a7fd
NC
54372010-05-05 Nick Clifton <nickc@redhat.com>
5438
5439 * po/es.po: Updated Spanish translation.
5440
7ad2014a
L
54412010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5442
5443 * Makefile.am (install-exec-local): Properly install gold as
5444 default cross linker.
5445 * Makefile.in: Regenerated.
5446
4fda8867
NC
54472010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5448 Nick Clifton <nickc@redhat.com>
5449
5450 * configure.ac (install_as_default): Define and set to false
5451 unless --enable-gold or --enable-gold=both/gold has been
5452 specified.
5453 * configure: Regenerate.
5454
5455 * Makefile.am (install-exec-local): Install the executable as
5456 'ld.gold'. If install_as_default is true then also install it as
5457 'ld'.
5458 * Makefile.in: Regenerated.
5459
bd288ea2
ILT
54602010-04-24 Ian Lance Taylor <iant@google.com>
5461
5462 * layout.cc (Layout::layout_reloc): In relocatable link don't
5463 combine reloc sections for grouped sections.
5464
ef38fd8a
ST
54652010-04-23 Sriraman Tallam <tmsriram@google.com>
5466
5467 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5468 sections that are not ordinary to icf.
5469 * icf.cc (get_section_contents): Handle relocation pointing to section
5470 with no object or shndx information.
5471 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5472 * testsuite/Makefile.in: Regenerate.
5473 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5474 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5475
f6973bdc
ILT
54762010-04-22 Ian Lance Taylor <iant@google.com>
5477
5478 * expression.cc (Expression::Expression_eval_info): Add
5479 result_alignment_pointer field.
5480 (Expression::eval_with_dot): Add result_alignment_pointer
5481 parameter. Change all callers.
5482 (Expression::eval_maybe_dot): Likewise.
5483 (class Binary_expression): Add alignment_pointer parameter to
5484 left_value and right_value. Change all callers.
5485 (BINARY_EXPRESSION): Set result alignment.
5486 (class Trinary_expression): Add alignment_pointer parameter to
5487 arg2_value and arg3_value. Change all callers.
5488 (Trinary_cond::value): Set result alignment.
5489 (Max_expression::value, Min_expression::value): Likewise.
5490 (Align_expression::value): Likewise.
5491 * script-sections.cc (class Sections_element): Add dot_alignment
5492 parameter to set_section_addresses virtual function. Update
5493 instantiations.
5494 (class Output_section_element): Likewise.
5495 (Script_sections::create_segments): Add dot_alignment parameter.
5496 Change all callers.
5497 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5498 (Script_sections::set_phdrs_clause_addresses): Likewise.
5499 * script-sections.h: Update declarations.
5500 * script.h: Update declarations.
5501 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5502 min_p_align.
5503 * testsuite/script_test_3.t: Set large alignment.
5504 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5505 segment has expected alignment.
5506
9c9c98a5
NC
55072010-04-22 Nick Clifton <nickc@redhat.com>
5508
5509 * po/gold.pot: Updated by the Translation project.
5510 * po/vi.po: Updated Vietnamese translation.
5511
2253bfba
L
55122010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5513
5514 * testsuite/Makefile.am (check_PROGRAMS): Add
5515 icf_virtual_function_folding_test.
5516 * testsuite/Makefile.in: Regenerated.
5517
85fdf906
AH
55182010-04-15 Andrew Haley <aph@redhat.com>
5519
5520 * options.h (merge_exidx_entries): New option.
5521 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5522 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5523 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5524 (Target_arm::merge_exidx_entries): New function.
5525 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5526 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5527 to Arm_exidx_fixup constructor.
5528 Add new arg, merge_exidx_entries.
5529 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5530 Arm_output_section::fix_exidx_coverage.
5531
ce97fa81
ST
55322010-04-18 Sriraman Tallam <tmsriram@google.com>
5533
5534 * icf.cc (get_section_contents): Check for preemptible functions.
5535 Ignore addend when appropriate.
5536 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5537 section folded.
5538 (add_from_relobj): Check for section folded.
5539 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5540 * symtab.h (should_add_dynsym_entry): Add new parameter.
5541 * target-reloc.h (scan_relocs): Check for section folded.
5542 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5543 Check reloc types for function pointers in shared objects.
5544 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5545 case.
5546 (icf_preemptible_functions_test): New test case.
5547 (icf_string_merge_test): New test case.
5548 * testsuite.Makefile.in: Regenerate.
5549 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5550 bar_glob. Refactor code.
5551 * testsuite/icf_preemptible_functions_test.cc: New file.
5552 * testsuite/icf_preemptible_functions_test.sh: New file.
5553 * testsuite/icf_string_merge_test.cc: New file.
5554 * testsuite/icf_string_merge_test.sh: New file.
5555 * testsuite/icf_virtual_function_folding_test.cc: New file.
5556 * testsuite/icf_virtual_function_folding_test.sh: New file.
5557
04ceb17c
DK
55582010-04-14 Doug Kwan <dougkwan@google.com>
5559
5560 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5561 for local symbol recounting if we remove a section due to ICF.
5562 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5563 there are no regular objects in input.
5564
153e7da4
DK
55652010-04-13 Doug Kwan <dougkwan@google.com>
5566
5567 * arm.cc (Arm_input_section::set_final_data_size): Compute
5568 accurate final data size instead of using current data size.
5569
4dbd9faf
DK
55702010-04-09 Doug Kwan <dougkwan@google.com>
5571
5572 * layout.cc (Layout::choose_output_section): Handle script section
5573 types.
5574 (Layout::make_output_section_for_script): Add section type parameter.
5575 Handle script section types.
5576 * layout.h (Layout::make_output_section_for_script): Add section
5577 type parameter.
5578 * output.cc (Output_section::Output_section): Initialize data member
5579 is_noload_.
5580 (Output_section::do_reset_address_and_file_offset): Do not set address
5581 to 0 if section is a NOLOAD section.
5582 * output.h (Output_section::is_noload): New method.
5583 (Output_section::set_is_noload): Ditto.
5584 (Output_section::is_noload_): New data member.
5585 * script-c.h (Script_section_type): New enum type.
5586 (struct Parser_output_section_header): Add new file section_type.
5587 * script-sections.cc (Sections_element::output_section_name): Add
5588 parameter for returning script section type.
5589 (Output_section_definition::output_section_name): Ditto.
5590 (Output_section_definition::section_type)P; New method.
5591 (Output_section_definiton::script_section_type_name): Ditto.
5592 (Output_section_definition::script_section_type_): New data member.
5593 (Output_section_definition::Output_section_definition): Initialize
5594 data member Output_section_definition::script_section_type_.
5595 (Output_section_definition::create_sections): Pass script section type
5596 to Layout::make_output_section_for_script.
5597 (Output_section_definition::output_section_name): Return script
5598 section type to caller.
5599 (Output_section_definition::set_section_address): Do not advance
5600 dot value and load address if section type is NOLOAD. Set address
5601 of NOLOAD sections regardless of section flags.
5602 (Output_section_definition::print): Print section type if it is
5603 not SCRIPT_SECTION_TYPE_NONE.
5604 (Output_section_definition::section_type): New method.
5605 (Output_section_definition::script_section_type_name): Ditto.
5606 (Script_sections::output_section_name): Add new parameter
5607 PSECTION_TYPE for returning script section type. Pass it to
5608 section elements. Handle discard sections.
5609 (Sort_output_sections::operator()): Handle NOLOAD sections.
5610 * script-sections.h (Script_sections::Section_type): New enum type.
2e702c99 5611 (Script_sections::output_section_name): Add a new parameter for
4dbd9faf
DK
5612 returning script section type.
5613 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5614 INFO and NOLOAD.
5615 * yyscript.y (union): Add new field SECTION_TYPE.
5616 (COPY, DSECT, INFO, NOLOAD): New tokens.
5617 (opt_address_and_section_type): Change type to output_section_header.
5618 (section_type): New non-terminal
5619 (section_header): Handle section type.
2253bfba 5620 (opt_address_and_section_type): Return section type value.
4dbd9faf 5621
721ea635
L
56222010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5623
5624 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5625 * testsuite/plugin_common_test_2.c (foo): Likewise.
5626
6bf924b0
DK
56272010-04-08 Doug Kwan <dougkwan@google.com>
5628
5629 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5630 Output_merge_data.
5631 * output.cc (Output_section::add_merge_input_section): Simplify
5632 code and return status of Output_merge_base::add_input_section.
e1df38aa 5633 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
5634 returns true.
5635
24af6f92
DK
56362010-04-07 Doug Kwan <dougkwan@google.com>
5637
5638 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5639 if section is marked as containing instructions but has no mapping
5640 symbols.
5641 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5642 correct section index.
5643 (Arm_relobj::find_linked_text_section): Ditto.
5644
00698fc5
CC
56452010-04-07 Cary Coutant <ccoutant@google.com>
5646
5647 * archive.cc (include_member): Destroy Read_symbols_data object before
5648 releasing file.
5649 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5650 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5651 (Read_symbols_data::~Read_symbols_data) New destructor.
5652 (Section_relocs::Section_relocs) New constructor.
5653 (Section_relocs::~Section_relocs) New destructor.
5654 (Read_relocs_data::Read_relocs_data) New constructor.
5655 (Read_relocs_data::~Read_relocs_data) New destructor.
5656 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5657 pointers to NULL after deleting.
5658
7296d933
DK
56592010-04-07 Doug Kwan <dougkwan@google.com>
5660
5661 * arm.cc: Replace "endianity" with "endianness" in comments.
5662 (Arm_exidx_cantunwind): Ditto.
5663 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5664 (Arm_relobj::merge_flags_and_attributes): New method.
5665 (Arm_relobj::merge_flags_and_attributes_): New data member.
5666 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5667 (Arm_relobj::scan_sections_for_stubs): Ditto.
5668 (Arm_relobj::do_read_symbols): Check to see if we really want to
5669 merge processor-specific flags and attributes. Exit early if
5670 an object is empty except for section names and the undefined symbol.
5671 (Target_arm::do_finalize_sections): Move check for ELF format to
5672 Arm_relobj::do_read_symbols. Merge processor specific flags and
5673 attributes from a regular object only when we have determined that
5674 it is aapropriate. Do not create an .ARM.attributes section in
5675 output if there is no regular input object.
5676 (Target_arm::merge_processor_specific_flags): Check
5677 --warn-mismatch before printing any error.
5678 (Target_arm::merge_object_attributes): Ditto.
5679 * gold.cc (queue_middle_tasks): Handle the case in which there is
5680 no regular object in input.
5681 * options.cc (General_options::parse_EB): New method.
5682 (General_options::parse_EL): Same.
5683 (General_options::General_options): Initialize endianness_.
5684 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5685 New options.
5686 (General_options::Endianness): New enum.
5687 (General_options::endianness): New method.
5688 (General_options::endianness_): New data member.
5689 * parameters.cc (Parameters::set_options): Check target endianness.
5690 (Parameters::set_target_once): Ditto.
5691 (Parameters::check_target_endianness): New method.
5692 (parameters_force_valid_target): If either -EL or -EB is specified,
5693 use it to define endianness of default target.
5694 * parameters.h (Parameters::check_target_endianness): New method
5695 declaration.
5696 * target.h (class Target): Change "endianity" to "endianness"
5697 in comments.
5698
efc8d4f2
RW
56992010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5700
5701 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5702 * configure: Regenerate.
5703 * Makefile.in: Regenerate.
5704 * testsuite/Makefile.in: Regenerate.
5705
be234d88
CC
57062010-04-06 Cary Coutant <ccoutant@google.com>
5707
5708 gcc PR lto/42757
5709 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5710 prevailing definitions of common symbols.
5711 * testsuite/plugin_test_6.sh: New test case.
5712 * testsuite/plugin_common_test_1.c: New test case.
5713 * testsuite/plugin_common_test_2.c: New test case.
5714 * testsuite/Makefile.am (plugin_test_6): New test case.
5715 * testsuite/Makefile.in: Regenerate.
5716
bd32c6bd
NC
57172010-04-06 Nick Clifton <nickc@redhat.com>
5718
5719 * po/vi.po: New Vietnamese translation.
5720
323c532f
DK
57212010-03-30 Doug Kwan <dougkwan@google.com>
5722
5723 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5724
4fcd97eb
DK
57252010-03-25 Doug Kwan <dougkwan@google.com>
5726
5727 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5728 to avoid a conversion warning on a 32-bit host.
5729
4ebf39db
ILT
57302010-03-24 Ian Lance Taylor <iant@google.com>
5731
5732 * testsuite/script_test_3.t: Add a TLS segment.
5733 * testsuite/Makefile.am (check_PROGRAMS): Add
5734 tls_phdrs_script_test.
5735 (tls_phdrs_script_test_SOURCES): Define.
5736 (tls_phdrs_script_test_DEPENDENCIES): Define.
5737 (tls_phdrs_script_test_LDFLAGS): Define.
5738 (tls_phdrs_script_test_LDADD): Define.
5739 * testsuite/Makefile.in: Rebuild.
5740
4a599bdd
CC
57412010-03-23 Cary Coutant <ccoutant@google.com>
5742
5743 * fileread.cc (find_or_make_view): Fix comment.
5744
6c93b22c
ILT
57452010-03-23 Ian Lance Taylor <iant@google.com>
5746
5747 * script-sections.cc (class Orphan_section_placement): Define
5748 PLACE_TLS and PLACE_TLS_BSS.
5749 (Orphan_section_placement::Orphan_section_placement): Initialize
5750 new places.
5751 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5752 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5753 (tls_script_test_SOURCES): Define.
5754 (tls_script_test_DEPENDENCIES): Define.
5755 (tls_script_test_LDFLAGS): Define.
5756 (tls_script_test_LDADD): Define.
5757 * testsuite/Makefile.in: Rebuild.
5758
a2c7281b
DK
57592010-03-22 Doug Kwan <dougkwan@google.com>
5760
5761 * arm.cc (Arm_relocate_functions::abs8,
5762 Arm_relocate_functions::abs16): Use correct check for overflow
5763 specified in the ARM ELF specs.
5764 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5765 target of a BLX instruction specially.
5766 (Reloc_stub::stub_type_for_reloc): Ditto.
5767 (Relocate::relocate): Use symbolic names instead of numeric relocation
5768 codes to report error.
5769 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5770 workaround.
5771 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5772 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5773 thumb2_blx_out_of_range.stdout
5774 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5775 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5776 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5777 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5778 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5779 thumb2_blx_in_range, thumb2_blx_in_range.o,
5780 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5781 thumb2_blx_out_of_range.o): New rules.
2e702c99 5782 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
a2c7281b
DK
5783 thumb2_blx_in_range and thumb2_blx_out_of_range.
5784 * testsuite/Makefile.in: Regenerate.
5785 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5786 * testsuite/thumb_blx_in_range.s: New file.
5787 * testsuite/thumb_blx_out_of_range.s: New file.
5788
b0193076
RÁE
57892010-03-22 Rafael Espindola <espindola@google.com>
5790
5791 * archive.cc (Should_include): Move to archive.h.
5792 (should_include_member): Make it a member of Archive.
5793 (Lib_group): New.
5794 (Add_lib_group_symbols): New.
5795 * archive.h: Include options.h.
5796 (Archive_member): Moved from Archive.
5797 (Should_include): Moved from archive.cc.
5798 (Lib_group): New.
5799 (Add_lib_group_symbols): New.
5800 * dynobj.cc (do_should_include_member): New.
5801 * dynobj.h (do_should_include_member): New.
5802 * gold.cc (queue_initial_tasks): Update call to queue.
5803 * main.cc (main): Print lib group stats.
5804 * object.cc (do_should_include_member): New.
5805 * object.h: Include archive.h.
5806 (Object::should_include_member): New.
5807 (Object::do_should_include_member): New.
5808 (Sized_relobj::do_should_include_member): New.
5809 * options.cc (General_options::parse_start_lib): New.
5810 (General_options::parse_end_lib): New.
5811 (Input_arguments::add_file): Handle lib groups.
5812 (Input_arguments::start_group): Check we are not in a lib.
5813 (Input_arguments::start_lib): New.
5814 (Input_arguments::end_lib): New.
5815 * options.h (General_options): Add start_lib and end_lib.
5816 (Input_argument::lib_): New.
5817 (Input_argument::lib): New.
5818 (Input_argument::is_lib): New.
5819 (Input_file_lib): New.
5820 (Input_arguments::in_lib_): New.
5821 (Input_arguments::in_lib): New.
5822 (Input_arguments::start_lib): New.
5823 (Input_arguments::end_lib_): New.
5824 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5825 in unused members as preempted.
5826 (Sized_pluginobj::do_should_include_member): New.
5827 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5828 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5829 return the blocker.
5830 (Read_symbols::do_whole_lib_group): New.
5831 (Read_symbols::do_lib_group): New.
5832 (Read_symbols::do_read_symbols): Handle lib groups.
5833 (Read_symbols::get_name): Handle lib groups.
5834 * readsyms.h (Read_symbols): Add an archive member pointer.
5835 (Read_symbols::do_whole_lib_group): New.
5836 (Read_symbols::do_lib_group): New.
5837 (Read_symbols::member_): New.
5838 * script.cc (read_input_script): Update call to queue_soon.
5839
d099120c
DK
58402010-03-19 Doug Kwan <dougkwan@google.com>
5841
5842 * arm.cc (Stub_table::Stub_table): Initialize new data members
5843 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5844 (Stub_table::add_reloc_stub): Assign stub offset and update
5845 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5846 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5847 New data members.
2e702c99 5848 (Stub_table::update_data_size_and_addralign): Use
d099120c
DK
5849 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5850 instead of going over all reloc stubs.
2e702c99 5851 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
d099120c
DK
5852 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5853 Stringpool_template::offset_ to size of Stringpool_char.
2e702c99 5854 (Stringpool_template::new_key_offset): Remove code to initialize
d099120c
DK
5855 Stringpool_template::offset_.
5856 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5857 Stringpool_template::offset_ to zero.
5858
1aa37384
DK
58592010-03-15 Doug Kwan <dougkwan@google.com>
5860
5861 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5862 offset_.
5863 (Stringpool_template::new_key_offset): New method.
5864 (Stringpool_template::add_string): Assign offsets when adding new
5865 strings.
5866 (Stringpool_template::set_string_offsets): Do not set string offsets
5867 when not optimizing.
5868 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5869 member size_.
2e702c99
RM
5870 (Chunked_vector::clear): Clear size_.
5871 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5872 (Chunked_vector::size): Return size_.
5873 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 5874 (Chunked_vector::size_): New data member.
1aa37384
DK
5875 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5876 (Stringpool_template::new_key_offset): New method declaration.
5877 (Stringpool_template::offset_): New data member.
5878
b672b057
RÁE
58792010-03-15 Rafael Espindola <espindola@google.com>
5880
5881 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5882 Add_symbols' constructor.
5883 * readsyms.h (Add_symbols): Remove the input_group member.
5884
b6848d3c
ILT
58852010-03-10 Ian Lance Taylor <iant@google.com>
5886
5887 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5888 target to ask whether a reference to a symbol requires a stack
5889 split.
5890 * target.h (Target::is_call_to_non_split): New function.
5891 (Target::do_is_call_to_non_split): Declare virtual function.
5892 * target.cc: Include "symtab.h".
5893 (Target::do_is_call_to_non_split): New function.
5894 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5895
a2a5469e
CC
58962010-03-10 Cary Coutant <ccoutant@google.com>
5897
5898 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5899 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5900 (File_read::open[2]): Add whole_file_view_ to list of views.
5901 (File_read::make_view): Remove test of whole_file_view_.
5902 (File_read::find_or_make_view): Create whole_file_view_ if
5903 necessary.
5904 (File_read::clear_views): Replace bool parameter with enum;
5905 adjust all callers. Don't delete views with permanent data;
5906 do delete cached views and views from archives if
5907 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5908 if clearing the corresponding view.
5909 * fileread.h (File_read::Clear_views_mode): New enum.
5910 (File_read::View::is_permanent_view): New method.
5911 (File_read::clear_views): Replace bool parameter
5912 with enum; adjust all callers.
5913 * options.h (General_options): Change keep_files_mapped option;
5914 add map_whole_files.
5915 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5916 releasing the file.
5917 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5918 the file.
5919
8861f32b
DM
59202010-03-10 David S. Miller <davem@davemloft.net>
5921
5922 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5923
d62d0f5f
ST
59242010-03-09 Sriraman Tallam <tmsriram@google.com>
5925
5926 * icf.cc (get_section_contents): Add '@' marker after processing the
5927 merge reloc.
5928
9177756d
DK
59292010-03-08 Doug Kwan <dougkwan@google.com>
5930
5931 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5932 due to a conversion warning.
5933 (Arm_relobj::update_output_local_symbol_count): Check for local
5934 symbol with unset output index.
5935
9e9e071b
ILT
59362010-03-05 Ian Lance Taylor <iant@google.com>
5937
5938 * options.h (class General_options): Add --spare-dynamic-tags.
5939 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5940 --spare-dynamic-tags.
5941
a81ee015
ILT
59422010-03-05 Ian Lance Taylor <iant@google.com>
5943
5944 * incremental.cc: Include "libiberty.h".
5945
44ec90b9
RO
59462010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5947
5948 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5949 function, is_info_ member.
5950 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5951 (Versions::Versions): Update caller.
5952 (Versions::define_base_version): Likewise.
5953 (Versions::add_def): Likewise.
5954
0897ed3b
ST
59552010-03-03 Sriraman Tallam <tmsriram@google.com>
5956
5957 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5958 (Scan::possible_function_pointer_reloc): New function.
5959 (Scan::local_reloc_may_be_function_pointer): Change to call
5960 possible_function_pointer_reloc.
5961 (Scan::global_reloc_may_be_function_pointer): Ditto.
5962 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5963 relocations in ".data.rel.ro._ZTV" section.
5964 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5965 * testsuite/icf_safe_so_test.cc: Ditto.
5966 * testsuite/icf_safe_test.cc: Ditto.
5967 * testsuite/icf_safe_test.sh: Ditto.
5968
d3bbad62
ILT
59692010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5970 Ian Lance Taylor <iant@google.com>
5971
5972 * target-reloc.h (relocate_section): Check the symbol table index
5973 for -1U before setting the local symbol index.
5974 (scan_relocatable_relocs): If copying the relocation, record that
5975 the local symbol is required.
5976 * object.h (Symbol_value::is_output_symtab_index_set): New
5977 function.
5978 (Symbol_value::may_be_discarded_from_output_symtab): New
5979 function.
5980 (Symbol_value::has_output_symtab_entry): New function.
5981 (Symbol_value::needs_output_symtab_entry): Remove.
5982 (Symbol_value::output_symtab_index): Make sure the symbol index is
5983 set.
5984 (Symbol_value::set_output_symtab_index): Make sure the symbol
5985 index is not set. Make sure the new index is valid.
5986 (Symbol_value::set_must_have_output_symtab_entry): New function.
5987 (Symbol_value::has_output_dynsym_entry): New function.
5988 (Symbol_value::set_output_dynsym_index): Make sure the new index
5989 is valid.
5990 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5991 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5992 local symbol if permitted.
5993 (Sized_relobj::do_finalize_local_symbols): Call
5994 is_output_symtab_index_set rather than needs_output_symtab_entry.
5995 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5996 rather than needs_output_symtab_entry. Call
5997 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5998 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5999 is_output_symtab_index_set rather than needs_output_symtab_entry.
6000 * testsuite/discard_locals_relocatable_test.c: New file.
6001 * testsuite/discard_locals_test.sh: Test -r.
6002 * testsuite/Makefile.am (check_DATA): Add
6003 discard_locals_relocatable_test1.syms,
6004 discard_local_relocatable_test2.syms.
6005 (MOSTLYCLEANFILES): Likewise. Also add
6006 discard_locals_relocatable_test1.lout and
6007 discard_locals_relocatable_test2.out.
6008 (discard_locals_relocatable_test1.syms): New target.
6009 (discard_locals_relocatable_test.o): New target.
6010 (discard_locals_relocatable_test1.out): New target.
6011 (discard_locals_relocatable_test2.syms): New target.
6012 (discard_locals_relocatable_test2.out): New target.
6013 (various): Add missing ../ld-new dependencies.
6014 * testsuite/Makefile.in: Rebuild.
6015
7e8ccf26
NC
60162010-03-03 Nick Clifton <nickc@redhat.com>
6017
6018 * po/fi.po: New Finnish translation.
6019
2a0ff005
DK
60202010-03-01 Doug Kwan <dougkwan@google.com>
6021
6022 * layout.cc (Layout::Layout): Force section types of .init_array*,
6023 .preinit_array* and .fini_array* sections.
6024 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6025 Fix check of return value of std::string::find.().
6026 (Output_section::Input_section_sort_compare::operator()): Remove
6027 comment about .init_array.
6028 (Output_section::Input_section_sort_init_fini_compare::operator()):
6029 New method.
6030 (Output_section::sort_attached_input_sections): Handle .init_array
6031 and .fini_array specially.
6032 * output.h (Output_section::Inut_section_sort_compare): Update
6033 comment.
6034 (Output_section::Input_section_sort_init_fini_compare): New struct.
6035
c3e4ae29
DK
60362010-02-26 Doug Kwan <dougkwan@google.com>
6037
6038 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6039 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6040 * testsuite/debug_msg.sh: Avoid matching source line number for
6041 use of global variable undef_int.
6042
2fd9ae7a
DK
60432010-02-26 Doug Kwan <dougkwan@google.com>
6044
6045 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6046 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6047 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6048 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6049 * options.cc (General_options::General_options): Initialize member
6050 fix_v4bx_.
6051 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6052 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6053 and rm_no_fix_v4bx.stdout
6054 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6055 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6056 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6057 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6058 and arm_no_fix_v4bx.
6059 * Makefile.in: Regenerate.
6060 * testsuite/arm_fix_v4bx.s: New file.
6061 * testsuite/arm_fix_v4bx.sh: Ditto.
6062
67ec7d0b
DK
60632010-02-24 Doug Kwan <dougkwan@google.com>
6064
6065 * arm.cc (Target_arm::got_section): Make the .got section the first
6066 non RELRO section in the data segment.
6067 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6068 suffixes of section names.
6069
10165461
DK
60702010-02-24 Doug Kwan <dougkwan@google.com>
6071
6072 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6073 flags and attributes merging if an input file is a binary file.
6074 * fileread.cc (Input_file::open): Record format of original file.
6075 * fileread.h (Input_file::Format): New enum type.
2e702c99 6076 (Input_file::Input_file): Initialize data member format_.
10165461
DK
6077 (Input_file::format): New method definition.
6078 (Input_file::format_):: New data member.
6079
4a54abbb
DK
60802010-02-24 Doug Kwan <dougkwan@google.com>
6081
6082 * arm.cc (Arm_output_data_got): New class.
6083 (ARM_TCB_SIZE): New constant
6084 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6085 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6086 If user uses a script with a SECTIONS clause, issue only a warning
6087 for a misplaced EXIDX input section. Otherwise, issue an error.
2e702c99 6088 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4a54abbb
DK
6089 garbage collection.
6090 (Target_arm::got_mode_index_entry): Handle static linking.
6091 (Target_arm::Scan::local): Ditto.
6092 (Target_arm::Scan::global): Ditto.
6093 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6094 all incorrectly implemented relocations.
e1df38aa 6095 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
6096 Arm_output_section::fix_exidx_coverage.
6097 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6098 from ".ARM.exidx." and ".ARM.extab.".
6099
ca419a6f
ILT
61002010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6101
6102 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6103 section if it does not already exist.
6104 * attributes.cc (Attributes_section_data::Attributes_section_data):
6105 Don't crash if size is zero.
6106
135b9c78
ILT
61072010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6108 Ian Lance Taylor <iant@google.com>
6109
6110 * gold.cc (queue_middle_tasks): If no input files were opened,
6111 exit.
6112 * workqueue.h (Task_function::Task_function): Assert that there is
6113 a blocker.
6114
bb0bfe4f
DK
61152010-02-22 Doug Kwan <dougkwan@google.com>
6116
6117 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6118 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6119 types to avoid warnings due to different uint64_t implementations
6120 on different hosts.
6121
2a2b6d42
DK
61222010-02-21 Doug Kwan <dougkwan@google.com>
6123
6124 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6125 handling of the maximum backward branch offset.
2e702c99 6126 (Arm_relocate_functions::thumb_branch_common): Ditto.
2a2b6d42
DK
6127 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6128 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 6129 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
6130 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6131 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6132 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6133 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6134 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6135 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6136 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6137 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6138 thumb2_bl_out_of_range.o): New rules.
6139 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6140 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6141 thumb2_bl_out_of_range
6142 * testsuite/Makefile.in: Regenerate.
6143 * testsuite/arm_bl_in_range.s: New file.
6144 * testsuite/arm_bl_out_of_range.s: Ditto.
6145 * testsuite/arm_branch_in_range.sh: Ditto.
6146 * testsuite/arm_branch_range.t: Ditto.
6147 * testsuite/thumb2_branch_range.t: Ditto.
6148 * testsuite/thumb_bl_in_range.s: Ditto.
6149 * testsuite/thumb_bl_out_of_range.s: Ditto.
6150 * testsuite/thumb_branch_range.t: Ditto.
6151
b487ad64
ST
61522010-02-20 Sriraman Tallam <tmsriram@google.com>
6153
6154 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6155 Add reloc offset information.
6156 * icf.cc (get_section_contents): Change iterators to point to the new
6157 vectors. Add reloc offset information to the contents.
6158 * icf.h (Icf::Sections_reachable_info): New typedef.
6159 (Icf::Sections_reachable_list): New typedef.
6160 (Icf::Offset_info): New typedef.
6161 (Icf::Reloc_info): New struct typedef.
6162 (Icf::Reloc_info_list): New typedef.
6163 (Icf::symbol_reloc_list): Delete method.
6164 (Icf::addend_reloc_list): Delete method.
6165 (Icf::section_reloc_list): Delete method.
6166 (Icf::reloc_info_list): New method.
6167 (Icf::reloc_info_list_): New member.
6168
f96accdf
DK
61692010-02-19 Doug Kwan <dougkwan@google.com>
6170
6171 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6172 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6173 * arm.cc (Arm_relocation_functions): New forward declaration.
6174 (Target_arm::Target_arm): Initialize new data members
6175 got_mod_index_offset_ and tls_base_symbol_defined_.
6176 (Target_arm::Relocate::relocate_tls): New method.
6177 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6178 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6179 New methods.
2e702c99 6180 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
f96accdf
DK
6181 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6182 (Target_arm::got_mod_index_offset_,
6183 Target_arm::tls_base_symbol_defined_): New data members.
6184 (Target_arm::Scan::local, Target::Scan::global,
6185 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6186 relocations.
6187
c8761b9a
DK
61882010-02-18 Doug Kwan <dougkwan@google.com>
6189
6190 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6191 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6192 text section as a parameter becuase some broken tools may not set
6193 the link in section header.
6194 (Target_arm::has_got_section): New method.
6195 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6196 without any mapping symbol as data only. Remove warning.
6197 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6198 link in its section header, try to discover the link by inspecting the
6199 REL31 relocation at the beginning of the section.
6200 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6201 in error message.
6202 (Target_arm::Scan::global): Treat any reference to the symbol
6203 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6204
21bb3914
ST
62052010-02-12 Sriraman Tallam <tmsriram@google.com>
6206
6207 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6208 (Scan::global_reloc_may_be_function_pointer): New function.
6209 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6210 (Scan::global_reloc_may_be_function_pointer): New function.
6211 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6212 (Scan::global_reloc_may_be_function_pointer): New function.
6213 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6214 (Scan::global_reloc_may_be_function_pointer): New function.
6215 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6216 (Scan::global_reloc_may_be_function_pointer): New function.
6217 (Scan::possible_function_pointer_reloc): New function.
6218 (Target_x86_64::can_check_for_function_pointers): New function.
6219 * gc.h (gc_process_relocs): Scan relocation types to determine if
6220 function pointers were taken for targets that support it.
6221 * icf.cc (Icf::find_identical_sections): Include functions for
6222 folding in safe ICF whose pointer is not taken.
6223 * icf.h (Secn_fptr_taken_set): New typedef.
6224 (fptr_section_id_): New member.
6225 (section_has_function_pointers): New function.
6226 (set_section_has_function_pointers): New function.
6227 (check_section_for_function_pointers): New function.
6228 * options.h: Fix comment for safe ICF option.
6229 * target.h (can_check_for_function_pointers): New function.
6230 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6231 Modify icf_safe_test for X86-64.
6232 * testsuite/Makefile.in: Regenerate.
6233 * testsuite/icf_safe_so_test.cc: New file.
6234 * testsuite/icf_safe_so_test.sh: New file.
6235 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6236 (main): Change to take pointer to function kept_func_3.
6237 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6238 folding is done correctly for X86-64.
6239
0da6fa6c
DM
62402010-02-12 David S. Miller <davem@davemloft.net>
6241
6242 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6243 is_symbolless parameter.
6244 (Output_reloc<SHT_REL>::is_symbolless): New.
6245 (Output_reloc<SHT_REL>::is_symbolless_): New.
6246 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6247 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6248 (Output_reloc<SHT_RELA>::is_symbolless): New.
6249 (Output_data_reloc::add_global): Handle is_symbolless.
6250 (Output_data_reloc::add_global_relative): Likewise.
6251 (Output_data_reloc::add_local): Likewise.
6252 (Output_data_reloc::add_local_relative): Likewise.
6253 (Output_data_reloc::add_symbolless_global_addend): New.
6254 (Output_data_reloc::add_symbolless_local_addend): New.
6255 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6256 is_symbolless.
6257 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6258 instead of ->is_relative_
6259 (Output_reloc::write): Likewise.
6260 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6261 (Output_reloc::write_rel): Simplify.
6262
6263 * sparc.cc (Target_sparc::Scan::local): Use
6264 ->add_symbolless_local_addend as needed.
6265 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6266 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6267 based upon relocation offset.
6268
e4782e83
DK
62692010-02-11 Doug Kwan <dougkwan@google.com>
6270
6271 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6272 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6273 beginning of function.
6274 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6275 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6276 parameter is_32bit in calls to should_apply_static_reloc.
6277 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6278 (check_DATA): Add arm_abs_global.stdout.
6279 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6280 arm_abs_global.stdout): New rules.
6281 (MOSTLLYCLEANFILES): Add arm_abs_global
6282 * Makefile.in: Regenerate.
6283 * testsuite/arm_abs_global.s: New file.
6284 * testsuite/arm_abs_global.sh: Ditto.
6285 * testsuite/arm_abs_lib.s: Ditto.
6286
93ceb764
ILT
62872010-02-11 Ian Lance Taylor <iant@google.com>
6288
6289 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6290 Read_relocs task.
6291 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6292 Allocate_commons_task first.
6293 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6294 task, rather than symtab_lock_.
6295 (Gc_process_relocs::~Gc_process_relocs): New function.
6296 (Gc_process_relocs::is_runnable): Check this_blocker_.
6297 (Gc_process_relocs::locks): Use next_blocker_ rather than
6298 blocker_.
6299 (Scan_relocs::~Scan_relocs): New function.
6300 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6301 symtab_lock_.
6302 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6303 next_blocker_.
6304 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6305 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6306 constructor accordingly.
6307 (class Gc_process_relocs): Likewise.
6308 (class Scan_relocs): Likewise.
6309 * common.h (class Allocate_commons_task): Remove symtab_lock_
6310 field, and corresponding constructor parameter.
6311 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6312 symtab_lock_.
6313 (Allocate_commons_task::locks): Likewise.
6314
114dfbe1
ILT
63152010-02-11 Ian Lance Taylor <iant@google.com>
6316
6317 * gold-threads.h (class Once): Define.
6318 (class Initialize_lock): Rewrite as child of Once.
6319 * gold-threads.cc (class Once_initialize): Define.
6320 (once_pointer_control): New static variable.
6321 (once_pointer, once_arg): New static variables.
6322 (c_run_once): New static function.
6323 (Once::Once, Once::run_once, Once::internal_run): New functions.
6324 (class Initialize_lock_once): Remove.
6325 (initialize_lock_control): Remove.
6326 (initialize_lock_pointer): Remove.
6327 (initialize_lock_once): Remove.
6328 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6329 (Initialize_lock::initialize): Rewrite.
6330 (Initialize_lock::do_run_once): New function.
6331 * archive.cc (Archive::interpret_header): Only clear name if it is
6332 not already empty.
6333 * fileread.cc: Include "gold-threads.h"
6334 (file_counts_lock): New static variable.
6335 (file_counts_initialize_lock): Likewise.
6336 (File_read::release): Only increment counts when using --stats.
6337 Use a lock around the increment.
6338 * parameters.cc (class Set_parameters_target_once): Define.
6339 (set_parameters_target_once): New static variable.
6340 (Parameters::Parameters): Move here from parameters.h.
6341 (Parameters::set_target): Rewrite.
6342 (Parameters::set_target_once): New function.
6343 (Parameters::clear_target): Move here and rewrite.
6344 * parameters.h (class Parameters): Update declarations. Add
6345 set_parameters_target_once_ field.
6346 (Parameters::Parameters): Move to parameters.cc.
6347 (Parameters::clear_target): Likewise.
6348 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6349 task.
6350 (Start_group::~Start_group): New function.
6351 (Start_group::is_runnable): New function.
6352 (Start_group::locks, Start_group::run): New functions.
6353 (Finish_group::run): Change saw_undefined to size_t.
6354 * readsyms.h (class Start_group): Define.
6355 (class Finish_group): Change saw_undefined_ field to size_t.
6356 (Finish_group::Finish_group): Remove saw_undefined and
6357 this_blocker parameters. Change all callers.
6358 (Finish_group::set_saw_undefined): New function.
6359 (Finish_group::set_blocker): New function.
6360 * symtab.h (class Symbol_table): Change saw_undefined to return
6361 size_t. Change saw_undefined_ field to size_t.
6362 * target-select.cc (Set_target_once::do_run_once): New function.
6363 (Target_selector::Target_selector): Initialize set_target_once_
6364 field. Don't initialize lock_ and initialize_lock_ fields.
6365 (Target_selector::instantiate_target): Rewrite.
6366 (Target_selector::set_target): New function.
6367 * target-select.h (class Set_target_once): Define.
6368 (class Target_selector): Update declarations. Make
6369 Set_target_once a friend. Remove lock_ and initialize_lock_
6370 fields. Add set_target_once_ field.
6371
fa17a3f4
ILT
63722010-02-10 Ian Lance Taylor <iant@google.com>
6373
6374 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6375 queueing any tasks.
6376 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6377 (queue_middle_tasks): Add all blockers before queueing any tasks.
6378 (queue_final_tasks): Likewise.
6379 * token.h (Task_token::add_blockers): New function.
6380 * object.h (Input_objects::number_of_relobjs): New function.
6381
c7177d31
ILT
63822010-02-10 Ian Lance Taylor <iant@google.com>
6383
5de0e392
ILT
6384 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6385 shared, not if not position independent.
6386 * x86_64.cc (Relocate::relocate_tls): Likewise.
6387 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6388 (tls_pie_pic_test): New target.
6389 * testsuite/Makefile.in: Rebuild.
6390
c7177d31
ILT
6391 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6392 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6393 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6394 * testsuite/Makefile.in: Rebuild.
6395
684b268a
DM
63962010-02-09 David S. Miller <davem@davemloft.net>
6397
6398 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6399 R_SPARC_RELATIVE using ->add_local_relative().
6400 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6401
612a8d3d
DM
6402 * output.h (Output_data_dynamic::add_section_size): New method
6403 that takes two Output_data objects.
6404 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6405 entry param. Handle it in initializers.
6406 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6407 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6408 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6409 arg.
6410 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6411 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6412 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6413 for dynrel_includes_plt.
6414 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6415 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6416 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6417 before .rela.plt
6418 (Target_sparc::do_finalize_sections): Update to pass true for
6419 dynrel_includes_plt.
6420 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6421 output before .rela.plt
6422 (Target_powerpc::do_finalize_sections): Update to pass true for
6423 dynrel_includes_plt when 32-bit.
6424
cb1be87e
DK
64252010-02-08 Doug Kwan <dougkwan@google.com>
6426
6427 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6428 method.
6429 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6430 Arm_relobj::scan_section_for_cortex_a8_stubs,
6431 Arm_relobj::do_relocation_section): Instead of calling
6432 Output_section::output_address, use faster
6433 Arm_relobj::simple_input_section_output_address.
6434
705b5121
DM
64352010-02-08 David S. Miller <davem@davemloft.net>
6436
6437 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6438 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6439 relocation helper function.
6440
024c4466
DM
6441 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6442 just like R_SPARC_GOT{10,13,22}.
6443 (Target_sparc::Scan::local): Likewise.
6444 (Target_sparc::Relocate:relocate): Likewise.
6445
9109c078
ILT
64462010-02-06 Ian Lance Taylor <iant@google.com>
6447
6448 * configure.ac: Rewrite targetobjs duplicate removal code to use
6449 only shell constructs.
6450 * configure: Rebuild.
6451
cf846138
DK
64522010-02-05 Doug Kwan <dougkwan@google.com>
6453
6454 PR 11247
6455 * arm.cc (Arm_relobj::section_is_scannable): New method.
6456 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6457 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6458
6cfaf60b
DK
64592010-02-04 Doug Kwan <dougkwan@google.com>
6460
6461 PR 11247
6462 * arm-reloc-property.cc (cstdio): Include.
6463 * configure.ac (targetobjs): Remove duplicates.
6464 * configure: Regenerate.
6465 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6466 big and little endian version for a given address size.
6467
5c57f1be
DK
64682010-02-03 Doug Kwan <dougkwan@google.com>
6469
6470 * arm-reloc-property.cc
6471 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6472 definition.
6473 * arm-reloc-property.h
6474 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6475 New method definition.
6476 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6477 declaration.
6478 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6479 overflow to N.
6480 (GOT_PREL): Change implemented to Y.
6481 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6482 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6483 (Arm_relocate_functions::movw_abs_nc): Remove method.
6484 (Arm_relocate_functions::movt_abs): Ditto.
6485 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6486 (Arm_relocate_functions::thm_movt_abs): Ditto.
6487 (Arm_relocate_functions::movw_rel_nc): Ditto.
6488 (Arm_relocate_functions::movw_rel): Ditto.
6489 (Arm_relocate_functions::movt_rel): Ditto.
6490 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6491 (Arm_relocate_functions:thm_movw_rel): Ditto.
6492 (Arm_relocate_functions:thm_movt_rel): Ditto.
6493 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6494 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6495 New method definitions.
6496 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6497 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6498 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6499 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6500 (Target_arm::Relocate::relocate): Check for non-static or
6501 unimplemented relocation code and exit early. Change calls to
6502 Target_arm::reloc_uses_thumb_bit and
6503 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6504 instead. Refactor code to handle similar relocations to increase
6505 code sharing. Remove check for unsupported relocation code in switch
6506 statement.
6507 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6508 relocation property table to find out size. Change error message to
6509 print out the name of a relocation code instead of the numeric value.
6510 (Target_arm::scan_reloc_for_stub): Use relocation property table
6511 instead of calling Target_arm::reloc_uses_thumb_bit().
6512
218c5831
DK
65132010-02-02 Doug Kwan <dougkwan@google.com>
6514
6515 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6516 types of relaxed input section.
6517
0d31c79d
DK
65182010-02-02 Doug Kwan <dougkwan@google.com>
6519
6520 * Makefile.am (HFILES): Add arm-reloc-property.h.
6521 (DEFFILES): New.
2e702c99
RM
6522 (TARGETSOURCES): Add arm-reloc-property.cc
6523 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
0d31c79d
DK
6524 (libgold_a_SOURCES): $(DEFFILES)
6525 * Makefile.in: Regenerate.
6526 * arm-reloc-property.cc: New file.
6527 * arm-reloc-property.h: New file.
6528 * arm-reloc.def: New file.
6529 * arm.cc: Update comments.
6530 (arm-reloc-property.h): New included header.
6531 (arm_reloc_property_table): New global variable.
6532 (Target_arm::do_select_as_default_target): New method definition.
6533 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6534 arm-reloc-property to targ_extra_obj.
6535 * parameters.cc (set_parameters_target): Call
6536 Target::select_as_default_target().
6537 * target.h (Target::select_as_default_target): New method definition.
6538 (Target::do_select_as_default_target): Same.
6539
546c7457
DK
65402010-02-01 Doug Kwan <dougkwan@google.com>
6541
6542 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6543 first_output_text_section_.
6544 (Arm_exidx_fixup::first_output_text_section): New method definition.
6545 (Arm_exidx_fixup::first_output_text_section_): New data member.
6546 (Arm_exidx_fixup::process_exidx_section): Record the first text
6547 output section seen.
6548 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6549 and entsize in output section header.
6550
11b861d5
DK
65512010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6552
6553 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6554 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6555 (Arm_relocate_functions::thm_alu11): New Method.
6556 (Arm_relocate_functions::thm_pc8): New Method.
6557 (Arm_relocate_functions::thm_pc12): New Method.
6558 (Target_arm::Scan::local): Handle the relocations.
6559 (Target_arm::Scan::global): Likewise.
6560 (Target_arm::Relocate::relocate): Likewise.
6561 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6562
c9a2c125
DK
65632010-01-29 Doug Kwan <dougkwan@google.com>
6564
6565 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6566 of relocation types as ld.
6567
1521477a
DK
65682010-01-29 Doug Kwan <dougkwan@google.com>
6569
6570 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6571 to public.
6572 (Arm_relocate_functions::thumb_branch_common): Ditto.
6573 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6574 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6575 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6576 Arm_relocate_functions::jump24): Remove.
6577 (Target_arm::Relocate::relocate): Adjust code to call
6578 Arm_relocation_functions::arm_branch_common and
6579 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 6580 wrappers. Merge switch-cases together to reduce source code size.
1521477a 6581
e7eca48c
DK
65822010-01-29 Doug Kwan <dougkwan@google.com>
6583
6584 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6585 output_local_symbol_count_needs_update_.
6586 (Arm_relobj::output_local_symbol_count_needs_update,
6587 Arm_relobj::set_output_local_symbol_count_needs_update,
6588 Arm_relobj::update_output_local_symbol_count): New methods.
6589 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6590 member.
6591 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6592 of pointed function as in a R_ARM_PREL31 relocation.
6593 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6594 for output local symbol count updating.
6595 (Target_arm::do_relax): Update output local symbol counts in objects
6596 if necessary.
6597 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6598
02961d7e
ILT
65992010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6600
6601 * arm.cc: Added support for the ARM relocations:
6602 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6603 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6604 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6605 movw_prel_nc).
6606 (Arm_relocate_functions::movw_rel): New method.
6607 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6608 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6609 thm_movw_prel_nc).
6610 (Arm_relocate_functions::thm_movw_rel): New method.
6611 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6612 thm_movt_prel).
6613 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6614 relocations.
6615 (Target_arm::Scan::global): Likewise.
6616 (Target_arm::Relocate::relocate): Likewise.
6617 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6618 Likewise.
6619
b10d2873
ILT
66202010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6621
6622 * arm.cc: Added support for ARM group relocations.
6623 (Target_arm::reloc_needs_sym_origin): New method.
6624 (Arm_relocate_functions::calc_grp_kn): New method.
6625 (Arm_relocate_functions::calc_grp_residual): New method.
6626 (Arm_relocate_functions::calc_grp_gn): New method.
6627 (Arm_relocate_functions::arm_grp_alu): New Method.
6628 (Arm_relocate_functions::arm_grp_ldr): New Method.
6629 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6630 (Arm_relocate_functions::arm_grp_ldc): New Method.
6631 (Target_arm::Scan::local): Handle the ARM group relocations.
6632 (Target_arm::Scan::global): Likewise.
6633 (Target_arm::Relocate::relocate): Likewise.
6634 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6635 Likewise.
6636
2b328d4e
DK
66372010-01-26 Doug Kwan <dougkwan@google.com>
6638
6639 * arm.cc (set): Include.
6640 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6641 pointer type.
2e702c99 6642 (Arm_output_section::Text_section_list): New type.
2b328d4e
DK
6643 (Arm_output_section::append_text_sections_to_list): New method.
6644 (Arm_output_section::fix_exidx_coverage): Ditto.
6645 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2e702c99 6646 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2b328d4e
DK
6647 Relobj::set_section_offset() instead of
6648 Sized_relobj::invalidate_section_offset().
2e702c99 6649 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2b328d4e
DK
6650 parameter for section headers. Ignore relocation sections for
6651 unallocated sections and EXIDX sections.
6652 (Target_arm::fix_exidx_coverage): New method.
6653 (Target_arm::output_section_address_less_than): New type.
6654 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6655 linked text section instead of the EXIDX section.
6656 (Arm_output_section::create_stub_group): Add an assertion to check
6657 that this is not an EXIDX output section.
6658 (Arm_output_section::append_text_sections_to_list): New method.
6659 (Arm_output_section::fix_exidx_coverage): Ditto.
6660 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2e702c99 6661 Arm_relobj::section_needs_reloc_stub_scanning.
2b328d4e
DK
6662 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6663 first pass.
6664 (Target_arm::fix_exidx_coverage): New method.
6665 * object.h (Relobj::set_output_section): New method.
6666 (Sized_relobj::invalidate_section_offset): Remove method.
6667 (Sized_relobj::do_invalidate_section_offset): Remove method.
6668 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6669
c7f3c371
DK
66702010-01-25 Doug Kwan <dougkwan@google.com>
6671
6672 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6673 Fix warning due to signed and unsigned comparison on a 32-bit host.
6674
8923b24c
DK
66752010-01-22 Doug Kwan <dougkwan@google.com>
6676
6677 * arm.cc (Target_arm::do_relax): Record an output section for section
6678 offset adjustment it contains any stub table that has changed.
6679 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6680 offsets in an output section if necessary.
6681 * output.cc (Output_section::Output_section): Initialize
6682 section_offsets_need_adjustments_.
6683 (Output_section::add_input_section_for_script): Renamed to
6684 Output_section::add_simple_input_section.
6685 (Output_section::save_states): Add a comment.
6686 (Output_section::discard_states): New method defintion.
6687 (Output_section::adjust_section_offsets): Same.
6688 * output.h (Output_section::add_input_section_for_script): Renamed to
6689 Output_section::add_simple_input_section.
6690 (Output_section::discard_states): New method declaration.
6691 (Output_section::adjust_section_offsets): Same.
6692 (Output_section::section_offsets_need_adjustment,
6693 Output_section::set_section_offsets_need_adjustment): New method
6694 definitions.
6695 (Output_section::section_offsets_need_adjustment_): New data member.
6696 * script-sections.cc
6697 (Output_section_element_input::set_section_address): Adjust code for
6698 renaming of Output_section::add_input_section_for_script.
6699 (Orphan_output_section::set_section_address): Same.
6700
9b2fd367
DK
67012010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6702
6703 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6704 Fix_v4bx enum values .
6705 * gold/options.h (General_options): New option definitions.
6706 (General_options::fix_v4bx): New method.
6707 (General_options::Fix_v4bx): New enum.
6708 * gold/options.cc (General_options::parse_fix_v4bx): New method.
6709 (General_options::parse_fix_v4bx_interworking): New method.
6710
80d0d023
DK
67112010-01-22 Doug Kwan <dougkwan@google.com>
6712
6713 * arm.cc (Arm_exidx_fixup): New class.
6714
af2cdeae
DK
67152010-01-21 Doug Kwan <dougkwan@google.com>
6716
6717 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6718 classes.
6719 (Arm_exidx_section_offset_map): New type.
6720
993d07c1
DK
67212010-01-21 Doug Kwan <dougkwan@google.com>
6722
6723 * arm.cc (Arm_exidx_input_section): New class.
6724 (Arm_relobj::exidx_input_section_by_link,
6725 Arm_relobj::exidx_input_section_by_shndx,
6726 Arm_relobj::make_exidx_input_section): New methods.
6727 (read_arm_attributes_section): Remove.
6728 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6729 information about them.
6730 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6731 to here.
6732
5ac169d4
DK
67332010-01-20 Doug Kwan <dougkwan@google.com>
6734
6735 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6736 Input_section_specifier to Section_id.
6737 (Target_arm::new_arm_input_section: Adjust code for change of key
6738 type.
6739 (Target_arm::find_arm_input_section): Ditto.
6740 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6741 (Section_id): Remove.
6742 (Garbage_collection::Section_id_hash): Remove.
6743 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6744 (Section_id): Remove.
6745 (Icf::Section_id_hash): Remove.
6746 * object.h (Section_id, Const_section_id, Section_id_hash,
6747 Const_section_id_hash): New type definitions.
6748 * output.cc (Output_section::add_relaxed_input_section): Change to
6749 use Const_section_id instead of Input_section_specifier as key type.
6750 (Output_section::add_merge_input_section): Ditto.
6751 (Output_section::build_relaxation_map): Change to use Section_id
6752 instead of Input_section_specifier as key type.
2e702c99 6753 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5ac169d4
DK
6754 Ditto.
6755 (Output_section::convert_input_sections_to_relaxed_sections): Change
6756 to use Const_section_id instead of Input_section_specifier as key type.
2e702c99 6757 (Output_section::find_merge_section): Ditto.
5ac169d4
DK
6758 (Output_section::find_relaxed_input_section): Ditto.
6759 * output.h (Input_section_specifier): Remove class.
6760 (Output_section::Output_section_data_by_input_section_map): Change
6761 key type to Const_section_id.
6762 (Output_section::Output_relaxed_input_section_by_input_section_map):
6763 Ditto.
6764 (Output_section::Relaxation_map): Change key type to Section_id.
6765
a2162063
ILT
67662010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6767
6768 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6769 (class Arm_v4bx_stub): New class.
6770 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6771 (Stub_factory::make_arm_v4bx_stub): New method.
6772 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6773 (Stub_table::empty): Handle v4bx stubs.
6774 (Stub_table::add_arm_v4bx_stub): New method.
6775 (Stub_table::find_arm_v4bx_stub): New method.
6776 (Arm_relocate_functions::v4bx): New method.
6777 (Target_arm::fix_v4bx): New method.
6778 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6779 (Stub_table::relocate_stubs): Likewise.
6780 (Stub_table::do_write): Likewise.
6781 (Stub_table::update_data_size_and_addralign): Likewise.
6782 (Stub_table::finalize_stubs): Likewise.
6783 (Target_arm::Scan::local): Likewise.
6784 (Target_arm::Scan::global): Likewise.
6785 (Target_arm::do_finalize_sections): Likewise.
6786 (Target_arm::Relocate::relocate): Likewise.
6787 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6788 Likewise.
6789 (Target_arm::scan_reloc_for_stub): Likewise.
6790 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6791
5696ab0b
ILT
67922010-01-19 Ian Lance Taylor <iant@google.com>
6793
6794 * output.cc (Output_section_headers::do_sized_write): Write large
6795 segment count to sh_info field.
6796 (Output_file_header::do_sized_write): For large segment count,
6797 write PN_XNUM to e_phnum field.
6798
800d0f56
ILT
67992010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6800
6801 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6802 (Arm_relocate_functions::thm_jump8): New function.
6803 (Arm_relocate_functions::thm_jump11): New function.
6804 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6805 R_ARM_THM_JUMP11.
6806 (Target_arm::Scan::global): Likewise.
6807 (Target_arm::Relocate::relocate): Likewise.
6808 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6809 Likewise.
6810
41263c05
DK
68112010-01-14 Doug Kwan <dougkwan@google.com>
6812
6813 * arm.cc (map, utility): Include headers.
6814 (Target_arm::apply_cortex_a8_workaround): New method.
6815 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6816 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6817 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6818 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6819 the --[no-]fix-cortex-a8 command line options.
6820 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6821 (Target_arm::relocate_stub): Use addend in instruction template.
6822 * options.h (DEFINE_bool): Set the user-set flag.
6823 (General_options): Add --[no-]-fix-cortex options.
6824 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 6825 : Update fast look-up map after conversion.
41263c05 6826
459e9b03
ST
68272010-01-14 Sriraman Tallam <tmsriram@google.com>
6828
6829 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6830 in the first pass of do_layout.
6831
b521dfe4
DK
68322010-01-13 Doug Kwan <dougkwan@google.com>
6833
6834 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6835 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6836 apparent compiler problem of not folding static constant integral
6837 data members of elfcpp::Elf_sizes<32>.
6838
44272192
DK
68392010-01-13 Doug Kwan <dougkwan@google.com>
6840
6841 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6842 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6843 Arm_relobj::scan_section_for_cortex_a8_erratum,
6844 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6845 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6846 sections to scan for relocation stubs into a new method
6847 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6848 relocation and Cortex-A8 stub scanning.
6849 (Target_arm::do_relax): Force stubs to be after stubbed sections
6850 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 6851 the beginning of a new relaxation pass. Update a comment.
44272192
DK
6852 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6853
44b71ece
ILT
68542010-01-12 Ian Lance Taylor <iant@google.com>
6855
6856 * target-reloc.h (visibility_error): New inline function.
6857 (relocate_section): Call visibility_error.
6858 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6859 (MOSTLYCLEANFILES): Likewise.
6860 (protected_4_pic.o, protected_3.err): New targets.
6861 * testsuite/protected_4.cc: New file.
6862
a120bc7f
DK
68632010-01-12 Doug Kwan <dougkwan@google.com>
6864
6865 * arm.cc (Cortex_a8_reloc): New class.
6866 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6867 and cortex_a8_relocs_info_.
6868 (Target_arm::fix_cortex_a8): New method definition.
6869 (Target_arm::Cortex_a8_relocs_info): New type.
6870 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6871 New data member declarations.
6872 (Target_arm::scan_reloc_for_stub): Record information about
6873 relocations for THUMB branches that might be exempted from the
6874 Cortex-A8 workaround.
6875 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6876 at the beginning of a relaxation pass.
6877
20138696
DK
68782010-01-12 Doug Kwan <dougkwan@google.com>
6879
6880 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6881 (Arm_relobj::Mapping_symbol_position,
6882 Arm_reloj::Mapping_symbol_position_less,
6883 Arm_relobj::Mapping_symbols_info): New types.
6884 (Target_arm::is_mapping_symbol_name): New method definition.
6885 (Arm_relobj::do_count_local_symbols): Save information about mapping
6886 symbols.
6887
089d69dc
DK
68882010-01-11 Doug Kwan <dougkwan@google.com>
6889
6890 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6891 Arm_relocate_functions::thumb32_branch_upper,
6892 Arm_relocate_functions::thumb32_branch_lower,
6893 Arm_relocate_functions::thumb32_cond_branch_offset,
6894 Arm_relocate_functions::thumb32_cond_branch_upper,
6895 Arm_relocate_functions::thumb32_cond_branch_lower,
6896 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6897 branch offset encoding.
6898 (Arm_relocate_functions::thumb_branch_common): Use new branch
6899 offset encoding methods to avoid code duplication.
6900 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6901 (Stub_addend_reader::operator()): Use new branch encoding method
6902 to avoid code duplication.
6903
99e5bff2
DK
69042010-01-11 Doug Kwan <dougkwan@google.com>
6905
6906 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6907 (Target_arm::do_finalize_sections): Define special EXIDX section
6908 symbols only if referenced.
6909 * gc.h (Garbage_collection::add_reference): New method.
6910 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6911 code duplication.
6912
98e090bd
ILT
69132010-01-11 Ian Lance Taylor <iant@google.com>
6914
d0a91bd8
ILT
6915 * script.cc (Version_script_info::build_expression_list_lookup):
6916 Change complaing about duplicate wildcard match from error to
6917 warning.
6918
98e090bd
ILT
6919 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6920 of 2009-12-30.
6921 (Version_script_info::Version_script_info): Initialize globs_,
6922 default_version_, default_is_global_, and exact_. Don't
6923 initialize globals_ or locals_.
6924 (Version_script_info::build_lookup_tables): Build local symbols
6925 first.
6926 (Version_script_info::unquote): New function.
6927 (Version_script_info::add_exact_match): New function.
6928 (Version_script_info::build_expression_list_lookup): Remove lookup
6929 parameter. Add is_global parameter. Change all callers. Handle
6930 wildcard pattern specially. Unquote pattern. Call
6931 add_exact_match.
6932 (Version_script_info::get_name_to_match): New function.
6933 (Version_script_info::get_symbol_version): New function.
6934 (Version_script_info::get_symbol_version_helper): Remove.
6935 (Version_script_info::check_unmatched_names): Call unquote.
6936 * script.h (class Version_script_info): Change get_symbol_version
6937 to be non-inline and add is_global parameter; change all callers.
6938 Rewrite symbol_is_local. Update declarations. Define struct
6939 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6940 Remove globals_ and locals_ members. Add exact_, globs_,
6941 default_version_, is_global_.
6942 (Version_script_info::Glob): Remove pattern, add expression and
6943 is_global. Update constructor. Change all callers.
6944 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6945 default version.
6946 (Versions::symbol_section_contents): If a symbol is undefined, or
6947 defined in a dynamic object, set the version index to
6948 VER_NDX_LOCAL.
6949 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6950 symbol_is_local.
6951 (Symbol_table::add_from_pluginobj): Likewise.
6952 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6953
d56962d3
DK
69542010-01-11 Doug Kwan <dougkwan@google.com>
6955
6956 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6957 (incremental_dump_LDADD): Add linking option for libintl.
6958 * Makefile.in: Regenerate.
6959
94e6ee91
L
69602010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6961
6962 PR gold/11144
6963 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6964 instead of -Ds.
6965 * testsuite/Makefile.in: Regenerated.
6966
e96c574b
DK
69672010-01-10 Doug Kwan <dougkwan@google.com>
6968
6969 * options.h (DEFINE_var): Use parentheses around argument varname__
6970 in macro body to avoid any unintended subsequent substitutions.
6971
7198066b
ILT
69722010-01-10 Ian Lance Taylor <iant@google.com>
6973
ba4d53bf
ILT
6974 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6975 candidates before doing symbol resolution.
6976
7198066b
ILT
6977 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6978 ODR candidates if only one is weak.
6979
a2beed37
ILT
69802010-01-08 Ian Lance Taylor <iant@google.com>
6981
6982 * script.cc (Version_script_info::build_expression_list_lookup):
6983 Don't warn about ambiguous version, just record the ambiguity.
6984 (Version_script_info::get_symbol_version_helper): Give error if
6985 version is ambiguous.
6986
2fb7225c
DK
69872010-01-08 Doug Kwan <dougkwan@google.com>
6988
6989 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6990 prev_data_size_ and prev_addralign_. Remove initializer for
6991 deleted data member has_been_changed_.
6992 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6993 to determine if the table is empty.
6994 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6995 Remove.
6996 (Stub_table::add_reloc_stub): Define method in class definition
6997 instead of just declaring it there.
6998 (Stub_table::add_cortex_a8_stub): New method definition.
6999 (Stub_table::update_data_size_and_addralign): Ditto.
7000 (Stub_table::finalize_stubs): Ditto.
7001 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7002 (Stub_table::do_addralign_): Return address alignment in the
7003 (Stub_table::do_reset_address_and_file_offset): Define method in
7004 class definition instead of declaring it there. Set current data
7005 size to be the data size of the previous pass.
7006 (Stub_table::set_final_data_size): Use current data size as the
7007 final data size.
7008 (Stub_table::relocate_stub): Change parameter type of stub from
7009 Reloc_stub pointer to Stub pointer.
7010 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7011 (Stub_table::Cortex_a8_stub_list): New typedef.
7012 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7013 Stub_table::prev_addralign_): New data member.
7014 (Arm_relobj::Arm_relobj): Initialize data member
7015 section_has_cortex_a8_workaround_.
7016 (Arm_relobj::section_has_cortex_a8_workaround,
7017 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7018 definitions.
7019 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7020 declarations.
7021 (Target_arm::relocate_stub): Change parameter type of stub from
7022 Reloc_stub pointer to Stub pointer.
7023 (Insn_template::size, Insn_template::alignment): Handle
7024 THUMB16_SPECIAL_TYPE.
7025 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7026 Stub_table::update_data_size_and_addralign,
7027 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7028 definitions.
2e702c99 7029 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
2fb7225c
DK
7030 (Stub_table::do_write): Ditto.
7031 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7032
880cd20d
ILT
70332010-01-08 Ian Lance Taylor <iant@google.com>
7034
7035 PR 11108
7036 * symtab.h (class Symbol): Remove fields is_target_special_ and
7037 has_plt_offset_. Add field is_defined_in_discarded_section_.
7038 (Symbol::is_defined_in_discarded_section): New function.
7039 (Symbol::set_is_defined_in_discarded_section): New function.
7040 (Symbol::has_plt_offset): Rewrite.
7041 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7042 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7043 Don't initialize is_target_special_ or has_plt_offset_.
7044 Initialize is_defined_in_discarded_section_.
7045 (Symbol_table::add_from_relobj): If appropriate, set
7046 is_defined_in_discarded_section.
7047 * resolve.cc (Symbol::override_base_with_special): Don't test
7048 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7049 * target-reloc.h (relocate_section): Do special handling for
7050 symbols defined in discarded sections for global symbols as well
7051 as local symbols.
7052
2703e3eb
ILT
70532010-01-08 Ian Lance Taylor <iant@google.com>
7054
7055 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7056 the SHT_SYMTAB case.
7057
339d40a3
ILT
70582010-01-08 Ian Lance Taylor <iant@google.com>
7059
7060 * object.cc (Sized_relobj::do_layout): Don't get confused if
7061 layout_eh_frame returns NULL.
7062
abecea76
ILT
70632010-01-08 Ian Lance Taylor <iant@google.com>
7064
7065 PR 11084
7066 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7067 dynamic symbol table, use the normal symbol table.
7068 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7069 symbol table.
7070
6b7dd3f3
ILT
70712010-01-08 Ian Lance Taylor <iant@google.com>
7072
7073 PR 11072
7074 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7075 sections.
7076
36c50e63
L
70772010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7078
7079 * version.cc (print_version): Change to "Copyright 2010".
7080
e291e7b9
ILT
70812010-01-08 Ian Lance Taylor <iant@google.com>
7082
7083 PR 10287
7084 PR 11063
7085 * i386.cc (class Target_i386): Change return type of plt_section
7086 to be non-const.
7087 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7088 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7089 tls_desc_rel_ field.
7090 (Output_data_plt_i386::rel_tls_desc): New function.
7091 (Target_i386::rel_tls_desc_section): New function.
7092 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7093 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7094 R_386_TLS_DESC reloc in rel_tls_desc_section.
7095 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7096 Define struct Tlsdesc_info.
7097 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7098 (Target_x86_64::do_reloc_symbol_index): New function.
7099 (Target_x86_64::add_tlsdesc_info): New function.
7100 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7101 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7102 tlsdesc_rel_ field.
7103 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7104 all callers.
7105 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7106 (Target_x86_64::rela_tlsdesc_section): New function.
7107 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7108 handling.
7109 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7110 (Target_x86_64::do_reloc_addend): New function.
7111 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7112 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7113 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7114 (Output_reloc::type): New function.
7115 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7116 (Output_reloc::is_target_specific): New function.
7117 (Output_reloc::target_arg): New function.
7118 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7119 absolute relocs and target specific relocs.
7120 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7121 add_target_specific.
7122 (class Output_data_reloc) [SHT_RELA]: Likewise.
7123 * output.cc (Output_reloc::Output_reloc): Add four new versions
7124 for absolute relocs and target specific relocs.
7125 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7126 (Output_reloc::get_symbol_index): Likewise.
7127 (Output_reloc::local_section_offset): Check that local_sym_index_
7128 is not TARGET_CODE or 0.
7129 (Output_reloc::symbol_value): Likewise.
7130 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7131 reloc.
7132 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7133 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7134 functions.
7135 * layout.cc (add_target_dynamic_tags): Use output section for
7136 DT_PLTRELSZ and DT_JMPREL.
7137
3a44184e
ILT
71382010-01-07 Ian Lance Taylor <iant@google.com>
7139
7140 PR 11061
7141 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7142 function.
7143 (class Output_data_reloc_generic): Define.
7144 (class Output_data_reloc_base): Change base class to
7145 Output_data_reloc_generic. Change add() method to call
7146 bump_relative_reloc_count for a relative reloc. Remove
7147 sort_relocs_ field.
7148 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7149 to sort_relocs().
7150 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7151 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7152 appropriate.
7153 * layout.h (class Layout): Update declaration.
7154
ea715a34
ILT
71552010-01-07 Ian Lance Taylor <iant@google.com>
7156
7157 * output.h (class Output_data): Add const version of
7158 output_section and do_output_section.
7159 (class Output_section_data): Add const version of
7160 do_output_section.
7161 (class Output_section): Likewise.
7162 * layout.cc (Layout::add_target_dynamic_tags): New function.
7163 * layout.h (class Layout): Update declarations.
7164 * arm.cc (Target_arm::do_finalize_sections): Use
7165 add_target_dynamic_tags.
7166 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7167 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7168 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7169 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7170
659948a4
ILT
71712010-01-07 Ian Lance Taylor <iant@google.com>
7172
7173 PR 11042
7174 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7175 object as needed.
7176
9d3b86f6
ILT
71772010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7178 Ian Lance Taylor <iant@google.com>
7179
7180 PR 11019
7181 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7182 Xindex::read_symtab_xindex.
7183
bb0d3eb0
DK
71842010-01-07 Doug Kwan <dougkwan@google.com>
7185
7186 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7187 (Insn_template::thumb16_bcond_insn): New method declaration.
7188 (Insn_template): Fix spelling.
7189 (Stub::thumb16_special): New method declaration.
7190 (Stub::do_write): Define virtual method which was previously pure
7191 virtual.
7192 (Stub::do_thumb16_special): New method declaration.
7193 (Stub::do_fixed_endian_write): New template member.
7194 (Reloc_stub::do_write): Remove.
7195 (Reloc_stub::do_fixed_endian_write): Remove.
7196 (Cortex_a8_stub): New class definition.
7197 (Stub_factory::make_cortex_a8_stub): New method definition.
7198 (Stub_factory::Stub_factory): Add missing static storage class
7199 qualifier for elf32_arm_stub_a8_veneer_blx.
7200
ffeef7df
ILT
72012010-01-07 Ian Lance Taylor <iant@google.com>
7202
dc3f80fe
ILT
7203 PR 10980
7204 * options.h (class General_options): Add --warn-unresolved-symbols
7205 and --error-unresolved-symbols.
7206 * errors.cc (Errors::undefined_symbol): Implement
7207 --warn-unresolved-symbols.
7208
ffeef7df
ILT
7209 * options.h (class General_options): Add -z text and -z textoff.
7210 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7211
f1ec9ded
ST
72122010-01-06 Sriraman Tallam <tmsriram@google.com>
7213
7214 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7215 (Garbage_collection::cident_sections): New function.
7216 (Garbage_collection::add_cident_section): New function.
7217 (Garbage_collection::cident_sections_): New member.
7218 (gc_process_relocs): Add references to sections whose names are C
7219 identifiers.
7220 * gold.h (cident_section_start_prefix): New constant.
7221 (cident_section_stop_prefix): New constant.
7222 (is_cident): New function.
7223 * layout.cc (Layout::define_section_symbols): Replace string constants
7224 with the newly defined constants.
7225 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7226 C identifiers.
7227 * testsuite/Makefile.am: Add gc_orphan_section_test.
7228 * testsuite/Makefile.in: Regenerate.
7229 * testsuite/gc_orphan_section_test.cc: New file.
7230 * testsuite/gc_orphan_section_test.sh: New file.
7231
6eda8c29
ILT
72322010-01-06 Ian Lance Taylor <iant@google.com>
7233
b9674e17
ILT
7234 PR 10980
7235 * options.h (class General_options): Add --warn-shared-textrel.
7236 * layout.cc (Layout::finish_dynamic_section): Implement
7237 --warn-shared-textrel.
7238
6eda8c29
ILT
7239 PR 10980
7240 * options.h (class General_options): Add --warn-multiple-gp.
7241
32dcd44e
ILT
72422010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7243
7244 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7245 $(THREADSLIB) and $(LIBDL).
7246 * Makefile.in: Rebuild.
7247
a192ba05
ILT
72482010-01-06 Ian Lance Taylor <iant@google.com>
7249
7250 PR 10980
7251 * options.cc (General_options::parse_section_start): New function.
7252 (General_options::section_start): New function.
7253 (General_options::General_options): Initialize all members.
7254 * options.h: Include <map>
7255 (class General_options): Add --section-start. Add section_starts_
7256 member.
7257 * layout.cc (Layout::attach_allocated_section_to_segment): If
7258 --section-start was used, set the address of the segment. Remove
7259 local sort_sections.
7260 (Layout::relaxation_loop_body): If the address of the load segment
7261 has been set by --section-start, don't use it.
7262 * output.h (Output_segment::update_flags_for_output_section): New
7263 function.
7264 * output.cc (Output_segment::add_output_section): Call
7265 update_flags_for_output_section.
7266
dde3f402
ILT
72672010-01-05 Ian Lance Taylor <iant@google.com>
7268
62dfdd4d
ILT
7269 PR 10980
7270 * options.h (class General_options): Add --undefined-version.
7271 * script.cc (struct Version_expression): Add was_matched_by_symbol
7272 field.
7273 (Version_script_info::matched_symbol): New function.
7274 (Version_script_info::get_symbol_version_helper): Call
7275 matched_symbol.
7276 (Version_script_info::check_unmatched_names): New function.
7277 * script.h (class Version_script_info): Update declarations.
7278 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7279
9c4ae156
ILT
7280 * options.h (class General_options): Use DEFINE_bool_alias for
7281 allow_multiple_definition.
7282 * resolve.cc (Symbol_table::should_override): Don't test
7283 allow_multiple_definition.
7284
dde3f402
ILT
7285 PR 10980
7286 * options.h (class General_options): Add --cref.
7287 * main.cc (main): Print cref table if --cref. Don't close mapfile
7288 until after printing cref table.
7289 * cref.cc: Include "symtab.h".
7290 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7291 (Cref_table_compare::operator()): New function.
7292 (Cref_inputs::gather_cref): New function.
7293 (filecol): New static const.
7294 (Cref_inputs::print_cref): New function.
7295 (Cref::print_cref): New function.
7296 * cref.h: Include <cstdio>.
7297 (class Cref): Update declarations.
7298 * mapfile.h (Mapfile::file): New function.
7299 * object.h (class Object): Define Symbols. Declare virtual
7300 do_get_global_symbols.
7301 (Object::get_global_symbols): New function.
7302 * object.cc (Input_objects::add_object): Pass object to cref_ if
7303 --cref.
7304 (Input_objects::archive_start): Likewise.
7305 (Input_objects::archive_stop): Likewise.
7306 (Input_objects::print_cref): New function.
7307 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7308 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7309 --cref.
7310 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7311 function.
7312 * plugin.h (class Sized_pluginobj): Update declarations.
7313
8781f709
ILT
73142010-01-05 Ian Lance Taylor <iant@google.com>
7315
7316 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7317 to is_default_version. Rename insdef to insdefault.
7318 (Symbol_table::add_from_relobj): Rename def to is_default_version
7319 and local to is_forced_local.
7320 (Symbol_table::add_from_pluginobj): Likewise.
7321 (Symbol_table::add_from_dynobj): Likewise.
7322 (Symbol_table::define_special_symbol): Rename insdef to
7323 insdefault.
7324
fe35d28d
ILT
73252010-01-04 Ian Lance Taylor <iant@google.com>
7326
30bc8c46
ILT
7327 PR 10980
7328 * options.h (class General_options): Add
7329 --allow-multiple-definition and -z muldefs.
7330 * resolve.cc (Symbol_table::should_override): Don't warn about a
7331 multiple symbol definition if --allow-multiple-definition or -z
7332 muldefs.
7333
7eaea549
ILT
7334 PR 10980
7335 * options.h (class General_options): Add --add-needed and
7336 --copy-dt-needed-entries. Tweak --as-needed help entry.
7337 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7338 error if --copy-dt-needed-entries aka --add-needed is used and
7339 would cause a change in behaviour.
7340
fe35d28d
ILT
7341 PR 10980
7342 * options.h (class General_options): Add -G as a short version of
7343 --shared. Add no-op options -assert, -g, and -i.
7344
55a2bb35
ST
73452010-01-04 Sriraman Tallam <tmsriram@google.com>
7346
7347 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7348 check for .text or .gnu.linkonce.t sections.
7349 * icf.cc (Icf::find_identical_sections): Ditto.
7350 Change the detection for mangled function name within the section
7351 name.
7352 * icf.h (is_section_foldable_candidate): New function.
7353
719328e1
ILT
73542009-12-30 Ian Lance Taylor <iant@google.com>
7355
7356 PR 10980
7357 * options.h (class General_options): Permit two dashes with
7358 --retain-symbols-file.
7359
d7bb5745
ILT
73602009-12-30 Ian Lance Taylor <iant@google.com>
7361
403a15dd
ILT
7362 PR 10979
7363 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7364 don't put the file header and segment headers in the text
7365 segment.
7366
eda294df
ILT
7367 PR 10979
7368 * common.cc (Sort_commons::operator()): Stabilize sort when both
7369 entries are NULL.
7370 (Symbol_table::do_allocate_commons_list): When allocating common
7371 symbols, skip a symbol which is no longer common.
7372 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7373 an object before checking its type.
7374 * testsuite/common_test_2.c: New file.
7375 * testsuite/common_test_3.c: New file.
7376 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7377 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7378 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7379 (common_test_2_pic.o, common_test_2.so): New targets.
7380 (common_test_3_pic.o, common_test_3.so): New targets.
7381 * testsuite/Makefile.in: Rebuild.
7382
d7bb5745
ILT
7383 PR 10979
7384 * script.cc (read_input_script): If we see a new SECTIONS clause,
7385 and we have added an input section, give an error.
7386 * layout.h (class Layout): Add have_added_input_section function.
7387 Add have_added_input_section_ field.
7388 * layout.cc (Layout::Layout): Initialize
7389 have_added_input_section_.
7390 (Layout::layout): Set have_added_input_section_.
7391 (Layout::layout_eh_frame): Likewise.
7392
fc59c572
ILT
73932009-12-30 Ian Lance Taylor <iant@google.com>
7394
7395 PR 10931
7396 * options.h (class General_options): Add --sort-common option.
7397 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7398 * common.cc (Sort_common): Add sort_order parameter to
7399 constructor. Add sort_order_ field.
7400 (Sort_commons::operator): Check sort_order_.
7401 (Symbol_table::allocate_commons): Determine the sort order.
7402 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7403 Change all callers.
7404 (Symbol_table::do_allocate_commons_list): Likewise.
7405
1c74fab0
ILT
74062009-12-30 Ian Lance Taylor <iant@google.com>
7407
7408 PR 10916
7409 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7410 symbols from this object, don't change the visibility of an
7411 undefined symbol.
7412 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7413
6affe781
ILT
74142009-12-30 Ian Lance Taylor <iant@google.com>
7415
7416 PR 10861
7417 * script.h (class Version_script_info): Define Language enum.
7418 Update declarations. Define Glob, Exact, and Lookup types. Add
7419 new fields globals_, locals_, and is_finalized_.
7420 * script.cc: Various formatting fixes.
7421 (class Parser_closure): Change language_stack_ from a vector of
7422 std::string to one of Version_script_info::Language. Adjust all
7423 uses accordingly.
7424 (class Lazy_demangler): Remove.
7425 (struct Version_expression): Change language from std::string to
7426 Version_script_info::Language.
7427 (Version_script_info::Version_script_info): New function.
7428 (Version_script_info::~Version_script_info): Don't call clear.
7429 (Version_script_info::finalize): New function.
7430 (Version_script_info::build_lookup_tables): New function.
7431 (Version_script_info::build_expression_list_lookup): New
7432 function.
7433 (Version_script_info::get_symbol_version_helper): Rewrite to use
7434 lookup tables.
7435 (Version_script_info::print_expression_list): Adjust to use
7436 Version_script_info::Language.
7437 (script_push_lex_into_version_mode): Check that the version script
7438 has not been finalized.
7439 (version_script_push_lang): Change language string to
7440 Version_script_info::Language.
7441 * options.cc (Command_line::version_script): New function.
7442 * options.h (class General_options): Add finalize_dynamic_list
7443 function. Change version_script from declaration to definition.
7444 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7445 * testsuite/version_script.map: Remove duplicate def of foo.
7446 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7447 version_script.map.
7448 * testsuite/Makefile.in: Rebuild.
7449
818bf354
ILT
74502009-12-30 Ian Lance Taylor <iant@google.com>
7451
7452 PR 10843
7453 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7454 if the input symbol index is 0, make the output symbol index 0.
7455
ebcc8304
ILT
74562009-12-30 Ian Lance Taylor <iant@google.com>
7457
7458 PR 10670
7459 * options.h (class General_options): Add -x/--discard-all.
7460 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7461 --discard-all. If the local symbol needs a dynamic entry, check
7462 that before handling --discard-locals.
7463
176fe33f
ILT
74642009-12-30 Ian Lance Taylor <iant@google.com>
7465
bb321bb1
ILT
7466 PR 10450
7467 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7468 flags to PF_R.
7469 (Output_segment::add_output_section): Don't change the flags if
7470 the type is PT_TLS.
7471
176fe33f
ILT
7472 PR 10450
7473 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7474 GNU hash table if they need a dynamic value. Otherwise, don't add
7475 them if they are defined in a dynamic object or are forced local.
7476
e8cd95c7
ILT
74772009-12-29 Ian Lance Taylor <iant@google.com>
7478
1b81fb71
ILT
7479 PR 10450
7480 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7481 .gnu.hash table for a 32-bit target.
7482
8d6d383d
ILT
7483 PR 10450
7484 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7485 regular and a dynamic object only needs a dynamic symbol table
7486 entry if it is externally visible.
7487
e785ec03
ILT
7488 PR 10450
7489 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7490 constructor. Add global_offset_table_ field.
7491 (Target_i386::got_section): Set global_offset_table_.
7492 (Target_i386::do_finalize_sections): Set global_offset_table_
7493 size.
7494 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7495 in constructor. Add global_offset_table_ field.
7496 (Target_x86_64::got_section): Set global_offset_table_.
7497 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7498 size.
7499
1a2dff53
ILT
7500 * layout.cc (Layout::Layout): Initialize increase_relro_.
7501 (Layout::get_output_section): Add is_relro, is_last_relro, and
7502 is_first_non_relro parameters. Change all callers.
7503 (Layout::choose_output_section): Likewise.
7504 (Layout::add_output_section_data): Likewise.
7505 (Layout::make_output_section): Likewise.
7506 (Layout::set_segment_offsets): Clear increase_relro when using a
7507 linker script.
7508 * layout.h (class Layout): Add increase_relro method. Add
7509 increase_relro_ field. Update declarations.
7510 * output.cc (Output_section::Output_section): Initialize
7511 is_last_relro_ and is_first_non_relro_.
7512 (Output_segment::add_output_section): Group relro sections is
7513 do_sort is true. Handle is_last_relro and is_first_non_relro.
7514 (Output_segment::maximum_alignment): Remove relro handling.
7515 (Output_segment::set_section_addresses): Add increase_relro
7516 parameter. Change all callers. Add initial alignment to align
7517 relro sections on separate page. Remove old relro handling.
7518 (Output_segment::set_section_list_addresses): Remove in_relro
7519 parameter. Change all callers.
7520 (Output_segment::set_offset): Add increase parameter. Change all
7521 callers. Remove old relro handling.
7522 * output.h (class Output_section): Add new methods: is_last_relro,
7523 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7524 Add is_last_relro_ and is_first_non_relro_ fields.
7525 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7526 Create separate .got.plt section. Call increase_relro.
7527 * x86_64.cc (Target_x86_64::got_section): Likewise.
7528 * testsuite/relro_script_test.t: Add .got.plt.
7529
f0ba79e2
ILT
7530 PR 10450
7531 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7532 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7533 (Layout::finalize): Call set_dynamic_symbol_size.
7534 (Layout::set_dynamic_symbol_size): New function.
7535 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7536 set_dynamic_symbol_size.
7537
e8cd95c7
ILT
7538 PR 10450
7539 * output.h (class Output_section): Add is_entsize_zero_ field.
7540 * output.cc (Output_section::Output_section): Initialize
7541 is_entsize_zero_.
7542 (Output_section::set_entsize): If two different entsizes are
7543 requested, force it to zero.
7544 (Output_section::add_input_section): Set flags for .debug_str
7545 before updating section flags. Set entsize.
7546 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7547 and SHF_STRING if all input sections have those flags.
7548
3e1b9a8a
RÁE
75492009-12-29 Rafael Espindola <espindola@google.com>
7550
7551 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
7552 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7553 reporting.
3e1b9a8a 7554
3dcad376
ST
75552009-12-29 Sriraman Tallam <tmsriram@google.com>
7556
7557 * options.cc (General_options::parse_version): Allow -v to exit
7558 without an error if there is nothing to link.
7559
084e2665
ILT
75602009-12-29 Ian Lance Taylor <iant@google.com>
7561
7562 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7563 using a version of gcc before 4.1.
7564 * configure: Rebuild.
7565
250acde3
CD
75662009-12-28 Chris Demetriou <cgd@google.com>
7567
7568 * attributes.cc (Output_attributes_section_data::do_write): Use
7569 std::vector::front rather than std::vector::data.
7570
99fff23b
ILT
75712009-12-28 Ian Lance Taylor <iant@google.com>
7572
7573 * symtab.h (class Symbol_table): Add enum Defined.
7574 * resolve.cc (Symbol_table::should_override): Add defined
7575 parameter. Change all callers. Test whether object is NULL
7576 before calling a method on it.
7577 (Symbol_table::report_resolve_problem): Add defined parameter.
7578 Change all callers.
7579 (Symbol_table::should_override_with_special): Likewise.
7580 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7581 parameter. Change all callers.
7582 (Symbol_table::do_define_in_output_data): Likewise.
7583 (Symbol_table::define_in_output_segment): Likewise.
7584 (Symbol_table::do_define_in_output_segment): Likewise.
7585 (Symbol_table::define_as_constant): Likewise.
7586 (Symbol_table::do_define_as_constant): Likewise.
7587 * script.h (class Symbol_assignment): Add is_defsym parameter to
7588 constructor; change all callers.
7589 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7590 parameter. Change all callers. Add is_defsym_ field.
7591 (class Parser_closure): Add parsing_defsym parameter to
7592 constructor; change all callers. Add parsing_defsym accessor
7593 function. Add parsing_defsym_ field.
7594
556bd683
ILT
75952009-12-28 Ian Lance Taylor <iant@google.com>
7596
7597 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 7598 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 7599
1782c879
ILT
76002009-12-23 Ian Lance Taylor <iant@google.com>
7601
7602 * i386.cc (Target_i386::do_calls_non_split): Recognize
7603 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
7604 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7605 -fsplit-stack prologue when using %r11.
1782c879 7606
329ca2b1
ST
76072009-12-21 Sriraman Tallam <tmsriram@google.com>
7608
7609 * options.cc (General_options::parse_version): Make -v continue and do
7610 the link like GNU ld does.
7611
d675ff46
RÁE
76122009-12-17 Rafael Avila de Espindola <espindola@google.com>
7613
7614 * Makefile.am (CCFILES): Add timer.cc.
7615 (HFILES): Add timer.h.
7616 * configure.ac: Check for sysconf and times.
7617 * main.cc: include timer.h.
7618 (main): Use Timer instead of get_run_time.
7619 * timer.cc: New.
7620 * timer.h: New.
7621 * workqueue.cc: include timer.h.
7622 (Workqueue::find_and_run_task):
7623 Report user, sys and wall time.
7624 * Makefile.in: Regenerate.
7625 * config.in: Regenerate.
7626 * configure: Regenerate.
7627
d6344fb5
DK
76282009-12-16 Doug Kwan <dougkwan@google.com>
7629
7630 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7631 sections.
7632 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7633 relaxed input sections.
7634 * output.cc (Output_section::find_relaxed_input_section): Change
7635 return type to Output_relaxed_input_section pointer. Adjust code
7636 for new type of relaxed_input_section_map_.
7637 * output.h (Output_section::find_relaxed_input_section): Change
7638 return type to Output_relaxed_input_section pointer.
7639 (Output_section::Output_relaxed_input_section_by_input_section_map):
7640 New type.
7641 (Output_section::relaxed_input_section_map_): Change type to
7642 Output_section::Output_relaxed_input_section_by_input_section_map.
7643 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7644 input section.
7645
0e0d5469
ILT
76462009-12-15 Ian Lance Taylor <iant@google.com>
7647
7648 * layout.cc (Layout::create_shstrtab): Only write out after input
7649 sections if we are compressing debug sections.
7650
0649a889
ILT
76512009-12-15 Ian Lance Taylor <iant@google.com>
7652
7653 * archive.cc (Archive::add_symbols): Only look up a symbol without
7654 a version if there is, in fact, a version.
7655
2ea97941
ILT
76562009-12-14 Ian Lance Taylor <iant@google.com>
7657
7658 Revert -Wshadow changes, all changes from:
7659 2009-12-11 Doug Kwan <dougkwan@google.com>
7660 2009-12-11 Nick Clifton <nickc@redhat.com>
7661 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7662
b0eec2cc
DK
76632009-12-11 Doug Kwan <dougkwan@google.com>
7664
7665 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7666 due to -Wshadow.
7667 * attributes.cc (Object_attribute::size): Ditto.
7668 (Attributes_section_data::size): Ditto.
7669 (Attributes_section_data::Attributes_section_data): Ditto.
7670 (Output_attributes_section_data::do_write): Ditto.
7671 * attributes.h (Object_attribute::set_type): Ditto.
7672 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7673
91d6fa6a
NC
76742009-12-11 Nick Clifton <nickc@redhat.com>
7675
7676 * archive.cc: Fix shadowed variable warnings.
7677 * arm.cc: Likewise.
7678 * compressed_output.cc: Likewise.
7679 * compressed_output.h: Likewise.
7680 * configure: Likewise.
7681 * dwarf_reader.cc: Likewise.
7682 * dynobj.cc: Likewise.
7683 * dynobj.h: Likewise.
7684 * ehframe.cc: Likewise.
7685 * ehframe.h: Likewise.
7686 * errors.cc: Likewise.
7687 * expression.cc: Likewise.
7688 * fileread.cc: Likewise.
7689 * fileread.h: Likewise.
7690 * freebsd.h: Likewise.
7691 * i386.cc: Likewise.
7692 * icf.cc: Likewise.
7693 * incremental.h: Likewise.
7694 * layout.cc: Likewise.
7695 * layout.h: Likewise.
7696 * mapfile.cc: Likewise.
7697 * merge.cc: Likewise.
7698 * merge.h: Likewise.
7699 * object.cc: Likewise.
7700 * object.h: Likewise.
7701 * options.h: Likewise.
7702 * output.cc: Likewise.
7703 * output.h: Likewise.
7704 * parameters.cc: Likewise.
7705 * plugin.cc: Likewise.
7706 * powerpc.cc: Likewise.
7707 * reduced_debug_output.cc: Likewise.
7708 * reduced_debug_output.h: Likewise.
7709 * reloc.cc: Likewise.
7710 * reloc.h: Likewise.
7711 * resolve.cc: Likewise.
7712 * script-sections.cc: Likewise.
7713 * script.cc: Likewise.
7714 * script.h: Likewise.
7715 * sparc.cc: Likewise.
7716 * symtab.cc: Likewise.
7717 * symtab.h: Likewise.
7718 * target-select.cc: Likewise.
7719 * target-select.h: Likewise.
7720 * token.h: Likewise.
7721 * workqueue.cc: Likewise.
7722 * workqueue.h: Likewise.
7723 * x86_64.cc: Likewise.
7724
a0351a69
DK
77252009-12-10 Doug Kwan <dougkwan@google.com>
7726
7727 * arm.cc (attributes.h): New include.
7728 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7729 (Arm_relobj::~Arm_relobj): Delete object pointed by
7730 attributes_section_data_.
7731 (Arm_relobj::attributes_section_data): New method definition.
7732 (Arm_relobj::attributes_section_data_): New data member declaration.
7733 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7734 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7735 attributes_section_data_.
7736 (Arm_dynobj::attributes_section_data): New method definition.
7737 (Arm_dynobj::attributes_section_data_): New data member declaration.
7738 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7739 initialization value of may_use_blx_ to false.
2e702c99 7740 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
a0351a69
DK
7741 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7742 object attributes to compute results instead of hard-coding.
7743 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7744 Target_arm::get_secondary_compatible_arch,
7745 Target_arm::set_secondary_compatible_arch
7746 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7747 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7748 New method declarations.
7749 (Target_arm::get_aeabi_object_attribute): New method definition.
7750 (Target_arm::attributes_section_data_): New data member declaration.
7751 (read_arm_attributes_section): New template definition.
7752 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7753 (Arm_dynobj::do_read_symbols): Ditto.
7754 (Target_arm::do_finalize_sections): Merge attributes sections from
7755 input. Check for BLX use after attributes section merging.
7756 Fix __exidx_start and __exidx_end visibility. Create an
7757 .ARM.attributes section if necessary.
7758 (Target_arm::get_secondary_compatible_arch,
7759 Target_arm::set_secondary_compatible_arch,
7760 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7761 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 7762 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
7763 New method definitions.
7764
b59befec
ILT
77652009-12-09 Ian Lance Taylor <iant@google.com>
7766
7767 * plugin.cc (Plugin::load): Don't cast from void* to a function
7768 pointer.
7769
1276bc89
ILT
77702009-12-09 Ian Lance Taylor <iant@google.com>
7771
7772 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7773 information fields.
7774
2f2de248
L
77752009-12-09 H.J. Lu <hongjiu.lu@intel.com>
7776
7777 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7778 Replace two_file_shared_1.so with two_file_shared_2.so.
7779 * testsuite/Makefile.in: Regenerated.
7780
4f787271
DK
77812009-12-08 Doug Kwan <dougkwan@google.com>
7782
7783 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7784 (HFILES): Add attributes.h and int_encoding.h.
7785 * Makefile.in: Regenerate.
7786 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7787 function definitions to int_encoding.cc
7788 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7789 prototypes to int_encoding.h
7790 * reduced_debug_output.cc (int_encoding.h): New include.
7791 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7792 function definitions to int_encoding.cc
7793 (insert_into_vector, read_from_pointer): Move template definitions to
7794 int_encoding.h
7795 * attributes.cc: New file.
7796 * attributes.h: New file.
7797 * int_encoding.cc: New file.
7798 * int_encoding.h: New file.
7799
20b52f1a
RÁE
78002009-12-07 Rafael Avila de Espindola <espindola@google.com>
7801
7802 PR gold/11055
7803 * incremental-dump.cc (dump_incremental_inputs): New.
7804 (main): Use dump_incremental_inputs.
7805
53d7974c
L
78062009-12-07 H.J. Lu <hongjiu.lu@intel.com>
7807
7808 PR gold/10893
7809 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7810 checking elfcpp::STT_FUNC.
7811 (Target_i386::Relocate::relocate): Likewise.
7812 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7813
7814 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7815 symbols from shared libraries into normal FUNC symbols.
7816
7817 * symtab.h (Symbol): Add is_func and use it.
7818
05a352e6
DK
78192009-12-05 Doug Kwan <dougkwan@google.com>
7820
7821 * arm.cc (Target_arm::arm_info): Initialize new fields
7822 attributes_section and attributes_vendor.
7823 * i386.cc (Target_i386::i386_info): Same.
7824 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7825 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7826 fields attributes_section and attributes_vendor.
53d7974c 7827 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
7828 * target.h (Target::attributes_section, Target::attributes_vendor,
7829 Target::is_attributes_section, Target::attribute_arg_type,
7830 Target::attributes_order): New method definitions.
7831 (Target::Target_info::attributes_section,
7832 Target::Target_info::attributes_vendor): New fields.
7833 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7834 virtual method definitions.
7835 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7836 attributes_section and attributes_vendor.
7837 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7838
f4e5969c
DK
78392009-12-05 Doug Kwan <dougkwan@google.com>
7840
7841 * arm.cc: Update comments about interworking and stub generation.
7842 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7843 considered as non-PIC.
7844 (Arm_relocate_functions::base_abs): Fix formatting.
7845 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7846 of function to use GOT entry address instead of offset.
7847 (Target_arm::Scan::global): Issue an error if a symbol would need a
7848 PLT does not get one because it is untyped. Remove code to create
7849 dynamic symbols for relative branches.
7850 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7851 takes unsigned integer instead of boolean.
7852
1abce4a6
L
78532009-12-05 H.J. Lu <hongjiu.lu@intel.com>
7854
7855 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7856 (two_file_test_LDADD): Likewise.
7857 (common_test_1_LDADD): Likewise.
7858 (exception_test_LDADD) Likewise.
7859 (weak_test_LDADD): Likewise.
7860 (many_sections_test_LDADD): Likewise.
7861 (initpri1_LDADD): Likewise.
7862 (script_test_1_LDADD): Likewise.
7863 (script_test_2_LDADD): Likewise.
7864 (justsyms_LDADD): Likewise.
7865 (binary_test_LDADD): Likewise.
7866 (large_LDADD): Likewise.
7867 * testsuite/Makefile.in: Regenerated.
7868
adcf2816 78692009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 7870
adcf2816
L
7871 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7872 (Symbol_table::override_with_special): Likewise.
7873 (Symbol_table::add_from_object): Likewise.
7874
28e67f5d
RÁE
78752009-12-04 Rafael Avila de Espindola <espindola@google.com>
7876
7877 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7878 Don't set the data_offset twice.
7879
ae10a101
RÁE
78802009-12-04 Rafael Avila de Espindola <espindola@google.com>
7881
7882 * testsuite/Makefile.in: Regenerate.
7883
f59f41f3
DK
78842009-12-03 Doug Kwan <dougkwan@google.com>
7885
7886 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7887 (Target_arm::do_finalize_sections): Add parameter for symbol table
7888 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7889 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7890 parameter for symbol table pointer.
7891 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7892 an additional parameter for a pointer to symbol table.
7893 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7894 parameter for a symbol table pointer.
7895 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7896 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7897 Ditto.
7898 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7899 parameter for a symbol table pointer.
7900
ca55d848
RÁE
79012009-12-03 Rafael Avila de Espindola <espindola@google.com>
7902
7903 * incremental.cc (Incremental_inputs_header)
7904 (Incremental_inputs_header_write, Incremental_inputs_entry)
7905 (Incremental_inputs_entry_write): Move ...
7906 * incremental.h (Incremental_inputs_header)
7907 (Incremental_inputs_header_write, Incremental_inputs_entry)
7908 (Incremental_inputs_entry_write): here.
7909
3aec4f9c
RÁE
79102009-12-02 Rafael Avila de Espindola <espindola@google.com>
7911
7912 * incremental.cc (make_sized_incremental_binary): Set the target.
7913 Error if it is incompatible.
7914 * output.h (Output_file): Add filename method.
7915
9c0ae74d
RÁE
79162009-12-02 Rafael Avila de Espindola <espindola@google.com>
7917
7918 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7919 from the get_* methods.
7920
a45500ae
RÁE
79212009-12-02 Rafael Avila de Espindola <espindola@google.com>
7922
7923 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7924 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7925 Write 0 for the data_offset of scripts.
7926
325e6408
RÁE
79272009-12-02 Rafael Avila de Espindola <espindola@google.com>
7928
7929 * testsuite/Makefile.am: Add the incremental_test.sh test.
7930 * testsuite/incremental_test.sh: New.
7931 * testsuite/incremental_test_1.c: New.
7932 * testsuite/incremental_test_2.c: New.
7933
954c3e2e
RÁE
79342009-12-01 Rafael Avila de Espindola <espindola@google.com>
7935
7936 * incremental-dump.cc (main): Fix typos.
7937
f8086623
RÁE
79382009-11-27 Rafael Avila de Espindola <espindola@google.com>
7939
7940 PR gold/11025
7941 * incremental-dump.cc (main): Use llu to print 64 bit values.
7942
3b0dd6ac
L
79432009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7944 H.J. Lu <hongjiu.lu@intel.com>
7945
7946 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7947 $(LIBDL).
7948 (incremental_dump_LDADD): Likewise.
7949 * Makefile.in: Regenerated.
7950
a6d1ef57 79512009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 7952
a6d1ef57
DK
7953 Revert:
7954
7955 2009-11-25 Doug Kwan <dougkwan@google.com>
7956
7957 * arm.cc (Target_arm::Target_arm): Move method definition
7958 outside of class definition. Add code to handle
7959 --target1-rel, --target1-abs and --target2= options.
7960 (Target_arm::get_reloc_reloc_type): Change method to be
7961 non-static and const.
7962 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7963 New data member declaration.
7964 (Target_arm::Scan::local, Target_arm::Scan::global,
7965 Target_arm::Relocate::relocate,
7966 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7967 Adjust call to Target_arm::get_real_reloc_type.
7968 (Target_arm::get_real_reloc_type): Use command line options
7969 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7970 * options.h (--target1-rel, --target1-abs, --target2): New
7971 ARM-only options.
7972
50aeb7d4
DK
79732009-11-25 Doug Kwan <dougkwan@google.com>
7974
7975 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7976 class definition. Add code to handle --target1-rel, --target1-abs
7977 and --target2= options.
7978 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7979 and const.
7980 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7981 member declaration.
7982 (Target_arm::Scan::local, Target_arm::Scan::global,
7983 Target_arm::Relocate::relocate,
7984 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7985 call to Target_arm::get_real_reloc_type.
7986 (Target_arm::get_real_reloc_type): Use command line options to
7987 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7988 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7989 options.
7990
51938283
DK
79912009-11-25 Doug Kwan <dougkwan@google.com>
7992
7993 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7994 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7995 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7996 formatting.
7997 (Arm_relocate_functions::thm_call): Replace body with a call to
7998 Arm_relocate_functions::thumb_branch_common.
7999 (Arm_relocate_functions::thm_jump24,
8000 Arm_relocate_functions::thm_xpc22): New method definitions.
8001 (Arm_relocate_functions::thumb_branch_common): New method definition.
8002 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8003 operator.
8004 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8005 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8006
e2b8f3c4
RÁE
80072009-11-24 Rafael Avila de Espindola <espindola@google.com>
8008
8009 * Makefile.am: Build incremental-dump
8010 * Makefile.in: Regenerate.
8011 * incremental-dump.cc: New.
8012 * incremental.cc (Incremental_inputs_header_data,
8013 Incremental_inputs_entry_data): Move to incremental.h
8014 * incremental.h: (Incremental_inputs_header_data,
8015 Incremental_inputs_entry_data): Move from incremental.cc
8016
bcba9aec
RÁE
80172009-11-24 Rafael Avila de Espindola <espindola@google.com>
8018
8019 * incremental.cc (Incremental_inputs_header,
8020 Incremental_inputs_header_write, Incremental_inputs_entry,
8021 Incremental_inputs_entry_write): Add a typedef with the data type.
8022
7c3afe08
RÁE
80232009-11-24 Rafael Avila de Espindola <espindola@google.com>
8024
8025 * incremental.cc (Incremental_inputs_header,
8026 Incremental_inputs_header_write, Incremental_inputs_entry,
8027 Incremental_inputs_entry_write): Update comment about which
8028 type has the filed descriptions.
8029
d204b6e9
DK
80302009-11-15 Doug Kwan <dougkwan@google.com>
8031
8032 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8033 (Arm_relocate_functions::arm_branch_common): Change method defintion
8034 in class definition to a method declaration and update list of formal
8035 parameters.
8036 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8037 Arm_relocation_functions::jump24): Adjust call to
8038 Arm_relocate_functions::arm_branch_common. Update list of formal
8039 parameters.
8040 (Arm_relocate_functions::xpc25): New method definition.
8041 (Arm_relocate_functions::arm_branch_common): Move method defintion
8042 out from class definition. Use stubs for mode-switching and extending
8043 branch ranges.
8044 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8045 specially. Change code to enable use of stubs in ARM branches.
8046
43d12afe
DK
80472009-11-10 Doug Kwan <dougkwan@google.com>
8048
8049 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8050 in method declaration.
8051 (Target_arm::relocate_stub): New method declaration.
8052 (Target_arm::default_target): Change to return a pointer instead of
8053 a const reference.
8054 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8055 Target_arm::default_target.
8056 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8057 method definition.
8058 (Target_arm::relocate_section): Adjust view.
8059 (Target_arm::relocate_stub): New method definition.
8060
ac33a407
DK
80612009-11-10 Doug Kwan <dougkwan@google.com>
8062
8063 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8064 a format warning.
8065 * incremental.cc (open_incremental_binary): Initialized local
8066 variables to avoid warnings.
8067 * object.cc (make_elf_object): Ditto.
8068 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8069 a format warning.
e1df38aa 8070
88ee28e9
L
8071009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8072
8073 PR gold/10930
8074 * testsuite/plugin_test.c: Include "config.h".
8075
2daedcd6
DK
80762009-11-09 Doug Kwan <dougkwan@google.com>
8077
8078 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8079 (arm_symbol_value): Remove.
8080 (Arm_relocate_functions::arm_branch_common,
8081 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8082 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8083 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8084 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8085 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8086 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8087 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8088 Arm_relocate_functions::thm_mobw_abs_nc,
8089 Arm_relocate_functions::thm_mov_abs,
8090 Arm_relocate_functions::movw_prel_nc,
8091 Arm_relocate_functions::thm_movt_abs,
8092 Arm_relocate_functions::movt_prel,
8093 Arm_relocate_functions::thm_movw_prel_nc,
8094 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8095 (Target_arm::Relocate::relocate): Only decompose address into two
8096 parts if relocation type uses the thumb-bit and pass the actual
8097 bit instead of a flag indicating that the thumb-bit is used. Adjust
8098 calls to methods in Arm_relocate_functions for this change.
8099
1276bc89 81002009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
8101
8102 PR 10925
8103 * reloc.cc: Instantiate
8104 Sized_relobj::initialize_input_to_output_maps and
8105 Sized_relobj:free_input_to_output_maps.
8106
e53ad1b5
ILT
81072009-11-06 Ian Lance Taylor <iant@google.com>
8108
8109 PR 10876
8110 * defstd.cc (in_segment): Set only_if_ref true for "end".
8111
eb44217c
DK
81122009-11-06 Doug Kwan <dougkwan@google.com>
8113
8114 * arm.cc (class Reloc_stub): Correct a comment.
8115 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8116 (Target_arm::scan_section_for_stubs): New method declaration.
8117 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8118 Change methods from private to protected.
8119 (Target_arm::do_may_relax): New method definition.
8120 (Target_arm::do_relax, Target_arm::group_sections,
8121 Target_arm::scan_reloc_for_stub,
8122 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8123 (Target_arm::arm_input_section_map_): New data member declaration.
8124 (Target_arm::scan_reloc_for_stub,
8125 Target_arm::scan_reloc_section_for_stubs,
8126 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8127 Target_arm::do_relax): New method definitions.
8128
5d329b7d
ILT
81292009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8130
8131 * configure.ac: Check for (struct stat)::st_mtim
8132 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8133 * config.in: Regenerate.
8134 * configure: Regenerate.
8135
96a0d71b
ILT
81362009-11-05 Ian Lance Taylor <iant@google.com>
8137
8138 PR 10910
8139 * output.cc (Output_segment::add_output_section): Add missing
8140 return statement.
8141
594c8e5e
ILT
81422009-11-04 Ian Lance Taylor <iant@google.com>
8143
8144 PR 10880
8145 * object.h (class Object): Add is_needed and set_is_needed
8146 methods. Add is_needed_ field. Make bool fields into bitfields.
8147 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8148 defined in a dynamic object and referenced by a regular object,
8149 set is_needed for the dynamic object.
8150 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8151 if the file is marked with as_needed and it is not needed.
8152
22b127cc
ILT
81532009-11-04 Ian Lance Taylor <iant@google.com>
8154
8155 PR 10887
8156 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8157 tags if data is discarded by linker script.
8158 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8159 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8160 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8161 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8162
f5c870d2
ILT
81632009-11-04 Ian Lance Taylor <iant@google.com>
8164
8165 * layout.cc (Layout::get_output_section): Add is_interp and
8166 is_dynamic_linker_section parameters. Change all callers.
8167 (Layout::choose_output_section): Likewise.
8168 (Layout::make_output_section): Likewise.
8169 (Layout::add_output_section_data): Add is_dynamic_linker_section
8170 parameter. Change all callers.
8171 * layout.h (class Layout): Update declarations.
8172 * output.h (class Output_section): Add is_interp, set_is_interp,
8173 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8174 Add is_interp_, is_dynamic_linker_section_ fields. Change
8175 generate_code_fills_at_write_ to a bitfield.
8176 * output.cc (Output_section::Output_sections): Initialize new
8177 fields.
8178 (Output_segment::add_output_section): Add do_sort parameter.
8179 Change all callers.
8180
1ae4d23b
ILT
81812009-11-03 Ian Lance Taylor <iant@google.com>
8182
8183 PR 10860
8184 * options.h (class General_options): Add --warn-common.
8185 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8186 merging two common symbols.
8187 (Symbol_table::should_override): Handle --warn-common when merging
8188 a common symbol with a defined symbol. Use report_resolve_problem
8189 for multiple definitions.
8190 (Symbol_table::report_resolve_problem): New function.
8191 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8192
55da9579
DK
81932009-11-03 Doug Kwan <dougkwan@google.com>
8194
8195 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8196 stub_factory_.
8197 (Target_arm::stub_factory): New method definition.
8198 (Target_arm::new_arm_input_section,
8199 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8200 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 8201 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
8202 New type definitions.
8203 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8204 member declarations.
8205 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8206 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8207 New method definitions.
8208
37a9ac43
ILT
82092009-11-03 Ian Lance Taylor <iant@google.com>
8210
8211 * options.h (class General_options): Add --warn_constructors.
8212
b3d6a3d4
ILT
82132009-11-03 Ian Lance Taylor <iant@google.com>
8214
8215 PR 10893
8216 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8217 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8218
934b01dd
ILT
82192009-11-03 Ian Lance Taylor <iant@google.com>
8220
8221 PR 10895
8222 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8223 --msgid-bugs-address.
8224 (install-pdf): New target.
8225 (install-data_yes): Look up one directory to find mkinstalldirs.
8226
03c1939b
L
82272009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8228
8229 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8230 tree.
8231
ebd95253
DK
82322009-10-30 Doug Kwan <dougkwan@google.com>
8233
8234 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8235
e9bbb538
DK
82362009-10-30 Doug Kwan <dougkwan@google.com>
8237
8238 * arm.cc (Stub_addend_reader): New struct template definition
8239 and partial specializations.
8240 (Stub_addend_reader::operator()): New method definition for a
8241 partially specialized template.
8242
d5b40221
DK
82432009-10-30 Doug Kwan <dougkwan@google.com>
8244
8245 * arm.cc (Arm_relobj::processor_specific_flags): New method
8246 definition.
8247 (Arm_relobj::do_read_symbols): New method declaration.
8248 (Arm_relobj::processor_specific_flags_): New data member declaration.
8249 (Arm_dynobj): New class definition.
8250 (Target_arm::do_finalize_sections): Add input_objects parameter.
8251 (Target_arm::do_adjust_elf_header): New method declaration.
8252 (Target_arm::are_eabi_versions_compatible,
8253 (Target_arm::merge_processor_specific_flags): New method declaration.
8254 (Target_arm::do_make_elf_object): New overloaded method definitions
8255 and declaration.
8256 (Arm_relobj::do_read_symbols): New method definition.
8257 (Arm_dynobj::do_read_symbols): Ditto.
8258 (Target_arm::do_finalize_sections): Add input_objects parameters.
8259 Merge processor-specific flags from all input objects.
8260 (Target_arm::are_eabi_versions_compatible,
8261 Target_arm::merge_processor_specific_flags,
8262 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8263 New method definitions.
8264 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8265 Input_objects pointer type parameter.
8266 * layout.cc (Layout::finalize): Pass input objects to target's.
8267 finalize_sections function.
8268 * output.cc (Output_file_header::do_sized_write): Set ELF file
8269 header's processor-specific flags.
8270 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8271 Input_objects pointer type parameter.
8272 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8273 * target.h (Input_objects): New forward class declaration.
8274 (Target::processor_specific_flags,
8275 Target::are_processor_specific_flags_sect): New method definitions.
8276 (Target::finalize_sections): Add input_objects parameter.
8277 (Target::Target): Initialize processor_specific_flags_ and
8278 are_processor_specific_flags_set_.
8279 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8280 parameter.
8281 (Target::set_processor_specific_flags): New method definition.
8282 (Target::processor_specific_flags_,
8283 Target::are_processor_specific_flags_set_): New data member
8284 declarations.
8285 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8286 Input_objects pointer type parameter.
8287
ebabffbd
DK
82882009-10-30 Doug Kwan <dougkwan@google.com>
8289
8290 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8291
ad0f2072
ILT
82922009-10-28 Ian Lance Taylor <iant@google.com>
8293
8294 * object.h (class Relobj): Drop options parameter from
8295 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8296 do_scan_relocs, do_relocate. Change all callers.
8297 (class Sized_relobj): Drop options parameters from
8298 do_gc_process_relocs, do_scan_relocs, do_relocate,
8299 do_relocate_sections, relocate_sections, emit_relocs_scan,
8300 emit_relocs_scan_reltype. Change all callers.
8301 (struct Relocate_info): Remove options field and all references to
8302 it.
8303 * reloc.h (class Read_relocs): Remove options constructor
8304 parameter and options_ field. Change all callers.
8305 (class Gc_process_relocs, class Scan_relocs): Likewise.
8306 (class Relocate_task): Likewise.
8307 * target-reloc.h (scan_relocs): Remove options parameter. Change
8308 all callers.
8309 (scan_relocatable_relocs): Likewise.
8310 * target.h (class Sized_target): Remove options parameter from
8311 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8312 all callers.
8313 * gc.h (gc_process_relocs): Remove options parameter. Change all
8314 callers.
8315 * arm.cc: Update functions to remove options parameters.
8316 * i386.cc: Likewise.
8317 * powerpc.cc: Likewise.
8318 * sparc.cc: Likewise.
8319 * x86_64.cc: Likewise.
8320 * testsuite/testfile.cc: Likewise.
8321
8ffa3667
DK
83222009-10-28 Doug Kwan <dougkwan@google.com>
8323
8324 * arm.cc (Arm_relobj): New class definition.
e1df38aa 8325 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
8326 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8327 New method definitions.
8328
40f36857
CC
83292009-10-28 Cary Coutant <ccoutant@google.com>
8330
8331 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8332 (Plugin::cleanup_done_): New member.
8333 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8334 (Plugin_manager::cleanup_done_): Remove.
8335 (Plugin_manager::add_input_file): Edit error message.
8336 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8337 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8338
2c849493
ILT
83392009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8340
8341 * fileread.cc: (File_read::View::~View): Use the new
8342 data_ownership_ filed.
8343 (File_read::~File_read): Dispose the new whole_file_view_.
8344 (File_read::open): Mmap the whole file if needed.
8345 (File_read::open): Use whole_file_view_ instead of contents_.
8346 (File_read::find_view): Use whole_file_view_ if applicable.
8347 (File_read::do_read): Use whole_file_view_ instead of contents_.
8348 (File_read::make_view): Use whole_file_view_ instead of contents_,
8349 update File_read::View::View call.
8350 (File_read::find_or_make_view): Update File_read::View::View
8351 call.
8352 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8353 remove contents_
8354 (File_read::View::Data_ownership): New enum.
8355 (File_read::View::View): Replace bool mapped_ with Data_ownership
8356 argument.
8357 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8358 (File_read::View::data_ownership_): New field.
8359 (File_read::contents_): Remove (replaced by whole_file_view_).
8360 (File_read::whole_file_view_): New field.
8361 * options.h (class General_options): Add --keep-files-mapped.
8362
24998053
CC
83632009-10-27 Cary Coutant <ccoutant@google.com>
8364
8365 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8366 * testsuite/Makefile.am (plugin_test_5): New test case.
8367 * testsuite/Makefile.in: Regenerate.
8368
72adc4fa
DK
83692009-10-25 Doug Kwan <dougkwan@google.com>
8370
8371 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8372 from private to protected to allow access by child class.
8373 (Sized_relobj::do_relocate_sections): New method declaration.
8374 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 8375 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
8376 Sized_relobj::relocate_sections. Instantiate template explicitly
8377 for different target sizes and endianity.
8378
07f508a2
DK
83792009-10-24 Doug Kwan <dougkwan@google.com>
8380
8381 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8382 (Arm_input_section::as_arm_input_section): New method.
8383 (Arm_output_section): New class definition.
8384 (Arm_output_section::create_stub_group,
8385 Arm_output_section::group_sections): New method definitions.
8386
10ad9fe5
DK
83872009-10-22 Doug Kwan <dougkwan@google.com>
8388
8389 * arm.cc (Arm_input_section): New class definition.
8390 (Arm_input_section::init, Arm_input_section:do_write,
8391 Arm_input_section::set_final_data_size,
8392 Arm_input_section::do_reset_address_and_file_offset): New method
8393 definitions.
8394
56ee5e00
DK
83952009-10-21 Doug Kwan <dougkwan@google.com>
8396
8397 * arm.cc (Stub_table, Arm_input_section): New forward class
8398 declarations.
8399 (Stub_table): New class defintion.
8400 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8401 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8402 New method definition.
8403
b569affa
DK
84042009-10-21 Doug Kwan <dougkwan@google.com>
8405
8406 * arm.cc: Update copyright comments.
8407 (Target_arm): New forward class template declaration.
8408 (Arm_address): New type.
8409 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8410 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8411 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8412 constants.
8413 (Insn_template): Same.
8414 (DEF_STUBS): New macro.
8415 (Stub_type): New enum type.
8416 (Stub_template): New class definition.
8417 (Stub): Same.
8418 (Reloc_stub): Same.
8419 (Stub_factory): Same.
8420 (Target_arm::Target_arm): Initialize may_use_blx_ and
8421 should_force_pic_veneer_.
8422 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8423 Target_arm::should_force_pic_veneer,
8424 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8425 Target_arm::using_thumb_only, Target_arm:;default_target): New
8426 method defintions.
8427 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8428 New data member declarations.
8429 (Insn_template::size, Insn_template::alignment): New method defintions.
8430 (Stub_template::Stub_template): New method definition.
8431 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8432 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8433 (Stub_factory::Stub_factory): New method definition.
8434 * gold.h (string_hash): New template.
8435 * output.h (Input_section_specifier::hash_value): Use
8436 gold::string_hash.
8437 (Input_section_specifier::string_hash): Remove.
8438 * stringpool.cc (Stringpool_template::string_hash): Use
8439 gold::string_hash.
8440
6c172549
DK
84412009-10-20 Doug Kwan <dougkwan@google.com>
8442
8443 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8444 symbols of relaxed input sections.
8445 * output.h (Output_section::find_relaxed_input_section): Make
8446 method public.
8447
c5617f2f
DK
84482009-10-16 Doug Kwan <dougkwan@google.com>
8449
8450 * dynobj.cc (Versions::Versions): Initialize version_script_.
8451 Only insert base version symbol definition for a shared object
8452 if version script defines any version versions.
8453 (Versions::define_base_version): New method definition.
8454 (Versions::add_def): Check that base version is not needed.
8455 (Versions::add_need): Define base version lazily.
8456 * dynobj.h (Versions::define_base_version): New method declaration.
8457 (Versions::needs_base_version_): New data member declaration.
8458 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8459 (check_DATA): Add no_version_test.stdout.
8460 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8461 New make rules.
8462 * testsuite/Makefile.in: Regenerate.
8463 * testsuite/no_version_test.c: New file.
8464 * testsuite/no_version_test.sh: Ditto.
8465
3c12dcdb
DK
84662009-10-16 Doug Kwan <dougkwan@google.com>
8467
8468 * expression.cc (class Segment_start_expression): New class definition.
8469 (Segment_start_expression::value): New method definition.
8470 (script_exp_function_segment_start): Return a new
8471 Segment_start_expression.
8472 * gold/script-c.h (script_saw_segment_start_expression): New function
8473 prototype.
8474 * script-sections.cc (Script_sections::Script_sections): Initialize
8475 SAW_SEGMENT_START_EXPRESSION_ to false.
8476 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8477 and -Tbbs options to specify section addresses if given in
8478 command line and no SEGMENT_START expression is seen in a script.
8479 * script-sections.h (Script_sections::saw_segment_start_expression,
8480 Script_sections::set_saw_segment_start_expression): New method
8481 definition.
8482 (Script_sections::saw_segment_start_expression_): New data member
8483 declaration.
8484 * script.cc (script_saw_segment_start_expression): New function.
8485 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8486 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8487 script_test_7.sh and script_test_8.sh.
8488 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8489 script_test_8.stdout.
8490 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8491 (script_test_6, script_test_6.stdout, script_test_7,
8492 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8493 * Makefile.in: Regenerate.
8494 * testsuite/script_test_6.sh: New file.
8495 * testsuite/script_test_6.t: Same.
8496 * testsuite/script_test_7.sh: Same.
8497 * testsuite/script_test_7.t: Same.
8498 * testsuite/script_test_8.sh: Same.
8499
64b1ae37
DK
85002009-10-16 Doug Kwan <dougkwan@google.com>
8501
8502 * output.cc (Output_segment::set_section_list_address): Cast
8503 expressions to unsigned long long type to avoid format warnings.
8504
661be1e2
ILT
85052009-10-15 Ian Lance Taylor <iant@google.com>
8506
12edd763 8507 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 8508 dot assignment to script_sections_.
12edd763
ILT
8509 * script-sections.cc (Script_sections::add_dot_assignment):
8510 Initialize if necessary.
8511
68b6574b
ILT
8512 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8513 program headers with no load segment if there is a linker script.
8514
661be1e2
ILT
8515 * layout.cc (Layout::set_segment_offsets): Align the file offset
8516 to the segment aligment for -N or -n with no load segment.
8517 * output.cc (Output_segment::add_output_section): Don't crash if
8518 the first section is a TLS section.
8519 (Output_segment::set_section_list_addresses): Print an error
8520 message if the address moves backward in a linker script.
8521 * script-sections.cc
8522 (Output_section_element_input::set_section_addresses): Don't
8523 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8524 (Orphan_output_section::set_section_addresses): Likewise.
8525
f15f61a7
DK
85262009-10-15 Doug Kwan <dougkwan@google.com>
8527
8528 * layout.cc (Layout::finish_dynamic_section): Generate tags
8529 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8530 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8531 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8532
82bb573a
ILT
85332009-10-14 Ian Lance Taylor <iant@google.com>
8534
8535 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8536 fields.
8537 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8538 data_shdr fields of relinfo.
8539 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8540 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8541 R_386_TLS_LDO_32, adjust based on section flags.
8542 (Target_i386::Relocate::fix_up_ldo): Remove.
8543
374ad285
ILT
85442009-10-13 Ian Lance Taylor <iant@google.com>
8545
8546 Add support for -pie.
8547 * options.h (class General_options): Add -pie and
8548 --pic-executable.
8549 (General_options::output_is_position_independent): Test -pie.
8550 (General_options::output_is_executable): Return true if not shared
8551 and not relocatable.
8552 (General_options::output_is_pie): Remove.
8553 * options.cc (General_options::finalize): Reject incompatible uses
8554 of -pie.
8555 * gold.cc (queue_middle_tasks): A -pie link is not static.
8556 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8557 * symtab.cc (Symbol::final_value_is_known): Return false if
8558 output_is_position_independent.
8559 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8560 output_is_position_independent.
8561 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8562 output_is_position_independent.
8563 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8564 output_is_position_independent.
8565 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8566 two_file_pie_test.
8567 (basic_pie_test.o, basic_pie_test): New targets.
8568 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8569 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8570 (two_file_pie_test): New target.
8571 * testsuite/Makefile.in: Rebuild.
8572 * README: Remove note saying that -pie is not supported.
8573
c6585162
ILT
85742009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8575
8576 * options.h (class General_options): Add -init and -fini.
8577 * layout.cc (Layout::finish_dynamic_section): Emit
8578 given init and fini functions.
8579
032ce4e9
ST
85802009-10-13 Sriraman Tallam <tmsriram@google.com>
8581
8582 * gc.h (gc_process_relocs): Check if icf is enabled using new
8583 function.
8584 * gold.cc (queue_initial_tasks): Likewise.
8585 (queue_middle_tasks): Likewise.
8586 * object.cc (do_layout): Likewise.
8587 * symtab.cc (is_section_folded): Likewise.
8588 * main.cc (main): Likewise.
8589 * reloc.cc (Read_relocs::run): Likewise.
8590 (Sized_relobj::do_scan_relocs): Likewise.
8591 * icf.cc (is_function_ctor_or_dtor): New function.
8592 (Icf::find_identical_sections): Check if function is ctor or dtor when
8593 safe icf is chosen.
8594 * options.h (General_options::icf): Change option to be an enum.
8595 (Icf_status): New enum.
8596 (icf_enabled): New method.
8597 (icf_safe_folding): New method.
8598 (set_icf_status): New method.
8599 (icf_status_): New variable.
8600 * (options.cc) (General_options::finalize): Set icf_status_.
8601 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8602 icf_test and icf_keep_unique_test to use the --icf enum flag.
8603 * testsuite/icf_safe_test.sh: New file.
e1df38aa 8604 * testsuite/icf_safe_test.cc: New file.
032ce4e9 8605
f345227a
ST
86062009-10-12 Sriraman Tallam <tmsriram@google.com>
8607
8608 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8609 includes to gc.h and icf.h.
8610 * arm.cc: Include gc.h.
8611 * gold.cc: Likewise.
8612 * i386.cc: Likewise.
8613 * powerpc.cc: Likewise.
8614 * sparc.cc: Likewise.
8615 * x86_64.cc: Likewise.
8616 * gc.h: Include icf.h.
8617
1c7814ed
ILT
86182009-10-11 Ian Lance Taylor <iant@google.com>
8619
8620 * plugin.cc: Include "gold.h" before other header files.
8621
ae3b5189
CD
86222009-10-10 Chris Demetriou <cgd@google.com>
8623
8624 * options.h (Input_file_argument::Input_file_type): New enum.
8625 (Input_file_argument::is_lib_): Replace with...
8626 (Input_file_argument::type_): New member.
8627 (Input_file_argument::Input_file_argument): Take Input_file_type
8628 'type' rather than boolean 'is_lib' as second argument.
8629 (Input_file_argument::is_lib): Use type_.
8630 (Input_file_argument::is_searched_file): New function.
8631 (Input_file_argument::may_need_search): Handle is_searched_file.
8632 * options.cc (General_options::parse_library): Support -l:filename.
8633 (General_options::parse_just_symbols): Update for Input_file_argument
8634 changes.
8635 (Command_line::process): Likewise.
8636 * archive.cc (Archive::get_file_and_offset): Likewise.
8637 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8638 * script.cc (read_script_file, script_add_file): Likewise.
8639 * fileread.cc (Input_file::Input_file): Likewise.
8640 (Input_file::will_search_for): Handle is_searched_file.
8641 (Input_file::open): Likewise.
8642 * readsyms.cc (Read_symbols::get_name): Likewise.
8643 * testsuite/Makefile.am (searched_file_test): New test.
8644 * testsuite/Makefile.in: Regenerate.
8645 * testsuite/searched_file_test.cc: New file.
8646 * testsuite/searched_file_test_lib.cc: New file.
8647
f3048a1d
ILT
86482009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8649 Ian Lance Taylor <iant@google.com>
8650
8651 * descriptor.cc: Include <cstdio> and "binary-io.h".
8652 (Descriptors::open): Open the files in binary mode always.
8653 * script.cc (Lex::get_token): Treat \r as whitespace.
8654
d4780e57
ILT
86552009-10-09 Ian Lance Taylor <iant@google.com>
8656
8657 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8658
d9a893b8
ILT
86592009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8660 Ian Lance Taylor <iant@google.com>
8661
8662 * configure.ac: Check for readv function also.
8663 * fileread.cc (readv): Define if not HAVE_READV.
8664 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8665 does not exist.
8666 * config.in: Regenerate.
8667 * configure: Regenerate.
8668
c0a62865
DK
86692009-10-09 Doug Kwan <dougkwan@google.com>
8670
8671 * layout.cc (Layout::make_output_section): Call target hook to make
8672 ordinary output section.
8673 (Layout::finalize): Adjust parameter list of call the
8674 Target::may_relax().
8675 * layout.h (class Layout::section_list): New method.
8676 * merge.h (Output_merge_base::entsize): Change visibility to public.
8677 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8678 New methods.
8679 (Output_merge_string::do_is_string): New method.
8680 * object.cc (Sized_relobj::do_setup): renamed from
8681 Sized_relobj::set_up.
8682 * object.h (Sized_relobj::adjust_shndx,
8683 Sized_relobj::initializ_input_to_output_maps,
8684 Sized_relobj::free_input_to_output_maps): Change visibilities to
8685 protected.
8686 (Sized_relobj::setup): Virtualize.
8687 (Sized_relobj::do_setup): New method declaration.
8688 (Sized_relobj::invalidate_section_offset,
8689 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8690 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8691 * options.cc (parse_int): New function.
8692 * options.h (parse_int): New declaration.
8693 (DEFINE_int): New macro.
8694 (stub_group_size): New option.
8695 * output.cc (Output_section::Output_section): Initialize memebers
8696 merge_section_map_, merge_section_by_properties_map_,
8697 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8698 (Output_section::add_input_section): Handled deferred code-fill
8699 generation and remove an old comment.
8700 (Output_section::add_relaxed_input_section): New method definition.
8701 (Output_section::add_merge_input_section): Use merge section by
8702 properties map to speed to search. Update merge section maps
8703 as appropriate.
8704 (Output_section::build_relaxation_map): New method definition.
8705 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8706 Same.
8707 (Output_section::relax_input_section): Renamed to
8708 Output_section::convert_input_sections_to_relaxed_sections and change
8709 interface to take a vector of pointers to relaxed sections.
8710 (Output_section::find_merge_section,
8711 Output_section::find_relaxed_input_section): New method definitions.
8712 (Output_section::is_input_address_mapped,
8713 Output_section::output_offset, Output_section::output_address):
8714 Use output section data maps to speed up searching.
8715 (Output_section::find_starting_output_address): Add comments.
8716 (Output_section::do_write,
8717 Output_section::write_to_postprocessing_buffer): Do code-fill
8718 generation as appropriate.
8719 (Output_section::get_input_sections): Invalidate relaxed input section
8720 map.
8721 (Output_section::restore_states): Adjust type of checkpoint .
8722 Invalidate relaxed input section map.
8723 * output.h (Output_merge_base): New class declaration.
8724 (Input_section_specifier): New class defintion.
8725 (class Output_relaxed_input_section) Change base class to
8726 Output_section_data_build.
8727 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8728 base class initializer.
8729 (Output_section::add_relaxed_input_section): New method declaration.
8730 (Output_section::Input_section): Change visibility to protected.
2e702c99 8731 (Output_section::Input_section::relobj,
c0a62865
DK
8732 Output_section::Input_section::shndx): Handle relaxed input sections.
8733 Output_section::input_sections) Change visibility to protected. Also
8734 define overload to return a non-const pointer.
8735 (Output_section::Merge_section_properties): New class defintion.
8736 (Output_section::Merge_section_by_properties_map,
8737 Output_section::Output_section_data_by_input_section_map,
8738 Output_section::Relaxation_map): New types.
8739 (Output_section::relax_input_section): Rename method to
8740 Output_section::convert_input_sections_to_relaxed_sections and change
8741 interface to take a vector of relaxed section pointers.
8742 (Output_section::find_merge_section,
8743 Output_section::find_relaxed_input_section,
8744 Output_section::build_relaxation_map,
8745 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8746 New method declarations.
8747 (Output_section::merge_section_map_
8748 Output_section::merge_section_by_properties_map_,
8749 Output_section::relaxed_input_section_map_,
8750 Output_section::is_relaxed_input_section_map_valid_,
8751 Output_section::generate_code_fills_at_write_): New data members.
8752 * script-sections.cc
8753 (Output_section_element_input::set_section_addresses): Call
8754 current_data_size and addralign methods of relaxed input sections.
8755 (Orphan_output_section::set_section_addresses): Call current_data_size
8756 and addralign methods of relaxed input sections.
8757 * symtab.cc (Symbol_table::compute_final_value): Extract template
8758 from the body of Symbol_table::sized_finalize_symbol.
8759 (Symbol_table::sized_finalized_symbol): Call
8760 Symbol_table::compute_final_value.
8761 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8762 (Symbol_table::compute_final_value): New templated method declaration.
8763 * target.cc (Target::do_make_output_section): New method defintion.
8764 * target.h (Target::make_output_section): New method declaration.
8765 (Target::relax): Add more parameters for input objects, symbol table
8766 and layout. Adjust call to do_relax.
8767 (Target::do_make_output_section): New method declaration.
8768 (Target::do_relax): Add parameters for input objects, symbol table
8769 and layout.
8770
d446d6c4
ILT
87712009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8772
8773 * pread.c: Include stdio.h.
8774
bc06c745
ILT
87752009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8776
8777 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8778 defined.
8779
75aea3d0
ILT
87802009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8781
8782 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8783 Change read_shndx type to unsigned int.
8784 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8785 int.
8786 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8787 * dwarf_reader.h (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 * layout.cc (Layout::create_symtab_sections): Cast the result of
8793 local_symcount * symsize to off_t in the gold_assert.
8794
be8fcb75
ILT
87952009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8796
8797 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8798 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8799 R_ARM_BASE_ABS.
8800 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8801 (Arm_relocate_functions::thm_abs5): New function.
8802 (Arm_relocate_functions::abs12): New function.
8803 (Arm_relocate_functions::abs16): New function.
8804 (Arm_relocate_functions::base_abs): New function.
8805 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8806 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8807 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8808 R_ARM_BASE_ABS.
8809 (Scan::global): Likewise.
8810 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8811 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8812 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8813 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8814 R_ARM_BASE_ABS.
8815
c2a122b6
ILT
88162009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8817
8818 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8819 (Arm_relocate_functions::movt_prel): New function.
8820 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8821 (Arm_relocate_functions::thm_movt_prel): New function.
8822 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8823 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8824 (Scan::global, Relocate::relocate): Likewise.
8825 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8826
c4aa1e2d
ILT
88272009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8828
8829 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8830 Incremental_checker.
8831 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8832 unsigned int.
8833 (class Incremental_inputs_header): New class.
8834 (Incremental_inputs_header_writer): Edit comment.
8835 (Incremental_inputs_entry): New class.
8836 (Incremental_inputs_entry_writer): Edit comment.
8837 (Sized_incremental_binary::do_find_incremental_inputs_section):
8838 Add *strtab_shndx parameter, fill it.
8839 (Sized_incremental_binary::do_check_inputs): New method.
8840 (Incremental_checker::can_incrementally_link_output_file): Use
8841 Sized_incremental_binary::check_inputs.
8842 (Incremental_inputs::report_command_line): Save command line in
8843 command_line_.
8844 * incremental.h:
8845 (Incremental_binary::find_incremental_inputs_section): New
8846 method.
8847 (Incremental_binary::do_find_incremental_inputs_section): Add
8848 strtab_shndx parameter.
8849 (Incremental_binary::do_check_inputs): New pure virtual method.
8850 (Sized_incremental_binary::do_check_inputs): Declare.
8851 (Incremental_checker::Incremental_checker): Add incremental_inputs
8852 parameter, use it to initialize incremental_inputs_.
8853 (Incremental_checker::incremental_inputs_): New field.
8854 (Incremental_checker::command_line): New method.
8855 (Incremental_checker::inputs): New method.
8856 (Incremental_checker::command_line_): New field.
8857
c549a694
ILT
88582009-10-09 Mikolaj Zalewski <mikolajz@google.com>
8859
8860 * incremental.cc: Include <cstdarg> and "target-select.h".
8861 (vexplain_no_incremental): New function.
8862 (explain_no_incremental): New function.
8863 (Incremental_binary::error): New method.
8864 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8865 method.
8866 (make_sized_incremental_binary): New function.
8867 (open_incremental_binary): New function.
8868 (can_incrementally_link_file): Add checks if output is ELF and has
8869 inputs section.
8870 * incremental.h: Include "elfcpp_file.h" and "output.h".
8871 (Incremental_binary): New class.
8872 (Sized_incremental_binary): New class.
8873 (open_incremental_binary): Declare.
8874 * object.cc (is_elf_object): Use
8875 elfcpp::Elf_recognizer::is_elf_file.
8876 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8877 * output.h (Output_file::filesize): New method.
8878
fd3c5f0b
ILT
88792009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8880
8881 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8882 New function.
8883 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8884 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8885 function.
8886 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8887 function.
8888 (Arm_relocate_functions::movw_abs_nc): New function.
8889 (Arm_relocate_functions::movt_abs): New function.
8890 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8891 (Arm_relocate_functions::thm_movt_abs): New function.
8892 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8893 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8894 (Scan::global): Likewise.
8895 (Relocate::relocate): Likewise.
8896 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8897
7f5309a5
ILT
88982009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8899
8900 * arm.cc (Arm_relocate_functions::got_prel) New function.
8901 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8902 (Relocate::relocate): Likewise.
8903 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8904
364c7fa5
ILT
89052009-10-06 Ian Lance Taylor <iant@google.com>
8906
8907 * options.h (class General_options): Define
8908 split_stack_adjust_size parameter.
8909 * object.h (class Object): Add uses_split_stack_ and
8910 has_no_split_stack_ fields. Add uses_split_stack and
8911 has_no_split_stack accessor functions. Declare
8912 handle_split_stack_section.
8913 (class Reloc_symbol_changes): Define.
8914 (class Sized_relobj): Define Function_offsets. Declare
8915 split_stack_adjust, split_stack_adjust_reltype, and
8916 find_functions.
8917 * object.cc (Object::handle_split_stack_section): New function.
8918 (Sized_relobj::do_layout): Call handle_split_stack_section.
8919 * dynobj.cc (Sized_dynobj::do_layout): Call
8920 handle_split_stack_section.
8921 * reloc.cc (Sized_relobj::relocate_sections): Call
8922 split_stack_adjust for executable sections in split_stack
8923 objects. Pass reloc_map to relocate_section.
8924 (Sized_relobj::split_stack_adjust): New function.
8925 (Sized_relobj::split_stack_adjust_reltype): New function.
8926 (Sized_relobj::find_functions): New function.
8927 * target-reloc.h: Include "object.h".
8928 (relocate_section): Add reloc_symbol_changes parameter. Change
8929 all callers.
8930 * target.h (class Target): Add calls_non_split method. Declare
8931 do_calls_non_split virtual method. Declare match_view and
8932 set_view_to_nop.
8933 * target.cc: Include "elfcpp.h".
8934 (Target::do_calls_non_split): New function.
8935 (Target::match_view): New function.
8936 (Target::set_view_to_nop): New function.
8937 * gold.cc (queue_middle_tasks): Give an error if mixing
8938 split-stack and non-split-stack objects with -r.
8939 * i386.cc (Target_i386::relocate_section): Add
8940 reloc_symbol_changes parameter.
8941 (Target_i386::do_calls_non_split): New function.
8942 * x86_64.cc (Target_x86_64::relocate_section): Add
8943 reloc_symbol_changes parameter.
8944 (Target_x86_64::do_calls_non_split): New function.
8945 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8946 parameter.
8947 * powerpc.cc (Target_powerpc::relocate_section): Add
8948 reloc_symbol_changes parameter.
8949 * sparc.cc (Target_sparc::relocate_section): Add
8950 reloc_symbol_changes parameter.
8951 * configure.ac: Call AM_CONDITIONAL for the default target.
8952 * configure: Rebuild.
8953 * testsuite/Makefile.am (TEST_AS): New variable.
8954 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8955 (check_DATA): Add split_i386 and split_x86_64 files.
8956 (SPLIT_DEFSYMS): Define.
8957 (split_i386_[1234n].o): New targets.
8958 (split_i386_[124]): New targets.
8959 (split_i386_[1234r].stdout): New targets.
8960 (split_x86_64_[1234n].o): New targets.
8961 (split_x86_64_[124]): New targets.
8962 (split_x86_64_[1234r].stdout): New targets.
8963 (MOSTLYCLEANFILES): Add new executables.
8964 * testsuite/split_i386.sh: New file.
8965 * testsuite/split_x86_64.sh: New file.
8966 * testsuite/split_i386_1.s: New file.
8967 * testsuite/split_i386_2.s: New file.
8968 * testsuite/split_i386_3.s: New file.
8969 * testsuite/split_i386_4.s: New file.
8970 * testsuite/split_i386_n.s: New file.
8971 * testsuite/split_x86_64_1.s: New file.
8972 * testsuite/split_x86_64_2.s: New file.
8973 * testsuite/split_x86_64_3.s: New file.
8974 * testsuite/split_x86_64_4.s: New file.
8975 * testsuite/split_x86_64_n.s: New file.
8976 * testsuite/testfile.cc (Target_test): Update relocation_section
8977 function.
8978 * testsuite/Makefile.in: Rebuild.
8979
e8a9fcda
ILT
89802009-10-06 Ian Lance Taylor <iant@google.com>
8981
8982 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8983 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8984 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8985 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8986 the address on ldo_addrs_.
8987 (Target_i386::Relocate::fix_up_ldo): New function.
8988
e99daf92
ILT
89892009-10-06 Rafael Espindola <espindola@google.com>
8990
8991 * plugin.cc (add_input_library): New.
8992 (Plugin::load): Add add_input_library to tv.
8993 (Plugin_manager::add_input_file): Add the is_lib argument.
8994 (add_input_file): Update call to Plugin_manager::add_input_file.
8995 (add_input_library): New.
8996 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8997
966d4097
DK
89982009-09-30 Doug Kwan <dougkwan@google.com>
8999
9000 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9001 symbol and call Symbol::may_need_copy_reloc to determine if
9002 a copy reloc is needed.
9003 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9004 nocopyreloc is given in command line.
9005 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9006 given in command line.
9007 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9008 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9009 of the removed Target_i386::may_need_copy_reloc.
9010 * options.h (copyreloc): New option with default value false.
9011 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9012 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9013 instead of the removed Target_powerpc::may_need_copy_reloc.
9014 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9015 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9016 instead of the removed Target_sparc::may_need_copy_reloc.
9017 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9018 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9019 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9020 instead of the removed Target_x86_64::may_need_copy_reloc.
9021
029ba973
ILT
90222009-09-30 Ian Lance Taylor <iant@google.com>
9023
9024 * object.h (class Object): Remove target_ field, and target,
9025 sized_target, and set_target methods.
9026 (Object::sized_target): Remove.
9027 (class Sized_relobj): Update declarations. Remove sized_target.
9028 * object.cc (Sized_relobj::setup): Remove target parameter.
9029 Change all callers.
9030 (Input_objects::add_object): Don't do anything with the target.
9031 (make_elf_sized_object): Add punconfigured parameter. Change all
9032 callers. Set or test parameter target.
9033 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9034 Change all callers.
9035 * parameters.cc (Parameters::set_target): Change parameter type to
9036 be non-const.
9037 (Parameters::default_target): Remove.
9038 (set_parameters_target): Change parameter type to be non-const.
9039 (parameters_force_valid_target): New function.
9040 (parameters_clear_target): New function.
9041 * parameters.h (class Parameters): Update declarations. Remove
9042 default_target method. Add sized_target and clear_target
9043 methods. Change target_ to be non-const.
9044 (set_parameters_target): Update declaration.
9045 (parameters_force_valid_target): Declare.
9046 (parameters_clear_target): Declare.
9047 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9048 as NULL if we aren't searching.
9049 (Add_symbols::run): Don't check for compatible target.
9050 * fileread.cc (Input_file::open_binary): Call
9051 parameters_force_valid_target.
9052 * gold.cc (queue_middle_tasks): Likewise.
9053 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9054 set_target on object.
9055 * dynobj.h (class Sized_dynobj): Update declarations.
9056 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9057 make_elf_object returns NULL.
9058 (Archive::include_member): Don't check whether object target is
9059 compatible.
9060 * output.cc (Output_section::add_input_section): Get target from
9061 parameters.
9062 (Output_section::relax_input_section): Likewise.
9063 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9064 parameters.
9065 (Sized_relobj::do_scan_relocs): Likewise.
9066 (Sized_relobj::relocate_sections): Likewise.
9067 * resolve.cc (Symbol_table::resolve): Likewise.
9068 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9069 parameter. Change all callers.
9070 (Symbol_table::add_from_object): Get target from parameters.
9071 (Symbol_table::add_from_relobj): Don't check object target.
9072 (Symbol_table::add_from_dynobj): Likewise.
9073 (Symbol_table::define_special_symbol): Get target from
9074 parameters.
9075 * symtab.h (class Symbol_table): Update declaration.
9076 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9077 parameter. Change all callers. Clear parameter target.
9078 (Binary_test): Test target here.
9079 * testsuite/object_unittest.cc (gold_testsuite): Remove
9080 target_test_pointer parameter. Change all callers.
9081 (Object_test): Test target here.
9082
a6a22b83
ILT
90832009-09-26 Ian Lance Taylor <iant@google.com>
9084
9085 * testsuite/initpri1.c: Don't try to use constructor priorities if
9086 compiling with gcc before 4.3.
9087
6a8f49fe
ILT
90882009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9089
9090 * testsuite/retain_symbols_file_test.sh (check_present): Change
9091 output file name to retain_symbols_file_test.stdout.
9092 (check_absent): Likewise.
9093
8c604651
CS
90942009-09-18 Craig Silverstein <csilvers@google.com>
9095
9096 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9097 * options.cc: Include <cerrno> and <fstream>.
9098 (General_options::finalize): Parse -retain-symbols-file tag.
9099 * options.h: New flag.
9100 (General_options): New method should_retain_symbol, new
9101 variable symbols_to_retain.
9102 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9103 should_retain_symbol map.
9104 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9105 * testsuite/Makefile.in: Regenerate.
9106 * testsuite/retain_symbols_file_test.sh: New file.
9107
ca58b19f
NC
91082009-09-18 Nick Clifton <nickc@redhat.com>
9109
9110 * po/es.po: Updated Spanish translation.
9111
20e6d0d6
DK
91122009-09-17 Doug Kwan <dougkwan@google.com>
9113
9114 * debug.h (DEBUG_RELAXATION): New constant.
9115 (DEBUG_ALL): Add DEBUG_RELAXATION.
9116 (debug_string_to_enum): Add relaxation debug option.
9117 * layout.cc
9118 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9119 Layout::Relaxation_debug_check::read_sections,
9120 Layout::Relaxation_debug_check::read_sections): New method definitions.
9121 (Layout::Layout): Initialize data members
9122 record_output_section_data_from_scrips_,
9123 script_output_section_data_list_ and relaxation_debug_check_.
9124 (Layout::save_segments, Layout::restore_segments,
9125 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9126 Layout::relaxation_loop_body): New method definitions.
9127 (Layout::finalize): Support relaxation. Move section layout code to
9128 Layout::relaxation_loop_body.
9129 (Layout::set_asection_address_from_script): Move code for orphan
9130 section placement out.
9131 (Layout::place_orphan_sections_in_script): New method definition.
9132 * layout.h (Output_segment_headers, Output_file_header):
9133 New forward class declarations.
9134 (Layout::~Layout): Define.
9135 (Layout::new_output_section_data_from_script): New method definition.
9136 (Layout::place_orphan_sections_in_script): New method declaration.
9137 (Layout::Segment_states): New type declaration.
9138 (Layout::save_segments, Layout::restore_segments,
9139 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9140 Layout::relaxation_loop_body): New method declarations.
9141 (Layout::Output_section_data_list): New type declaration.
9142 (Layout::Relaxation_debug_check): New class definition.
9143 (Layout::record_output_section_data_from_script_,
9144 Layout::script_output_section_data_list_, Layout::segment_states_,
9145 Layout::relaxation_debug_check_): New data members.
9146 * output.cc: (Output_section_headers::do_size): New method definition.
9147 (Output_section_headers::Output_section_headers): Move size
9148 computation to Output_section_headers::do_size.
9149 (Output_segment_headers::do_size): New method definition.
e1df38aa 9150 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
9151 Output_file_header::do_size and call it.
9152 (Output_file_header::do_size): New method definition.
9153 (Output_data_group::Output_data_group): Adjust call to
9154 Output_section_data.
9155 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9156 (Output_symtab_xindex::do_write): Add array bound check.
2e702c99 9157 (Output_section::Input_section::print_to_mapfile): Handle
20e6d0d6
DK
9158 RELAXED_INPUT_SECTION_CODE.
9159 (Output_section::Output_section): Initialize data member checkpoint_.
9160 (Output_section::~Output_section): Delete checkpoint object pointed
9161 by checkpoint_.
9162 (Output_section::add_input_section): Always add an Input_section if
9163 relaxing.
9164 (Output_section::add_merge_input_section): Add assert.
9165 (Output_section::relax_input_section): New method definition.
9166 (Output_section::set_final_data_size): Set load address to zero for
9167 an unallocated section.
9168 (Output_section::do_address_and_file_offset_have_reset_values):
9169 New method definition.
9170 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9171 Handle relaxed input section.
9172 (Output_section::sort_attached_input_sections): Checkpoint input
9173 section list lazily.
9174 (Output_section::get_input_sections): Change type of input_sections to
9175 list of Simple_input_section pointers. Checkpoint input section list
9176 lazily. Also handle relaxed input sections.
9177 (Output_section::add_input_section_for_script): Take a reference to
9178 a Simple_input_section object instead of Relobj pointer and section
9179 index as parameter. Handle relaxed input sections.
9180 (Output_section::save_states, Output_section::restore_states): New
9181 method definitions.
9182 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9183 (Output_data::is_data_size_fixed): New method definition.
9184 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9185 if it is fixed.
9186 (Output_data::address_and_file_offset_have_reset_values): New method
9187 definition.
9188 (Output_data::do_address_and_file_offset_have_reset_values): New method
9189 definition.
9190 (Output_data::set_data_size): Check that data size is not fixed.
9191 (Output_data::fix_data_size): New method definition.
9192 (Output_data::is_data_size_fixed_): New data member.
9193 (Output_section_headers::set_final_data_size): New method definition.
9194 (Output_section_headers::do_size): New method declaration.
9195 (Output_segment_headers::set_final_data_size): New method definition.
9196 (Output_segment_headers::do_size): New method declaration.
9197 (Output_file_header::set_final_data_size)::New method definition.
9198 (Output_file_header::do_size)::New method declaration.
9199 (Output_section_data::Output_section_data): Add new parameter
9200 is_data_size_fixed and use it to fix data size.
9201 (Output_data_const::Output_data_const): Adjust call to base class
9202 constructor and fix data size.
9203 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9204 base class constructor and fix data size.
9205 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9206 base class constructor and fix data size.
9207 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9208 class constructor and fix data size.
9209 (Output_data_group::set_final_data_size): New method definition.
9210 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9211 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9212 class constructor and fix data size.
9213 (Output_relaxed_input_section): New class definition.
9214 (Output_section::Simple_input_section): New class definition.
9215 (Output_section::get_input_sections): Adjust parameter list.
9216 (Output_section::add_input_section_for_script): Same.
9217 (Output_section::save_states, Output_section::restore_states,
9218 Output_section::do_address_and_file_offset_have_reset_values,
9219 (Output_section::Input_section::Input_section): Handle
9220 RELAXED_INPUT_SECTION_CODE. Add new overload for
9221 Output_relaxed_input_section.
9222 (Output_section::Input_section::is_input_section,
9223 Output_section::Input_section::set_output_section): Handle relaxed
9224 input section.
9225 (Output_section::Input_section::is_relaxed_input_section,
9226 Output_section::Input_section::output_section_data,
9227 Output_section::Input_section::relaxed_input_section): New method
9228 definitions.
9229 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9230 value.
9231 (Output_section::Input_section::u1_): Update comments.
9232 (Output_section::Input_section::u2_): Add new union member poris.
9233 (Output_section::Checkpoint_output_section): New classs definition.
9234 (Output_section::relax_input_section): New method declaration.
9235 (Output_section::checkpoint_): New data member.
9236 (Output_segment): Update comments.
9237 (Output_segment::Output_segment): Un-privatize copy constructor.
9238 (Output_segment::operator=): Un-privatize.
9239 * script-sections.cc (Output_section_element::Input_section_list):
9240 Change element type to Output_section::Simple_input_section.
9241 (Output_section_element_dot_assignment::set_section_addresses):
9242 Register output section data for relaxation clean up.
9243 (Output_data_exression::Output_data_expression): Adjust call to base
9244 constructor to fix data size.
9245 (Output_section_element_data::set_section_addresses): Register
9246 Output_data_expression object for relaxation clean up.
9247 (struct Input_section_info): Replace Relobj pointer and section index
9248 pair with Output_section::Simple_input_section and Convert struct to a
9249 class.
9250 (Input_section_sorter::operator()): Adjust access to
e1df38aa 9251 Input_section_info data member to use accessors.
20e6d0d6
DK
9252 (Output_section_element_input::set_section_addresses): Use layout
9253 parameter. Adjust code to use Output_section::Simple_input_section
9254 and Input_secction_info classes. Register filler for relaxation
9255 clean up.
9256 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9257 and section index pair with Output_section::Simple_input_section
9258 class. Adjust code accordingly.
9259 (Phdrs_element::release_segment): New method definition.
9260 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9261 segment list.
9262 (Script_sections::release_segments): New method definition.
9263 * gold/script-sections.h (Script_sections::release_segments): New
9264 method declaration.
9265 * gold/target.h (Target::may_relax, Target::relax,
9266 Target::do_may_relax, Target::do_relax): New method definitions.
9267
5e445df6
ILT
92682009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9269
9270 * arm.cc (has_signed_unsigned_overflow): New function.
9271 (Arm_relocate_functions::abs8): New function.
9272 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9273 (Target_arm::Scan::global): Likewise.
9274 (Target_arm::relocate::relocate): Likewise.
9275 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9276 Likewise.
9277
8c604651 92782009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
9279
9280 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9281 * testsuite/Makefile.in: Regenerate.
9282
1e9cc1c2
NC
92832009-09-11 Nick Clifton <nickc@redhat.com>
9284
9285 * po/gold.pot: Updated by the Translation project.
9286
6a89f575
CC
92872009-09-08 Cary Coutant <ccoutant@google.com>
9288
9289 * output.cc (Output_file::open): Add execute permission to empty file.
9290 * testsuite/Makefile.am (permission_test): New test.
9291 * testsuite/Makefile.in: Regenerate.
9292
fdcac5af
ILT
92932009-09-02 Ian Lance Taylor <iant@google.com>
9294
9295 * output.cc (Output_file::resize): Call map_no_anonymous rather
9296 than map.
9297
44453f85
ILT
92982009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9299
9300 * gold.cc: Include "incremental.h".
9301 (queue_initial_tasks): Call Incremental_checker methods.
9302 * incremental.cc: Include "output.h".
9303 (Incremental_checker::can_incrementally_link_output_file): New
9304 method.
9305 * incremental.h (Incremental_checker): New class.
9306
9307 * output.cc (Output_file::open_for_modification): New method.
9308 (Output_file::map_anonymous): Changed return type to bool. Record
9309 map in base_ field.
9310 (Output_file::map_no_anonymous): New method, broken out of map.
9311 (Output_file::map): Use map_no_anonymous and map_anonymous.
9312 * output.h (class Output_file): Update declarations.
9313
293c1386
CC
93142009-08-24 Cary Coutant <ccoutant@google.com>
9315
9316 * options.h (Command_line::Pre_options): New class.
9317 (Command_line::pre_options): New member.
9318 * options.cc (gold::options::ready_to_register): New variable.
9319 (One_option::register_option): Do nothing if not registering options.
9320 Assert if same short option registered twice.
9321 (General_options::General_options): Turn off option registration when
9322 done constructing.
9323 (Command_line::Pre_options::Pre_options): New constructor.
9324
f773f3d2
CC
93252009-08-24 Cary Coutant <ccoutant@google.com>
9326
06a73cfe
CC
9327 * options.h (General_options::no_keep_memory): Remove incorrect
9328 short option.
f773f3d2 9329
a15af8e2
RW
93302009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9331
9332 * Makefile.am (am__skiplex, am__skipyacc): New.
9333 * Makefile.in: Regenerate.
9334
c462b41b
RW
93352009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9336
14ec8efd
RW
9337 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9338 (INCLUDES): ... this.
9339 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9340 (AM_CPPFLAGS): Renamed from ...
9341 (INCLUDE): ... this.
9342 * Makefile.in, testsuite/Makefile.in: Regenerate.
9343
81ecdfbb
RW
9344 * Makefile.in: Regenerate.
9345 * aclocal.m4: Likewise.
9346 * config.in: Likewise.
9347 * configure: Likewise.
9348 * testsuite/Makefile.in: Likewise.
9349
c462b41b
RW
9350 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9351 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9352 * Makefile.in: Regenerate.
9353 * testsuite/Makefile.in: Regenerate.
9354
2da73f13
CC
93552009-08-19 Cary Coutant <ccoutant@google.com>
9356
9357 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9358 symbols in shared libraries overridden by hidden or internal symbols
9359 in the main program.
9360
2db70501
CD
93612009-08-19 Chris Demetriou <cgd@google.com>
9362
9363 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9364 checking source file names in error messages.
9365
f733487b
DK
93662009-08-18 Doug Kwan <dougkwan@google.com>
9367
9368 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9369 an elcpp::Ehdr as parameter. Adjust call to set_target.
9370 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9371 an elfcpp::Ehdr as parameter.
9372 * object.cc (Object::set_target): Remove the version that looks up
9373 a target and sets it.
9374 (Sized_relobj::setup): Take a Target object instead of
9375 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9376 (make_elf_sized_object): Find target and ask target to
9377 make an ELF object.
9378 * object.h: (Object::set_target): Remove the version that looks up
9379 a target and sets it.
9380 (Sized_relobj::setup): Take a Target object instead of
9381 an elfcpp:Ehdr as parameter.
9382 * target.cc: Include dynobj.h.
9383 (Target::do_make_elf_object_implementation): New.
2e702c99 9384 (Target::do_make_elf_object): New.
f733487b
DK
9385 * target.h (Target::make_elf_object): New template declaration.
9386 (Target::do_make_elf_object): New method declarations.
9387 (Target::do_make_elf_object_implementation): New template declaration.
9388
cc70f101
ILT
93892009-08-14 Ian Lance Taylor <iant@google.com>
9390
9391 * gold.h (FUNCTION_NAME): Define.
9392 (gold_unreachable): Use FUNCTION_NAME.
9393
ef5e0cb1
ST
93942009-08-12 Sriraman Tallam <tmsriram@google.com>
9395
9396 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9397 symbol in the --keep-unique list is not found.
9398
48c187ce
ST
93992009-08-12 Sriraman Tallam <tmsriram@google.com>
9400
9401 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9402 been maked as --keep-unique.
9403 (Icf::unfold_section): New function.
9404 * icf.h (Icf::unfold_section): New function.
9405 * options.h (General_options::keep_unique): New option.
9406 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9407 * testsuite/Makefile.in: Regenerate.
9408 * testsuite/icf_keep_unique_test.sh: New file.
9409 * testsuite/icf_keep_unique_test.cc: New file.
9410
645afe0c
CC
94112009-08-12 Cary Coutant <ccoutant@google.com>
9412
9413 PR 10471
9414 * resolve.cc (Symbol_table::resolve): Check for references from
9415 dynamic objects to hidden and internal symbols.
9416 * testsuite/Makefile.am (hidden_test.sh): New test.
9417 * testsuite/Makefile.in: Regenerate.
9418 * testsuite/hidden_test.sh: New script.
9419 * testsuite/hidden_test_1.c: New test source.
9420 * testsuite/hidden_test_main.c: New test source.
9421
11af873f
DK
94222009-08-11 Doug Kwan <dougkwan@google.com>
9423
9424 * arm.cc: Update comments.
9425 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9426 segment to locate the .ARM.exidx section if present.
9427
b9f7d72d
DK
94282009-08-09 Doug Kwan <dougkwan@google.com>
9429
9430 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9431 patch.
9432
ddd3c53c
ST
94332009-08-07 Sriraman Tallam <tmsriram@google.com>
9434 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9435 compiler warnings.
9436
27721062
ST
94372009-08-06 Sriraman Tallam <tmsriram@google.com>
9438
9439 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9440 valid tls_segment only for non-debug-section relocations.
9441 * testsuite/Makefile.am: Add gc_tls_test.
9442 * testsuite/Makefile.in: Regenerate.
9443 * testsuite/gc_tls_test.cc: New file.
9444 * testsuite/gc_tls_test.sh: New file.
9445
ef15dade 94462009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 9447
ef15dade
ST
9448 * icf.cc: New file.
9449 * icf.h: New file.
9450 * Makefile.am (CCFILES): Add icf.cc.
9451 (HFILES): Add icf.h
9452 * Makefile.in: Regenerate.
9453 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9454 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9455 section, symbol and addend information for the relocs.
9456 * gold.cc (queue_middle_tasks): Call identical code folding.
9457 * gold.h: Add defines for multimap.
9458 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9459 to the call of finalize_local_symbols.
9460 * main.cc (main): Create object of class Icf.
9461 * object.cc (Sized_relobj::do_layout): Allow this function to be
9462 called twice during icf.
9463 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9464 to sections marked as identical by icf.
9465 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9466 when available.
9467 (Sized_relobj::do_section_entsize): New function.
9468 * object.h (Object::section_entsize): New function.
9469 (Object::do_section_entsize): New pure virtual function.
9470 (Relobj::finalize_local_symbols): Add new parameter.
9471 (Relobj::do_section_entsize): New function.
9472 * options.h (General_options::icf): New option.
9473 (General_options::icf_iterations): New option.
9474 (General_options::print_icf_sections): New option.
9475 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9476 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9477 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9478 icf.
9479 * symtab.cc (Symbol_table::is_section_folded): New function.
9480 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9481 to sections marked as identical by icf.
9482 * symtab.h (Symbol_table::set_icf): New function.
9483 (Symbol_table::icf): New function.
9484 (Symbol_table::is_section_folded): New function.
9485 (Symbol_table::icf_): New data member.
9486 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9487 * testsuite/Makefile.am: Add commands to build icf_test.
9488 * testsuite/Makefile.in: Regenerate.
9489 * testsuite/icf_test.sh: New file.
9490 * testsuite/icf_test.cc: New file.
9491
c3b65ac4
CD
94922009-07-24 Chris Demetriou <cgd@google.com>
9493
9494 * layout.cc (is_compressible_debug_section): Fix incorrect
9495 comment about compressed section names.
9496
1caf2c51
ILT
94972009-07-20 Ian Lance Taylor <ian@airs.com>
9498
9499 PR 10419
9500 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9501
1ef4d87f
ILT
95022009-07-16 Ian Lance Taylor <iant@google.com>
9503
9504 PR 10400
9505 * layout.h: #include <map>.
9506 (class Kept_section): Change from struct to class. Add accessors
9507 and setters. Add section size to Comdat_group mapping. Change
9508 Comdat_group to std::map. Add is_comdat_ field. Add
9509 linkonce_size field in union.
9510 (class Layout): Update declaration of find_or_add_kept_section.
9511 Don't declare find_kept_object.
9512 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9513 parameter. Add object, shndx, is_comdat, and is_group_name
9514 parameters. Change all callers. Adjust for new Kept_section.
9515 (Layout::find_kept_object): Remove.
9516 * object.cc (Sized_relobj::include_section_group): Update use of
9517 Kept_section. Rename secnum to shndx. Only record
9518 Kept_comdat_section if sections are the same size.
9519 (Sized_relobj::include_linkonce_section): Update use of
9520 Kept_section. Only record Kept_comdat_section if sections are the
9521 same size. Set size of linkonce section.
9522 (Sized_relobj::map_to_kept_section): Update call to
9523 get_kept_comdat_section.
9524 * object.h (class Sized_relobj): Rename fields in
9525 Kept_comdat_section to drop trailing underscores; change object
9526 field to Relobj*. Change Kept_comdat_section_table to store
9527 struct rather than pointer.
9528 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9529 Add kept_object and kept_shndx parameters. Change all callers.
9530 (Sized_relobj::get_kept_comdat_section): Change return type to
9531 bool. Add kept_object and kept_shndx parameters. Change all
9532 callers.
9533 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9534 Layout::find_or_add_kept_section.
9535
37c3b7b0
ILT
95362009-07-09 Ian Lance Taylor <iant@google.com>
9537
9538 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9539 Reserve space in the hash table.
9540
98fa85cb
ILT
95412009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9542
9543 * fileread.cc (File_read::get_mtime): New method.
9544 * fileread.h (Timespec): New structure.
9545 (File_read::get_mtime): New method.
9546 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9547 Renamed from timestamp_nsec.
9548 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9549 Elf_Xword.
e1df38aa 9550 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 9551 timestamp_nsec.
e1df38aa 9552 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
9553 (Incremental_inputs::report_obejct): Save mtime; style fix.
9554 (Incremental_inputs::report_script): Save mtime; style fix.
9555 (Incremental_inputs::finalize_inputs): Style fix.
9556 (Incremental_inputs::finalize): Style fix.
9557 (Incremental_inputs::create_input_section_data): Store inputs
9558 mtime.
9559 * incremental.h (Incremental_inputs::report_script): Add mtime
9560 argument.
9561 (Incremental_inputs::Input_info::Input_info): Intialize only one
9562 union member.
9563 (Incremental_inputs::Input_info::archive): Move to nameless
9564 union.
9565 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9566 (Incremental_inputs::Input_info::script): Move to nameless union.
9567 (Incremental_inputs::mtime): New field.
9568 * script.cc (read_input_script): Pass file mtime to
9569 Incremental_input.
9570 * script.h (Script_info::inputs): Style fix.
9571
c9d70757
ILT
95722009-07-01 Ian Lance Taylor <ian@airs.com>
9573
9574 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9575 instead of 32.
9576
9c547ec3
ILT
95772009-06-24 Ian Lance Taylor <iant@google.com>
9578
9579 PR 10156
9580 * layout.cc (Layout::choose_output_section): If we find an
9581 existing section, update the flags.
9582 (Layout::create_notes): New function, broken out of
9583 Layout::finalize.
9584 (Layout::finalize): Don't create note sections.
9585 (Layout::create_note): Don't crash if linker script discards
9586 section.
9587 (Layout::create_gold_note): Likewise.
9588 (Layout::create_build_id): Likewise. Don't set
9589 after_input_sections on the section.
9590 (Layout::create_executable_stack_info): Remove target parameter.
9591 Change caller.
9592 * layout.h (class Layout): Declare create_notes. Update
9593 declaration of create_executable_stack_info.
9594 * gold.cc (queue_middle_tasks): Call create_notes.
9595 * output.cc (Output_section::update_flags_for_input_section): Move
9596 here from output.h. If SHF_ALLOC flag is newly set, mark address
9597 invalid.
9598 * output.h (Output_data::mark_address_invalid): New function.
9599 (class Output_section): Only declare, not define,
9600 update_flags_for_input_section. Remove set_flags.
9601
55458500
ILT
96022009-06-24 Ian Lance Taylor <iant@google.com>
9603
9604 * script-sections.cc (Output_section_definition::
9605 set_section_addresses): Rename shadowing local load_address to
9606 laddr.
9607
1307d6cd
ILT
96082009-06-24 Ian Lance Taylor <iant@google.com>
9609
9610 PR 10244
9611 * reloc.cc (relocate_sections): Skip empty relocation sections.
9612
ec3f783e
ILT
96132009-06-23 Ian Lance Taylor <iant@google.com>
9614
9615 PR 10156
9616 * layout.cc (Layout::create_note): Use choose_output_section
9617 rather than make_output_section.
9618
459c9f1c
ILT
96192009-06-23 Ian Lance Taylor <iant@google.com>
9620
9621 PR 10237
9622 * options.cc (General_options::parse_V): Set printed_version_.
9623 (General_options::General_options): Initialize printed_version_.
9624 * options.h (class General_options): Add printed_version_ field.
9625 * gold.cc (queue_initial_tasks): If there are no input files,
9626 don't give a fatal error if we printed the version information.
9627 (queue_middle_tasks): If using -r with a shared object, give a
9628 fatal error rather than an ordinary error.
9629
1518dc8f
ILT
96302009-06-23 Ian Lance Taylor <iant@google.com>
9631
9632 PR 10219
9633 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9634 (Layout::make_output_section): Set have_stabstr_section_ if we see
9635 a .stab*str section.
9636 (Layout::finalize): Call link_stabs_sections.
9637 (Layout::link_stabs_sections): New file.
9638 * layout.h (class Layout): Add have_stabstr_section_ field.
9639 Declare link_stabs_sections.
9640
3d857b98
DK
96412009-06-23 Doug Kwan <dougkwan@google.com>
9642
9643 * Makefile.am (libgold_a_LIBADD): New.
9644 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2e702c99 9645 * Makefile.in: Regenerate.
3d857b98
DK
9646 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9647 * configure: Regenerate.
9648 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9649 * fileread.cc: Include sys/state.h
9650 * gold.h: Declare memmem and strndup if found missing.
9651 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9652
0639a6f6
ILT
96532009-06-23 Ian Lance Taylor <iant@google.com>
9654
9655 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9656 * configure: Rebuild.
9657
8d63875c
ILT
96582009-06-23 Ian Lance Taylor <iant@google.com>
9659
9660 PR 10147
9661 * object.cc (Object::section_contents): Don't try to get a view if
9662 the section has length zero.
9663 (Object::handle_gnu_warning_section): If the section is empty, use
9664 the name of the section as the warning.
9665
f7c8a183
ILT
96662009-06-23 Ian Lance Taylor <iant@google.com>
9667
9668 PR 10133
9669 * stringpool.h (class Stringpool_template): Add optimize_ field.
9670 (Stringpool_template::set_optimize): New function.
9671 * stringpool.cc (Stringpool_template::Stringpool_template):
9672 Initialize optimize_ field.
9673 (Stringpool_template::set_string_offsets): Test local optimize
9674 fild rather than parameter.
9675 * layout.cc (Layout::Layout): Call set_optimize on the section
9676 name stringpool.
9677
e6a307ba
ILT
96782009-06-22 Ian Lance Taylor <iant@google.com>
9679
9680 PR 10030
9681 * yyscript.y: Parse TARGET.
9682 * script.cc (script_set_target): New function.
9683 * script-c.h (script_set_target): Declare.
9684 * options.cc (General_options::string_to_object_format): Rename
9685 from string_to_object_format in anonymous namespace. Change
9686 callers.
9687 * options.h (class General_options): Declare
9688 string_to_object_format.
9689
3ee173de
ILT
96902009-06-22 Ian Lance Taylor <iant@google.com>
9691
9692 * script-sections.cc (Script_sections::create_segments): Don't put
9693 program headers in a PT_LOAD segment if -n or -N.
9694
96952009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
9696
9697 PR 10141
9698 * options.h (class General_options): Add -z lazy and -z now. Sort
9699 -z options into alphabetical order.
9700 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9701
cd6739a1 97022009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
9703
9704 * layout.cc (Layout::make_output_section): Call
9705 Target::new_output_section.
9706 (Layout::attach_allocated_section_to_segment): Put large section
9707 sections in a separate load segment with the large segment flag
9708 set.
9709 (Layout::segment_precedes): Sort large data segments after other
9710 load segments.
9711 (align_file_offset): New static function.
9712 (Layout::set_segment_offsets): Use align_file_offset.
9713 * output.h (class Output_section): Add is_small_section_ and
9714 is_large_section_ fields.
9715 (Output_section::is_small_section): New function.
9716 (Output_section::set_is_small_section): New function.
9717 (Output_section::is_large_section): New function.
9718 (Output_section::set_is_large_section): New function.
9719 (Output_section::is_large_data_section): New function.
9720 (class Output_segment): Add is_large_data_segment_ field.
9721 (Output_segment::is_large_data_segment): New function.
9722 (Output_segment::set_is_large_data_segment): New function.
9723 * output.cc (Output_section::Output_section): Initialize new
9724 fields.
9725 (Output_segment::Output_segment): Likewise.
9726 (Output_segment::add_output_section): Add assertion that large
9727 data sections always go in large data segments. Force small data
9728 sections to the end of the list of data sections. Force small BSS
9729 sections to the start of the list of BSS sections. For large BSS
9730 sections to the end of the list of BSS sections.
9731 * symtab.h (class Symbol): Declare is_common_shndx.
9732 (Symbol::is_defined): Check Symbol::is_common_shndx.
9733 (Symbol::is_common): Likewise.
9734 (class Symbol_table): Define enum Commons_section_type. Update
9735 declarations. Add small_commons_ and large_commons_ fields.
9736 * symtab.cc (Symbol::is_common_shndx): New function.
9737 (Symbol_table::Symbol_table): Initialize new fields.
9738 (Symbol_table::add_from_object): Put small and large common
9739 symbols in the right list.
9740 (Symbol_table::sized_finalized_symbol): Check
9741 Symbol::is_common_shndx.
9742 (Symbol_table::sized_write_globals): Likewise.
9743 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9744 common symbol lists. Don't call do_allocate_commons_list if the
9745 list is empty.
9746 (Symbol_table::do_allocate_commons_list): Remove is_tls
9747 parameter. Add comons_section_type parameter. Change all
9748 callers. Handle small and large common symbols.
9749 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9750 Symbol::is_common_shndx.
9751 * resolve.cc (symbol_to_bits): Likewise.
9752 * target.h (Target::small_common_shndx): New function.
9753 (Target::small_common_section_flags): New function.
9754 (Target::large_common_shndx): New function.
9755 (Target::large_common_section_flags): New function.
9756 (Target::new_output_section): New function.
9757 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9758 small_common_section_flags, and large_common_section_flags
9759 fields.
9760 (Target::do_new_output_section): New virtual function.
9761 * arm.cc (Target_arm::arm_info): Initialize new fields.
9762 * i386.cc (Target_i386::i386_info): Likewise.
9763 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9764 Likewise.
9765 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9766 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9767 (Target_x86_64::do_new_output_section): New function.
9768 * configure.ac: Define conditional MCMODEL_MEDIUM.
9769 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9770 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9771 (large_LDFLAGS): Define.
9772 * testsuite/large.c: New file.
9773 * testsuite/testfile.cc (Target_test::test_target_info):
9774 Initialize new fields.
9775 * configure, testsuite/Makefile.in: Rebuild.
9776
bb04269c
DK
97772009-06-05 Doug Kwan <dougkwan@google.com>
9778
9779 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 9780 * Makefile.in: Regenerate.
bb04269c
DK
9781 * i386.cc (class Target_i386): Define new virtual method to
9782 override do_is_local_label_name in parent.
9783 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9784 local symbols if --discard-locals or -X is given.
9785 * options.h (class General_options): Declare new options
9786 '--discard-locals' and '-X' for discarding locals.
9787 * target.h (class Target): Define new methods is_local_label_name.
9788 Declare new virtual method do_is_local_label_name.
9789 * target.cc: New file.
9790 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9791 (check_SCRIPTS): Add discard_locals_test.sh.
9792 (check_DATA): Add discard_local_tests.syms.
9793 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9794 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9795 * testsuite/Makefile.in: Regenerate.
9796 * testsuite/discard_locals_test.c: New file.
9797 * testsuite/discard_locals_test.sh: Same.
9798
805bb01c
DK
97992009-06-05 Doug Kwan <dougkwan@google.com>
9800
9801 * object.cc (Sized_relobj::Sized_relobj): Initialize
9802 discarded_eh_frame_shndx_ to -1U.
9803 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9804 section.
9805 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9806 a discarded .eh_frame section.
9807 (Sized_relobj::do_finalize_local_symbols): Ditto.
9808 * object.h (class Sized_relobj): Declare new member
9809 discarded_eh_frame_shndx_.
9810 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9811 (local_labels_test.o, local_labels_test): New rules.
9812 * testsuite/Makefile.in: Regenerate.
9813
1dcd334d
DK
98142009-06-04 Doug Kwan <dougkwan@google.com>
9815
9816 * layout.cc (Layout::section_name_mapping): Add mapping for
9817 special ARM sections.
9818
96d49306
DK
98192009-06-03 Doug Kwan <dougkwan@google.com>
9820
9821 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9822 (utils::has_overflow): Same.
9823
dff16297
ILT
98242009-06-03 Ian Lance Taylor <iant@google.com>
9825
9826 * layout.cc (Layout::section_name_mapping): New array, replacing
9827 Layout::linkonce_mapping.
9828 (Layout::section_name_mapping_count): New variable, replacing
9829 Layout::linkonce_mapping_count.
9830 (Layout::linkonce_output_name): Remove.
9831 (Layout::output_section_name): Rewrite.
9832 * layout.h (class Layout): Rename Linkonce_mapping to
9833 Section_name_mapping, linkonce_mapping to section_name_mapping,
9834 linkonce_mapping_count to section_name_mapping_count. Don't
9835 declare linkonce_output_name.
9836
c121c671
DK
98372009-06-03 Doug Kwan <dougkwan@google.com>
9838
9839 * gold/arm.cc (namespace utils): New.
9840 (Target_arm::reloc_is_non_pic): Define new method.
9841 (class Arm_relocate_functions): New.
9842 (Target_arm::Relocate::relocate): Handle relocation types used by
9843 Android.
9844
07800fab
ILT
98452009-06-03 Ian Lance Taylor <iant@google.com>
9846
9847 * arm.cc (Target_arm::scan::global): Use || instead of |.
9848
c121c671
DK
98492009-06-02 Doug Kwan <dougkwan@google.com>
9850
9851 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9852 issued_non_pic_error_.
9853 (class Target_arm::Scan): Declare new method check_non_pic.
9854 Define new method symbol_needs_plt_entry.
9855 Declare new data member issued_non_pic_error_.
9856 (class Target_arm::Relocate): Declare new method
9857 should_apply_static_reloc.
9858 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9859 (Target_arm::Scan::check_non_pic): Define new method.
9860 (Target_arm::Scan::local): Handle a small subset of reloc types used
9861 by Android.
9862 (Target_arm::Scan::local): Same.
9863 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9864
b19b0c6d
ILT
98652009-05-31 Mikolaj Zalewski <mikolajz@google.com>
9866
9867 * incremental.cc (Incremental_inputs::report_command_line): Filter
9868 out --incremental-* options.
9869
94cdfcff
DK
98702009-05-29 Doug Kwan <dougkwan@google.com>
9871
9872 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9873 template class.
9874 (class Target_arm): Update comment.
9875 (Target_arm::Target_arm): Initialize new data members GOT_,
9876 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9877 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9878 and Target_arm::rel_dyn_section.
9879 Declare new_enum Target_arm::Got_type.
9880 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9881 and DYNBSS_.
9882 Update commments for member do_dynsym_value.
9883 (Target_arm::got_size, Target_arm::plt_section,
9884 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9885 new methods inside class defintion.
9886 (Target_arm::got_section): Define new method.
9887 (Target_arm::rel_dyn_section): Same.
9888 (Output_data_plt_arm): New template class.
9889 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9890 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9891 (Output_data_plt_arm::add_entry): Same.
9892 (Output_data_plt_arm::first_plt_entry): Define new
9893 static data member for PLT instruction template.
9894 (Output_data_plt_arm::plt_entry): Same.
9895 (Output_data_plt_arm::do_write): Define new method.
9896 (Target_arm::make_plt_entry): Same.
9897 (Target_arm::do_finalize_sections): Same.
9898 (Target_arm::do_dynsym_value): Same.
9899
4a657b0d
DK
99002009-05-28 Doug Kwan <dougkwan@google.com>
9901
9902 * Makefile.am (TARGETSOURCES): Add arm.cc.
9903 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9904 * Makefile.in: Regenerate.
9905 * arm.cc: New file.
9906 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9907
e7ae8c36
DK
99082009-05-26 Doug Kwan <dougkwan@google.com>
9909
9910 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9911 (General_options::check_excluded_libs): Strip off directories in
9912 archive name before matching like GNU ld does.
9913 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9914 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9915 (exclude_libs_test_LDFLAGS): Add linker option
9916 -Wl,--exclude-libs,libexclude_libs_test_3
9917 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9918 an explicit archive without using -l.
9919 (alt/libexclude_libs_test_3.a): New make rule.
9920 * testsuite/Makefile.in: Regenerate.
9921 * testsuite/exclude_libs_test.c : Declare lib3_default().
9922 (main): Call it.
9923 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9924 * exclude_libs_test_3.c: New file.
9925
f12e7348
NC
99262009-05-26 Nick Clifton <nickc@redhat.com>
9927
9928 * po/id.po: New Indonesian translation.
9929 * po/gold.pot: Updated template file.
9930
4daadc0d
ST
99312009-05-22 Sriraman Tallam <tmsriram@google.com>
9932
e1df38aa 9933 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
9934 gc_comdat_test files. Add -Wl,--gc-sections to build
9935 gc_comdat_test.
9936 * testsuite/Makefile.in: Regenerate.
9937 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9938
531813ad
ST
99392009-05-21 Sriraman Tallam <tmsriram@google.com>
9940
9941 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9942 kept comdat section was garbage collected.
9943 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9944 * testsuite/Makefile.in: Regenerate.
9945 * testsuite/gc_comdat_test.sh: New file.
9946 * testsuite/gc_comdat_test_1.cc: New file.
9947 * testsuite/gc_comdat_test_2.cc: New file.
9948
65514900
CC
99492009-05-19 Doug Kwan <dougkwan@google.com>
9950
9951 * archive.cc (Archive::Archive): Move constructor from archive.h
9952 to here. Initialize no_export_.
9953 (Archive::get_elf_object_for_member): Set no_export flag of object.
9954 * archive.h (Archive::Archive): Move constructor body to
9955 archive.cc.
9956 (Archive::no_export): New method.
9957 (Archive::no_export_): New field.
9958 * object.h (Object::Object): Initialize no_export_ to false.
9959 (Object::no_export, Object::set_no_export): New methods.
9960 (Object::no_export_): New field.
9961 * options.cc (General_options::parse_exclude_libs): New method.
9962 (General_options::check_excluded_libs) Same.
9963 * options.h (exclude_libs): New option.
9964 (General_options::check_excluded_libs): New method declaration.
9965 (General_options::excluded_libs_): New field.
9966 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9967 default or protected visibility if an object has no-export flag set.
9968 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9969 (check_SCRIPTS): Add exclude_libs_test.sh.
9970 (check_DATA): Add exclude_libs_test.syms.
9971 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9972 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9973 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9974 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9975 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9976 libexclude_libs_test_2.a): New rules.
9977 * testsuite/Makefile.in: Regenerate.
9978 * testsuite/exclude_libs_test.c: New file.
9979 * testsuite/exclude_libs_test.sh: Ditto.
9980 * testsuite/exclude_libs_test_1.c: Ditto.
9981 * testsuite/exclude_libs_test_2.c: Ditto.
9982
1b77ea50
ILT
99832009-05-15 Ian Lance Taylor <iant@google.com>
9984
9985 * configure.ac: Check for declarations for cases where libiberty.h
9986 checks HAVE_DECL_xxx.
9987 * configure, config.in: Rebuild.
9988
072fe7ce
ILT
99892009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9990
9991 * gold.h (Incremental_argument_list): Remove (invalid) forward
9992 declaration.
9993 * incremental.cc (Incremental_inputs::report_achive): New method.
9994 (Incremental_inputs::report_object): New method.
9995 (Incremental_inputs::report_script): New method.
9996 (Incremental_inputs::finalize_inputs): New method.
9997 (Incremental_inputs::finalize): Call finalize_inputs().
9998 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9999 Create inputs entries.
10000 * incremental.h (Incremental_input_type): New enum.
10001 (Incremental_inputs::Incremental_input): Initialize new fields.
10002 (Incremental_inputs::report_inputs): New method.
10003 (Incremental_inputs::report_achive): New method.
10004 (Incremental_inputs::report_object): New method.
10005 (Incremental_inputs::report_script): New method.
10006 (Incremental_inputs::finalize_inputs): New method.
10007 (Incremental_inputs::Input_info): New struct.
10008 (Incremental_inputs::Input_info_map): New typedef.
10009 (Incremental_inputs::lock_): New field.
10010 (Incremental_inputs::Inputs_): New field.
10011 (Incremental_inputs::Inputs_map): New field.
10012 * main.cc (main): Call Incremental_input::report_inputs.
10013 * options.h (Input_argument_list): Typedef moved from
10014 Input_arguments.
10015 (Input_file_group::Files): Remove, use ::Input_argument_list.
10016 (Input_file_group::Input_argument_list): Remove, use
10017 ::Input_argument_list.
10018 * plugin.cc (Plugin_manager::add_input_file): Add error in
10019 incremental build.
10020 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10021 functions.
10022 * script.cc (read_input_script): Call
10023 Incremental_input::report_script.
10024 * script.h (Script_info): New class.
10025
b0481b0b
ILT
100262009-04-27 Ian Lance Taylor <iant@google.com>
10027
10028 * x86_64.cc (do_adjust_output_section): Set entsize to
10029 plt_entry_size.
10030
b22a5a41 100312009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
10032
10033 * output.cc (Output_file::close): After short writes, continue
10034 writing from the correct offset in the buffer being written.
10035
40fde488
CD
100362009-04-23 Chris Demetriou <cgd@google.com>
10037
10038 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10039 * configure: Regenerate.
10040 * config.in: Regenerate.
10041 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10042 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10043
3ce2c28e
ILT
100442009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10045
10046 * incremental.cc (Incremental_inputs_header_data): Renamed from
10047 Incremental_input_header_data.
10048 (Incremental_inputs_header_data::data_size): New field.
10049 (Incremental_inputs_header_data::put_input_file_count): Renamed
10050 from input_file_count.
10051 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10052 from command_line_offset.
10053 (Incremental_inputs_header_data::put_reserved): Renamed from
10054 put_reserved.
10055 (Incremental_inputs_entry_data): Renamed from
10056 Incremental_input_entry_data.
10057 (Incremental_inputs_entry_data::data_size): New field.
10058 (Incremental_inputs::report_command_line): New method.
10059 (Incremental_inputs::finalize): New method.
10060 (Incremental_inputs::create_incremental_inputs_data): New method.
10061 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10062 * incremental.h: New file.
10063 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10064 (Layout::finalize): Create incremental inputs section in
10065 incremental builds.
10066 (Layout::create_incremental_info_sections): New method.
10067 * layout.h (Layout::incremental_inputs): New method.
10068 (Layout::create_incremental_info_sections): New method.
10069 (Layout::incremental_inputs_): New field.
10070 * main.cc (main): Notify Incremental_input of the command line.
10071
e55bde5e
ILT
100722009-04-01 Ian Lance Taylor <iant@google.com>
10073 Mikolaj Zalewski <mikolajz@google.com>
10074
10075 * gold.h (reserve_unordered_map): Define, three versions, one for
10076 each version of Unordered_map.
10077 * layout.cc (Layout::Layout): Remove options parameter. Add
10078 number_of_input_files parameter. Don't initialize options_.
10079 Initialize number_of_input_files_ and resized_signatures_. Move
10080 sections_are_attached_.
10081 (Layout::layout_group): Reserve space for group_signatures_.
10082 (Layout::find_or_add_kept_section): Change name parameter to be a
10083 reference. Resize signatures_ map when it gets large enough.
10084 (Layout::layout_eh_frame): Use parameters->options() instead of
10085 this->options_.
10086 (Layout::make_output_section): Likewise.
10087 (Layout::attach_allocated_section_to_segment): Likewise.
10088 (Layout::finalize, Layout::create_executable_stack): Likewise.
10089 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10090 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10091 * layout.h (class Layout): Update declarations. Remove options_
10092 field. Add number_of_input_files_ and resized_signatures_
10093 fields. Move sections_are_attached_ field.
10094 * main.cc (main): Pass number of input files to Layout
10095 constructor. Don't pass options.
10096
154b857c
ILT
100972009-03-30 Ian Lance Taylor <iant@google.com>
10098
10099 * ffsll.c (ffsll): Correct implementation.
10100
2f35ab9b
ILT
101012009-03-27 Ian Lance Taylor <iant@google.com>
10102
fd03461a
ILT
10103 * ffsll.c: New file.
10104 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10105 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10106 * ftruncate.c (ftruncate): Declare before definition.
10107 * mremap.c (mremap): Likewise.
10108 * pread.c (pread): Likewise.
10109 * configure, Makefile.in, config.in: Rebuild.
10110
2f35ab9b
ILT
10111 * mremap.c: New file.
10112 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10113 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10114 (mremap): Declare if HAVE_MREMAP is not defined.
10115 * configure, Makefile.in, config.in: Rebuild.
10116
33aea2fd
CC
101172009-03-27 Cary Coutant <ccoutant@google.com>
10118
10119 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10120 position independent.
10121 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10122 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10123
6d479619
CC
101242009-03-24 Cary Coutant <ccoutant@google.com>
10125
10126 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10127 an executable.
10128 (needs_dynamic_reloc): Likewise.
10129
afc06bb8
ILT
101302009-03-24 Ian Lance Taylor <iant@google.com>
10131
10132 * yyscript.y (file_cmd): Recognize EXTERN.
10133 (extern_name_list, extern_name_list_body): New nonterminals.
10134 * script.cc (script_add_extern): Define.
10135 * script-c.h (script_add_extern): Declare.
10136
f6060a4d
ILT
101372009-03-24 Rafael Avila de Espindola <espindola@google.com>
10138
10139 * object.cc (is_elf_object): Define.
10140 * object.h (is_elf_object): Declare.
10141 * archive.cc (Archive::get_elf_object_for_member): Call
10142 is_elf_object.
33aea2fd 10143 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 10144
26736d8e
ILT
101452009-03-24 Elliott Hughes <enh@google.com>
10146
10147 * output.cc (Output_file::map_anonymous): Define.
10148 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10149 try an anonymous one. Report the size if the mmap fails.
10150 * output.h (class Output_file): Declare map_anonymous.
10151
22fd9730
ILT
101522009-03-24 Ian Lance Taylor <iant@google.com>
10153
10154 * target-select.cc (instantiate_target): Don't acquire the lock if
10155 the instantiated_target_ field has already been set.
10156
cb010894
ILT
101572009-03-23 Ian Lance Taylor <iant@google.com>
10158
7f055c20
ILT
10159 * gold-threads.h (class Initialize_lock): Define.
10160 * gold-threads.cc (class Initialize_lock_once): Define.
10161 (initialize_lock_control): New static variable.
10162 (initialize_lock_pointer): New static variable.
10163 (initialize_lock_once): New static function.
10164 (Initialize_lock::Initialize_lock): Define.
10165 (Initialize_lock::initialize): Define.
10166 * target-select.h: Include "gold-threads.h".
10167 (class Target_selector): Add lock_ and initialize_lock_ fields.
10168 Don't define instantiate_target, just declare it.
10169 * target-select.cc (Target_selector::Target_selector): Initialize
10170 new fields.
10171 (Target_selector::instantiate_target): Define.
10172 * descriptors.h: Include "gold-threads.h".
10173 (class Descriptors): Add initialize_lock_ field.
10174 * descriptors.cc (Descriptors::Descriptors): Initialize new
10175 field.
10176 (Descriptors::open): Use initialize_lock_ field
10177 * errors.h (class Errors): Add initialize_lock_ field.
10178 * errors.cc (Errors::Errors): Initialize new field.
10179 (Errors::initialize_lock): Use initialize_lock_ field.
10180 * powerpc.cc (class Target_selector_powerpc): Remove
10181 instantiated_target_ field. In do_recognize call
10182 instantiate_target rather than do_instantiate_target. In
10183 do_instantiate_target just allocate a new target.
10184 * sparc.cc (class Target_selector_sparc): Likewise.
10185
36959681
ILT
10186 * freebsd.h: New file.
10187 * i386.cc: Include "freebsd.h".
10188 (Target_i386): Derive from Target_freebsd rather than
10189 Sized_target.
10190 (Target_selector_i386): Derive from Target_selector_freebsd rather
10191 than Target_selector.
10192 * x86_64.cc: Include "freebsd.h".
10193 (Target_x86_64): Derive from Target_freebsd rather than
10194 Sized_target.
10195 (Target_selector_x86_64): Derive from Target_selector_freebsd
10196 rather than Target_selector.
10197 * target.h (class Target): Add adjust_elf_header and
10198 do_adjust_elf_header.
10199 * output.cc (Output_file_header:: do_sized_write): Call target
10200 adjust_elf_header routine.
10201 * configure.tgt: Set targ_osabi.
10202 * configure.ac: Define GOLD_DEFAULT_OSABI.
10203 * parameters.cc (Parameters::default_target): Pass
10204 GOLD_DEFAULT_OSABI to select_target.
10205 * target-select.h (class Target_selector): Make instantiate_target
10206 protected rather than private.
10207 * Makefile.am (HFILES): Add freebsd.h.
10208 * configure, Makefile.in, config.in: Rebuild.
10209
cb010894
ILT
10210 * merge.cc (do_add_input_section): Correct pend value. Change
10211 message about last entry not being null terminated from error to
10212 warning.
10213
0e879927
ILT
102142009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10215
10216 * incremental.cc: New file.
10217 * Makefile.am (CCFILES): Add incremental.cc.
10218 * Makefile.in: Rebuild.
10219
41105937
PP
102202009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10221
10222 * layout.cc (Layout::output_section_name): Preserve names
10223 of '.note.' sections.
e1df38aa 10224
60439920
ILT
102252009-03-19 Ian Lance Taylor <iant@google.com>
10226
10227 * descriptors.cc (Descriptors::open): Check that the options are
10228 valid before using them.
10229
0d371ad3
ILT
102302009-03-18 Ian Lance Taylor <iant@google.com>
10231
10232 * script-sections.h: Include <list>.
10233 (class Script_sections): Change Sections_elements from std::vector
10234 to std::list. Typedef public Elements_iterator. Add
10235 orphan_section_placement_, data_segment_align_start_, and
10236 saw_data_segment_align_ fields. Remove data_segment_align_index_
10237 field.
10238 * script-sections.cc (class Orphan_section_placement): New class.
10239 (class Sections_element): Add virtual functions is_relro and
10240 orphan_section_init. Remove virtual function place_orphan_here.
10241 (class Output_section_definition): Add is_relro and
10242 orphan_section_init. Remove place_orphan_here.
10243 (class Orphan_output_section): Likewise.
10244 (Script_sections::Script_sections): Update for field changes.
10245 (Script_sections::data_segment_align): Set saw_data_segment_align_
10246 and data_segment_align_start_, not data_segment_align_index.
10247 (Script_sections::data_segment_relro_end): Check
10248 saw_data_segment_align_. Use data_segment_align_start_ rather
10249 than data_segment_align_index_.
10250 (Script_sections::place_orphan): Rewrite to use
10251 Orphan_section_placement.
10252
9201d894
ILT
102532009-03-17 Ian Lance Taylor <iant@google.com>
10254
9c5b8369
ILT
10255 * archive.cc (Archive::add_symbols): Check for a version attached
10256 to the symbol name in the archive map.
10257 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10258 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10259 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10260 (ver_test_11.a): New target.
10261 * testsuite/Makefile.in: Rebuild.
10262
9201d894
ILT
10263 * configure.ac: Check for chsize and posix_fallocate. Replace
10264 ftruncate.
10265 * ftruncate.c: New file, from gnulib.
10266 * output.cc (posix_fallocate): Define dummy version if not
10267 HAVE_POSIX_FALLOCATE.
10268 (Output_file::map): Call posix_fallocate rather than lseek and
10269 write.
10270 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10271 * configure, Makefile.in, config.in: Rebuild.
10272
ef4ab7a8 102732009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 10274
ef4ab7a8
PP
10275 * layout.h (Layout::create_note): Add section_name parameter.
10276 * layout.cc (Layout::create_note): Likewise.
10277 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 10278
8c500701
ILT
102792009-03-17 Ian Lance Taylor <iant@google.com>
10280
e85b18e1
ILT
10281 * descriptors.cc: Include "options.h".
10282 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10283 (Descriptors::open): Always use O_CLOEXEC when opening a new
10284 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10285 then set FD_CLOEXEC.
10286
9efe6174
ILT
10287 * sparc.cc (class Target_sparc): Add has_got_section.
10288 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10289 make sure we have a GOT section.
10290
10291 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10292 (Target_sparc::Scan::local): Likewise.
10293 (Target_sparc::Scan::global): Likewise.
10294 (Target_sparc::Relocate::relocate): Likewise.
10295 (Target_sparc::Relocate::relocate_tls): Likewise.
10296
8c500701
ILT
10297 * symtab.cc (Symbol_table::define_default_version): New function,
10298 broken out of add_from_object.
10299 (Symbol_table::add_from_object): Call define_default_version.
10300 (Symbol_table::define_special_symbol): Add resolve_oldsym
10301 parameter. Change all callers. If the version for a symbol comes
10302 from a version script, resolve it with the symbol with the same
10303 name with no version. Also add the symbol without a version if
10304 appropriate.
10305 (do_define_in_output_data): If resolving with oldsym, don't delete
10306 sym.
10307 (do_define_in_output_segment): Likewise.
10308 (do_define_as_constant): Likewise.
10309 * symtab.h (class Symbol_table): Update declarations.
10310
f1ed28fb
ILT
103112009-03-13 Ian Lance Taylor <iant@google.com>
10312
15f8229b
ILT
10313 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10314 (Read_symbols::requeue): New function.
10315 (Read_symbols::do_read_symbols): If make_elf_object fails because
10316 the target type is not configured, and the file was searched for,
10317 issue a warning and retry with the next directory.
10318 (Add_symbols::run): If the file has an incompatible format, and
10319 it was searched for, requeue the Read_symbols task. On error,
10320 release the object.
10321 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10322 dirindex parameter to constructor. Change all callers. Declare
10323 incompatible_warning and requeue.
10324 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10325 input_argument_ and input_group_ fields. Add them to
10326 constructor. Change all callers.
10327 (class Read_script): Add dirindex_ field. Add it to constructor.
10328 Change all callers.
10329 * archive.cc (Archive::setup): Remove input_objects parameter.
10330 Change all callers.
10331 (Archive::get_file_and_offset): Likewise.
10332 (Archive::read_all_symbols): Likewise.
10333 (Archive::read_symbols): Likewise.
10334 (Archive::get_elf_object_for_member): Remove input_objects
10335 parameter. Add punconfigured parameter. Change all callers.
10336 (Archive::add_symbols): Change return type to bool. Check return
10337 value of include_member.
10338 (Archive::include_all_members): Likewise.
10339 (Archive::include_member): Change return type to bool. Return
10340 false if first included object has incompatible target. Set
10341 included_member_ field.
10342 (Add_archive_symbols::run): If add_symbols returns false, requeue
10343 Read_symbols task.
10344 * archive.h (class Archive): Add included_member_ field.
10345 Initialize it in constructor. Add input_file and searched_for
10346 methods. Update declarations.
10347 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10348 input_argument_ fields. Add them to constructor. Change all
10349 callers.
10350 * script.cc: Include "target-select.h".
10351 (class Parser_closure): Add skip_on_incompatible_target_ and
10352 found_incompatible_target_ fields. Add
10353 skip_on_incompatible_target parameter to constructor. Change all
10354 callers. Add methods skip_on_incompatible_target,
10355 clear_skip_on_incompatible_target, found_incompatible_target, and
10356 set_found_incompatible_target.
10357 (read_input_script): Add dirindex parameter. Change all callers.
10358 If parser finds an incompatible target, requeue Read_symbols
10359 task.
10360 (script_set_symbol): Clear skip_on_incompatible_target in
10361 closure.
10362 (script_add_assertion, script_parse_option): Likewise.
10363 (script_start_sections, script_add_phdr): Likewise.
10364 (script_check_output_format): New function.
10365 * script.h (read_input_script): Update declaration.
10366 * script-c.h (script_check_output_format): Declare.
10367 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10368 (ignore_cmd): Remove OUTPUT_FORMAT.
10369 * fileread.cc (Input_file::Input_file): Add explicit this.
10370 (Input_file::will_search_for): New function.
10371 (Input_file::open): Add pindex parameter. Change all callers.
10372 * fileread.h (class Input_file): Add input_file_argument method.
10373 Declare will_search_for. Update declarations.
10374 * object.cc (make_elf_object): Add punconfigured parameter.
10375 Change all callers.
10376 * object.h (class Object): Make input_file public. Add
10377 searched_for method.
10378 (make_elf_object): Update declaration.
10379 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10380 restart search.
10381 * dirsearch.h (class Dirsearch): Update declaration.
10382 * options.h (class General_options): Add --warn-search-mismatch.
10383 * parameters.cc (Parameters::is_compatible_target): New function.
10384 * parameters.h (class Parameters): Declare is_compatible_target.
10385 * workqueue.cc (Workqueue::add_blocker): New function.
10386 * workqueue.h (class Workqueue): Declare add_blocker.
10387
f1ed28fb
ILT
10388 * fileread.cc (Input_file::open): Remove options parameter.
10389 Change all callers.
10390 (Input_file::open_binary): Likewise.
10391 * script.cc (read_input_script): Likewise.
10392 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10393 options parameter from constructor. Change all callers.
10394 (class Read_script): Likewise.
10395 * fileread.h (class Input_file): Update declarations.
10396 * script.h (read_input_script): Update declaration.
10397
34dd024a
NC
103982009-03-10 Nick Clifton <nickc@redhat.com>
10399
10400 * po/es.po: New Spanish translation.
10401
6d71b17c
CC
104022009-03-06 Cary Coutant <ccoutant@google.com>
10403
10404 * options.cc (parse_short_option): Keep dash_z from registering itself.
10405
031cdbed
ILT
104062009-03-03 Ian Lance Taylor <iant@google.com>
10407
10408 PR 9918
10409 * target-reloc.h (relocate_section): Pass output_section to
10410 relocate.
10411 * i386.cc (Target_i386::should_apply_static_reloc): Add
10412 output_section parameter. Change all callers.
10413 (Target_i386::Relocate::relocate): Add output_section parameter.
10414 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10415 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10416 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10417 * testsuite/two_file_shared.sh: New script.
10418 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10419 (check_DATA): Add two_file_shared.dbg.
10420 (two_file_shared.dbg): New target.
10421 * testsuite/Makefile.in: Rebuild.
10422
15d5fa16
ILT
104232009-03-01 Ian Lance Taylor <iant@google.com>
10424
10425 * configure.ac: Check for byteswap.h.
10426 * configure: Rebuild.
10427 * config.in: Rebuild.
10428
8a4c0b0d
ILT
104292009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10430
10431 * layout.cc (Layout::find_or_add_kept_section): New function.
10432 (Layout::add_comdat): Removed.
10433 * layout.h (struct Kept_section): Move out of class Layout.
10434 Remove trailing underscores from field names. Add group_sections
10435 field. Rename group_ field to is_group. Change all uses.
10436 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10437 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10438 comdat_groups_ field.
10439 (Sized_relobj::include_section_group): Use
10440 find_or_add_kept_section and Kept_section::group_sections.
10441 (Sized_relobj::include_linkonce_section): Likewise.
10442 * object.cc (class Sized_relobj): Don't define Comdat_group or
10443 Comdat_group_table. Remove find_comdat_group and
10444 add_comdat_group. Remove comdat_groups_ field.
10445 * plugin.cc (include_comdat_group): Use
10446 Layout::find_or_add_kept_section.
10447
b4ecf66b
ILT
104482009-02-28 Ian Lance Taylor <iant@google.com>
10449
14359ca0
ILT
10450 * README: --gc-sections and map files are now supported. Document
10451 some build requirements.
10452
b4ecf66b
ILT
10453 PR 6992
10454 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10455 relocatable link set the value of the section symbol to zero.
10456 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10457 relocatable link don't include the section address in the local
10458 symbol value.
10459
0602e05a
ILT
104602009-02-27 Ian Lance Taylor <iant@google.com>
10461
fd9d194f
ILT
10462 PR 6811
10463 * options.h (class Search_directory): Add is_system_directory.
10464 (class General_options): Declare is_in_system_directory.
10465 * options.cc (get_relative_sysroot): Make static.
10466 (get_default_sysroot): Make static.
10467 (General_optoins::is_in_system_directory): New function.
10468 * fileread.cc (Input_file::is_in_system_directory): New function.
10469 * fileread.h (class Input_file): Declare is_in_system_directory.
10470 * object.h (class Object): Add is_in_system_directory.
10471 (class Input_objects): Remove system_library_directory_ field.
10472 * object.cc (Input_objects::add_object): Don't set
10473 system_library_directory_.
10474 (input_objects::found_in_system_library_directory): Remove.
10475 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10476 parameter. Change all callers.
10477 (Symbol_table::sized_write_globals): Likewise.
10478 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10479 Call Object::is_in_system_directory.
10480 * symtab.h (class Symbol_table): Update declarations.
10481
61edd21f
ILT
10482 PR 5990
10483 * descriptors.h (Open_descriptor): Add is_on_stack field.
10484 * descriptors.cc (Descriptors::open): If the descriptor is on the
10485 top of the stack, remove it. Initialize is_on_stack field.
10486 (Descriptors::release): Only add pod to stack if it is not on the
10487 stack already.
10488 (Descriptors::close_some_descriptor): Clear stack_next and
10489 is_on_stack fields.
10490
e29e076a
ILT
10491 PR 7091
10492 * output.cc (Output_section::find_starting_output_address): Rename
10493 from starting_output_address; add PADDR parameter; change return
10494 type.
10495 * output.h (class Output_section): Declare
10496 find_starting_output_address instead of starting_output_address.
10497 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10498 section symbol for which we can't find a merge section.
10499
0602e05a
ILT
10500 PR 9836
10501 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10502 hidden or internal, force the symbol to be local.
10503 * resolve.cc (Symbol::override_visibility): Define.
10504 (Symbol::override_base): Use override_visibility.
10505 (Symbol_table::resolve): Likewise.
10506 (Symbol::override_base_with_special): Likewise.
10507 (Symbol_table::override_with_special): If the visibility is hidden
10508 or internal, force the symbol to be local.
10509 * symtab.h (class Symbol): Add set_visibility and
10510 override_visibility.
10511 * testsuite/ver_test_1.sh: New file.
10512 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10513 (check_DATA): Add ver_test_1.syms.
10514 (ver_test_1.syms): New target.
10515 * testsuite/Makefile.in: Rebuild.
10516
401a9a73
CC
105172009-02-25 Cary Coutant <ccoutant@google.com>
10518
10519 * layout.cc (Layout::choose_output_section): Don't rename sections
10520 when using a linker script that has a SECTIONS clause.
10521 * Makefile.in: Regenerate.
10522
10523 * testsuite/Makefile.am (script_test_5.sh): New test case.
10524 * testsuite/Makefile.in: Regenerate.
10525 * testsuite/script_test_5.cc: New file.
10526 * testsuite/script_test_5.sh: New file.
10527 * testsuite/script_test_5.t: New file.
10528
f488e4b0
CC
105292009-02-13 Rafael Avila de Espindola <espindola@google.com>
10530
10531 * archive.cc (Archive::include_member): Update calls to add_symbols.
10532 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10533 the Layout argument.
10534 * dynobj.h (do_add_symbols): Add the Layout argument.
10535 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10536 Layout argument.
10537 * object.h (Object::add_symbols): Add the Layout argument.
10538 (Object::do_add_symbols): Add the Layout argument.
10539 (Sized_relobj::do_add_symbols): Add the Layout argument.
10540 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10541 Unify the two versions.
10542 (Add_plugin_symbols): Remove.
10543 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10544 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10545 (Add_plugin_symbols): Remove.
10546 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10547 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10548 (Add_symbols::run): Make it work with Pulginobj.
10549
89dd1680
ILT
105502009-02-06 Ian Lance Taylor <iant@google.com>
10551
10552 * object.cc (Sized_relobj::do_layout): Make info message start
10553 with lower case letter.
10554
266d0a74
ILT
105552009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10556
602b464e
ILT
10557 * binary.cc: Fix file comment.
10558
266d0a74
ILT
10559 * options.h (enum Incremental_disposition): Define.
10560 (class General_options): Add new options: --incremental,
10561 --incremental_changed, --incremental_unchanged,
10562 --incremental_unknown. Add incremental_disposition_ and
10563 implicit_incremental_ fields.
10564 (General_options::incremental_disposition): New function.
10565 (class Position_dependent_options): Add incremental_disposition
10566 option.
10567 (Position_dependent_options::copy_from_options): Set incremental
10568 dispositions.
10569 * options.cc (General_options::parse_incremental_changed): New
10570 function.
2e702c99
RM
10571 (General_options::parse_incremental_unchanged): New function.
10572 (General_options::parse_incremental_unknown): New function.
10573 (General_options::General_options): Initialize new fields
266d0a74 10574 incremental_disposition_ and implicit_incremental_.
2e702c99 10575 (General_options::finalize): Check for uasge of --incremental-*
266d0a74
ILT
10576 without --incremental.
10577
f073bbf7
CD
105782009-02-06 Chris Demetriou <cgd@google.com>
10579
10580 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10581 pointer and to report location as the file name associated with
10582 the symbol.
10583 (gold_undefined_symbol_at_location): New function to replace the
10584 old gold_undefined_symbol functionality.
10585 * target-reloc.h (relocate_section): Update to use
10586 gold_undefined_symbol_at_location.
10587 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10588 Call gold_undefined_symbol function rather than gold_error.
10589 * errors.h (Errors::undefined_symbol): Take location as a
10590 string, rather than calculating it from a relocation.
10591 * errors.cc (Errors::fatal): Print "fatal error:" before the
10592 formatted message.
10593 (Errors::error, Errors::error_at_location): Print "error: "
10594 before the formatted message.
10595 (Errors::undefined_symbol): Take location as a string, rather
10596 than calculating it from a relocation.
10597 (gold_undefined_symbol_at_location): New function akin to
10598 old gold_undefined_symbol, calculates location from relocation.
10599 (gold_undefined_symbol): Change to take only a Symbol pointer
10600 and to report location as the file name associated with the symbol.
10601 * testsuite/debug_msg.sh: Update for changed error messages.
10602 * testsuite/undef_symbol.sh: Likewise.
10603
8e94a90c
ILT
106042009-02-04 Duncan Sands <baldrick@free.fr>
10605
10606 PR 9812
10607 * reduced_debug_output.h
10608 (Output_reduced_debug_abbrev_section::failed): Use format for
10609 gold_warning.
10610 (Output_reduced_debug_info_section::faild): Likewise.
10611
88a0e15b
ILT
106122009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10613
10614 * script.cc (Lazy_demangler): New class.
2e702c99 10615 (Version_script_info::get_symbol_version_helper): Demangle a
88a0e15b
ILT
10616 symbol only once.
10617
5efc7cd2
CC
106182009-01-29 Cary Coutant <ccoutant@google.com>
10619
10620 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10621 to __tls_get_addr.
10622 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10623
e0ebcf42
ILT
106242009-01-28 Ian Lance Taylor <iant@google.com>
10625
5efc7cd2 10626 * version.cc (version_string): Bump to 1.9.
75fe7426 10627
e0ebcf42
ILT
10628 * gold.h: Include <cstring> and <stdint.h>.
10629 * version.cc: Include <cstdio>.
10630 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10631 warning.
10632 * reduced_debug_output.cc (insert_into_vector): Rename from
10633 Insert_into_vector; change all callers. Use Swap_unaligned to
10634 avoid aliasing issue; remove union since it is unnecessary.
10635
8e2813be 106362009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
10637
10638 * Makefile.am (CCFILES): Add gc.cc.
10639 (HFILES): Add gc.h.
10640 * Makefile.in: Regenerate.
10641 * gold.cc (Gc_runner): New class.
10642 (queue_initial_tasks): Call garbage collection related tasks
10643 when corresponding options are invoked.
10644 (queue_middle_gc_tasks): New function.
10645 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10646 processed early before laying out sections during garbage collection.
10647 * gold.h (queue_middle_gc_tasks): New function.
10648 (is_prefix_of): Move from "layout.cc".
10649 * i386.cc (Target_i386::gc_process_relocs): New function.
10650 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10651 * main.cc (main): Create object of class "Garbage_collection".
10652 * object.cc (Relobj::copy_symbols_data): New function.
10653 (Relobj::is_section_name_included): New function.
e1df38aa
NC
10654 (Sized_relobj::do_layout): Allow this function to be called twice
10655 during garbage collection and defer layout of section during the
6d03d481
ST
10656 first call.
10657 * object.h (Relobj::get_symbols_data): New function.
10658 (Relobj::is_section_name_included): New function.
10659 (Relobj::copy_symbols_data): New function.
10660 (Relobj::set_symbols_data): New function.
10661 (Relobj::get_relocs_data): New function.
10662 (Relobj::set_relocs_data): New function.
10663 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10664 (Relobj::gc_process_relocs): New function.
10665 (Relobj::do_gc_process_relocs): New pure virtual function.
10666 (Relobj::sd_): New data member.
10667 (Sized_relobj::is_output_section_offset_invalid): New function.
10668 (Sized_relobj::do_gc_process_relocs): New function.
10669 * options.h (General_options::gc_sections): Modify to not be a no-op.
10670 (General_options::print_gc_sections): New option.
10671 * plugin.cc (Plugin_finish::run): Remove function call to
10672 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10673 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10674 * reloc.cc (Read_relocs::run): Add task to process relocs and
10675 determine unreferenced sections when doing garbage collection.
10676 (Gc_process_relocs): New class.
10677 (Sized_relobj::do_gc_process_relocs): New function.
10678 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10679 sections that are garbage collected.
10680 * reloc.h (Gc_process_relocs): New class.
10681 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10682 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10683 symbols whose corresponding sections are garbage collected.
10684 (Symbol_table::Symbol_table): Add new parameter for the garbage
10685 collection object.
10686 (Symbol_table::gc_mark_undef_symbols): New function.
10687 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10688 (Symbol_table::gc_mark_dyn_syms): New function.
10689 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10690 as garbage.
10691 (Symbol_table::add_from_object): Likewise.
10692 (Symbol_table::add_from_relobj): When building shared objects, do not
10693 treat externally visible symbols as garbage.
10694 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10695 table information for static and relocatable links.
10696 * symtab.h (Symbol_table::set_gc): New function.
10697 (Symbol_table::gc): New function.
10698 (Symbol_table::gc_mark_undef_symbols): New function.
10699 (Symbol_table::gc_mark_symbol_for_shlib): New function.
10700 (Symbol_table::gc_mark_dyn_syms): New function.
10701 (Symbol_table::gc_): New data member.
e1df38aa 10702 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
10703 function.
10704 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10705 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10706
3b293544
CF
107072009-01-20 Chris Faylor <me.sourceware@sourceware.org>
10708
10709 * options.h (General_options::gc_sections): Define as a no-op for now.
10710 (General_options::no_keep_memory): Ditto.
10711 (General_options::Bshareable): Define.
10712 * options.cc (General_options::finalize): Honor -Bshareable.
10713
83d22aa8
AS
107142009-01-20 Andreas Schwab <schwab@suse.de>
10715
10716 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10717 read the value in the contents, since we don't use it. Use the
10718 template endianness when writing.
10719 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10720
cd536b21
AS
107212009-01-19 Andreas Schwab <schwab@suse.de>
10722
10723 * configure.tgt (powerpc64-*): Fix targ_obj.
10724
99e9a495
ILT
107252009-01-15 Ian Lance Taylor <iant@google.com>
10726
10727 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10728 local symbols when stripping all symbols.
10729
bbbfea06
CC
107302009-01-14 Cary Coutant <ccoutant@google.com>
10731
99e9a495 10732 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 10733
0f7c0701
CC
107342009-01-14 Cary Coutant <ccoutant@google.com>
10735
10736 * archive.cc (Archive::get_elf_object_for_member): Remove call
10737 to File_read::claim_for_plugin.
10738 * descriptors.cc (Descriptors::open): Remove reference to
10739 is_claimed.
10740 (Descriptors::claim_for_plugin): Remove.
10741 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10742 (Descriptors::is_claimed): Remove.
10743 (claim_descriptor_for_plugin): Remove.
10744 * fileread.cc (File_read::claim_for_plugin): Remove.
10745 * fileread.h (File_read::claim_for_plugin): Remove.
10746 (File_read::descriptor): Reopen descriptor if necessary.
10747 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10748 (Plugin_manager::all_symbols_read): Add task parameter. Change
10749 all callers.
10750 (Plugin_manager::get_input_file): New function.
10751 (Plugin_manager::release_input_file): New function.
10752 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10753 corresponding data member.
10754 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10755 and pass to base constructor. Change all callers.
10756 (get_input_file, release_input_file): New functions.
10757 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10758 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10759 (Plugin_manager::all_symbols_read): Add task parameter.
10760 (Plugin_manager::get_input_file): New function.
10761 (Plugin_manager::release_input_file): New function.
10762 (Plugin_manager::task_): New data member.
10763 (Pluginobj::Pluginobj): Add filesize parameter.
10764 (Pluginobj::filename): New function.
10765 (Pluginobj::descriptor): New function.
10766 (Pluginobj::filesize): New function.
10767 (Pluginobj::filesize_): New data member.
10768 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10769 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10770 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10771
10772 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10773 with archive libraries.
10774 * testsuite/Makefile.in: Regenerate.
10775 * testsuite/plugin_test.c (struct sym_info): New type.
10776 (get_input_file, release_input_file): New static variables.
10777 (onload): Capture new transfer vector entries.
10778 (claim_file_hook): Stop reading at end of file according to filesize.
10779 Factor out parsing of readelf output into separate function.
10780 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10781 APIs and get the source file name from the symbol table. Convert
10782 source file name to corresponding object file name. Print info
10783 message when adding new input files.
10784 (parse_readelf_line): New function.
10785 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10786 * testsuite/plugin_test_2.sh: Likewise.
10787 * testsuite/plugin_test_3.sh: Likewise.
10788 * testsuite/plugin_test_4.sh: New test case.
10789
62a6d109
ILT
107902009-01-07 Ian Lance Taylor <iant@google.com>
10791
10792 * version.cc (version_string): Bump to 1.8.
10793
483620e8
CC
107942008-12-23 Cary Coutant <ccoutant@google.com>
10795
10796 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10797 * plugin.cc (Plugin_manager::finish): Rename as
10798 layout_deferred_objects. Move cleanup to separate function.
10799 (Plugin_manager::cleanup): New function.
10800 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10801 separately.
10802 * plugin.h (Plugin_manager::finish): Rename as
10803 layout_deferred_objects.
10804 (Plugin_manager::cleanup): New function.
10805 (Plugin_manager::cleanup_done): New field.
10806
d66a9eb3
CC
108072008-12-23 Cary Coutant <ccoutant@google.com>
10808
10809 * plugin.cc (is_visible_from_outside): New function.
10810 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10811 so we don't return "IR only" status for exported symbols or -r links.
10812
10813 * testsuite/Makefile.am (plugin_test_3): New test case.
10814 * testsuite/Makefile.in: Regenerate.
10815 * testsuite/plugin_test_3.sh: New file.
10816
5995b570
CC
108172008-12-22 Cary Coutant <ccoutant@google.com>
10818
10819 * object.cc (Sized_relobj::layout_section): New function.
10820 (Sized_relobj::do_layout): Defer layout of input sections until after
10821 plugin has provided replacement files.
10822 (Sized_relobj::do_layout_deferred_sections): New function.
10823 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10824 (Relobj::layout_deferred_sections): New function.
10825 (Relobj::do_layout_deferred_sections): New function.
10826 (Sized_relobj::do_layout_deferred_sections): New function.
10827 (Sized_relobj::layout_section): New function.
10828 (Sized_relobj::Deferred_layout): New structure.
10829 (Sized_relobj::deferred_layout_): New field.
10830 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10831 Change all callers. Layout deferred sections.
10832 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10833 references.
10834 (Plugin_hook::run): Move code from do_plugin_hook inline.
10835 (Plugin_hook::do_plugin_hook): Remove.
10836 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10837 (Plugin_manager::finish): Renamed, was cleanup.
10838 (Plugin_manager::should_defer_layout): New function.
10839 (Plugin_manager::add_deferred_layout_object): New function.
10840 (Plugin_manager::Deferred_layout_list): New type.
10841 (Plugin_manager::deferred_layout_objects_): New field.
10842 (Plugin_hook::do_plugin_hook): Remove.
10843
ee769c88
ILT
108442008-12-17 Ian Lance Taylor <iant@google.com>
10845
10846 * options.h (class General_options): Add --no case for
10847 --export-dynamic.
10848
abc8dcba
CC
108492008-12-16 Cary Coutant <ccoutant@google.com>
10850
10851 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10852 vector.
10853 (Plugin_manager::claim_file): Create plugin object even if
10854 plugin did not call the add_symbols callback.
10855 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10856 asking for more symbols than were added.
10857 * testsuite/Makefile.am (plugin_test_1): Add test case with
10858 no global symbols.
10859 (empty.syms): New target.
10860 * testsuite/Makefile.in: Regenerate.
10861 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10862 message. Don't call add_symbols if no globals.
10863 (all_symbols_read_hook): Don't provide replacement for empty
10864 claimed file.
10865
b0074644
ILT
108662008-12-12 Ian Lance Taylor <iant@google.com>
10867
68943102
ILT
10868 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10869 r_type == 0 for a local symbol with r_sym == 0.
10870 (scan_relocatable_relocs): Pass r_sym to
10871 local_non_section_strategy.
10872 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10873 r_sym parameter.
10874
b0074644
ILT
10875 * configure.ac: Update test for TLS descriptors: they are
10876 supported as of glibc 2.9.
10877 * configure: Rebuild.
10878
c2508178
ILT
108792008-12-11 Ian Lance Taylor <iant@google.com>
10880
10881 PR 7091
10882 * target-reloc.h (Default_scan_relocatable_relocs): For each
10883 function, map r_type == 0 to RELOC_DISCARD.
10884
2756a258
CC
108852008-12-10 Cary Coutant <ccoutant@google.com>
10886
10887 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10888 object to override a kept COMDAT group from a plugin object.
10889
bb6f53d3
ILT
108902008-12-09 Ian Lance Taylor <iant@google.com>
10891
fbc558e1
ILT
10892 PR 7088
10893 * yyscript.y (file_cmd): Handle INPUT.
10894
bb6f53d3
ILT
10895 * testsuite/initpri1.c: Change all declarations to be full
10896 prototypes by adding void, to avoid compiler warnings.
10897
4674ecfc
CC
108982008-12-05 Rafael Avila de Espindola <espindola@google.com>
10899
10900 * options.cc (General_options::parse_plugin_opt): New.
10901 (General_options::add_plugin): The argument now is just the filename.
10902 (General_options::add_plugin_option): New.
10903 * options.h (plugin_opt): New.
10904 (add_plugin): Change argument name.
10905 (add_plugin_option): New.
10906 * plugin.cc (Plugin::load): Don't parse the plugin option.
10907 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10908 (Plugin::add_option): New.
10909 (Plugin::args_): Change type.
10910 (Plugin::filename_): New.
10911 (Plugin_manager::add_plugin_option): New.
10912 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10913 * testsuite/Makefile.in: Regenerate.
10914
fd06b4aa
CC
109152008-12-05 Cary Coutant <ccoutant@google.com>
10916
10917 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10918 Handle --strip-lto-sections option.
10919 * options.h (strip_lto_sections): New option.
10920
6c52134c
CC
109212008-12-01 Cary Coutant <ccoutant@google.com>
10922
10923 * plugin.cc (ld_plugin_message): Change format parameter to const.
10924 Fix mismatch between new[] and delete.
10925
a45248e0
CC
109262008-11-14 Cary Coutant <ccoutant@google.com>
10927
10928 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10929 instead of -1U.
10930
c82fbeee
CS
109312008-11-05 Craig Silverstein <csilvers@google.com>
10932
10933 * options.cc (General_options::parse_dynamic_list): New function.
10934 * options.h (General_options): New flags dynamic_list,
10935 dynamic_list_data, dynamic_list_cpp_new, and
10936 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10937 (General_options::in_dynamic_list): New function.
10938 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10939 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10940 (Lex::can_continue_name): Likewise.
10941 (yylex): Likewise.
10942 (read_script_file): New parameter script_options.
10943 (read_dynamic_list): New function.
10944 (Script_options::define_dynamic_list): New function.
10945 (dynamic_list_keyword_parsecodes): New variable.
10946 (dynamic_list_keywords): New variable.
10947 * script.h (Script_options::define_dynamic_list): New function
10948 prototype.
10949 (read_dynamic_list): New function prototype.
10950 * symtab.cc (strprefix): New macro.
10951 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10952 dynamic_list_data, dynamic_list_cpp_new, and
10953 dynamic_list_cpp_typeinfo.
10954 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10955 (dynamic_list_expr): New rule.
10956 (dynamic_list_nodes): Likewise.
10957 (dynamic_list_node): Likewise.
10958 * testsuite/Makefile.am (dynamic_list): New test.
10959 * testsuite/Makefile.in: Regenerated.
10960 * testsuite/dynamic_list.t: New file.
10961 * testsuite/dynamic_list.sh: New file.
10962
e0bb29a5
CS
109632008-11-05 Craig Silverstein <csilvers@google.com>
10964
10965 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10966 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10967 (t11_last): Likewise.
10968 * testsuite/ver_test_6.c (main): Likewise.
10969
4e1e25e0
CC
109702008-10-07 Cary Coutant <ccoutant@google.com>
10971
10972 * options.c (General_options::finalize): Add check for -static and
10973 -shared.
10974 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10975 is not empty.
10976
92f03fcb
CC
109772008-10-02 Cary Coutant <ccoutant@google.com>
10978
10979 * plugin.cc (make_sized_plugin_object): Fix conditional
10980 compilation to work when not all targets are enabled.
10981
fbd8a257
CC
109822008-09-29 Cary Coutant <ccoutant@google.com>
10983
10984 * archive.cc (Archive::get_file_and_offset): Use filename instead
10985 of name to get library path.
10986 (Archive::include_member): Unlock external member of a thin archive.
10987
10988 * testsuite/Makefile.am (TEST_AR): New variable.
10989 (thin_archive_test_1): New test.
10990 (thin_archive_test_2): New test.
81636b3f
CC
10991 * testsuite/Makefile.in: Regenerate.
10992 * testsuite/thin_archive_main.cc: New file.
10993 * testsuite/thin_archive_test_1.cc: New file.
10994 * testsuite/thin_archive_test_2.cc: New file.
10995 * testsuite/thin_archive_test_3.cc: New file.
10996 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 10997
eff45813
CC
109982008-09-29 Cary Coutant <ccoutant@google.com>
10999
11000 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11001 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11002 instead of -1U.
11003 (Sized_relobj::do_finalize_local_symbols): Likewise.
11004 (Sized_relobj::map_to_kept_section): Likewise.
11005 * object.h (Sized_relobj::invalid_address): New constant.
11006 (Sized_relobj::do_output_section_offset): Check for invalid_address
11007 and return -1ULL.
11008 * output.cc (Output_reloc::local_section_offset): Use constant
11009 invalid_address instead of -1U.
11010 (Output_reloc::get_address): Likewise.
11011 (Output_section::output_address): Change -1U to -1ULL.
11012 * output.h (Output_reloc::invalid_address): New constant.
11013 * reloc.cc (Sized_relobj::write_sections): Use constant
11014 invalid_address instead of -1U.
11015 (Sized_relobj::relocate_sections): Likewise.
11016 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11017 values for merge sections.
11018 * target-reloc.h (relocate_for_relocatable): Use constant
11019 invalid_address instead of -1U.
11020
89fc3421
CC
110212008-09-19 Cary Coutant <ccoutant@google.com>
11022
11023 Add plugin functionality for link-time optimization (LTO).
11024 * configure.ac (plugins): Add --enable-plugins option.
11025 * configure: Regenerate.
11026 * config.in: Regenerate.
11027 * Makefile.am (LIBDL): New variable.
11028 (CCFILES): Add plugin.cc.
11029 (HFILES): Add plugin.h.
11030 (ldadd_var): Add LIBDL.
11031 * Makefile.in: Regenerate.
11032
11033 * archive.cc: Include "plugin.h".
11034 (Archive::setup): Don't preread archive symbols when using a plugin.
11035 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11036 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11037 files.
11038 (Archive::include_member): Add symbols from plugin objects.
11039 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11040 * descriptors.cc (Descriptors::open): Check for file descriptors
11041 abandoned by plugins.
11042 (Descriptors::claim_for_plugin): New function.
11043 * descriptors.h (Descriptors::claim_for_plugin): New function.
11044 (Open_descriptor::is_claimed): New field.
11045 (claim_descriptor_for_plugin): New function.
11046 * fileread.cc (File_read::claim_for_plugin): New function.
11047 * fileread.h (File_read::claim_for_plugin): New function.
11048 (File_read::descriptor): New function.
11049 * gold.cc: Include "plugin.h".
11050 (queue_initial_tasks): Add task to call plugin hooks for generating
11051 new object files.
11052 * main.cc: Include "plugin.h".
11053 (main): Load plugin libraries.
11054 * object.h (Pluginobj): Declare.
11055 (Object::pluginobj): New function.
11056 (Object::do_pluginobj): New function.
11057 (Object::set_target): New function.
11058 * options.cc: Include "plugin.h".
11059 (General_options::parse_plugin): New function.
11060 (General_options::General_options): Initialize plugins_ field.
11061 (General_options::add_plugin): New function.
11062 * options.h (Plugin_manager): Declare.
11063 (General_options): Add --plugin option.
11064 (General_options::has_plugins): New function.
11065 (General_options::plugins): New function.
11066 (General_options::add_plugin): New function.
11067 (General_options::plugins_): New field.
11068 * plugin.cc: New file.
11069 * plugin.h: New file.
11070 * readsyms.cc: Include "plugin.h".
11071 (Read_symbols::do_read_symbols): Check for archive before checking
11072 for ELF file. Call plugin hooks to claim files.
11073 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11074 from a real object file; force override when processing replacement
11075 files.
11076 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11077 (Symbol::init_base_object): Likewise.
11078 (Symbol::init_base_output_data): Likewise.
11079 (Symbol::init_base_output_segment): Likewise.
11080 (Symbol::init_base_constant): Likewise.
11081 (Symbol::init_base_undefined): Likewise.
11082 (Symbol::output_section): Assert that object is not a plugin.
11083 (Symbol_table::add_from_pluginobj): New function.
11084 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11085 undefined.
11086 (Symbol_table::sized_write_globals): Likewise.
11087 (Symbol_table::add_from_pluginobj): Instantiate template.
11088 * symtab.h (Sized_pluginobj): Declare.
11089 (Symbol::in_real_elf): New function.
11090 (Symbol::set_in_real_elf): New function.
11091 (Symbol::in_real_elf_): New field.
11092 (Symbol_table::add_from_pluginobj): New function.
11093
11094 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11095 (LIBDL): New variable.
11096 (LDADD): Add LIBDL.
11097 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11098 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11099 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11100 (MOSTLYCLEANFILES): Likewise.
11101 * testsuite/Makefile.in: Regenerate.
11102 * testsuite/plugin_test.c: New file.
11103 * testsuite/plugin_test_1.sh: New file.
11104 * testsuite/plugin_test_2.sh: New file.
11105
de31bda5
ILT
111062008-09-16 Ian Lance Taylor <iant@google.com>
11107
9c2d0ef9
ILT
11108 * target-reloc.h (relocate_section): Check whether a symbol is
11109 defined by the ABI before reporting an undefined symbol error.
11110 * target.h (Target::is_defined_by_abi): Make parameter const.
11111 (Target::do_is_defined_by_abi): Likewise.
11112 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11113 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11114 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11115 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11116 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11117 * testsuite/Makefile.in: Rebuild.
11118
de31bda5
ILT
11119 * fileread.cc (make_view): Add casts to avoid warning.
11120
9fa33bee
AO
111212008-09-16 Alexandre Oliva <aoliva@redhat.com>
11122
11123 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11124 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11125
183fd0e3
AO
111262008-09-16 Alexandre Oliva <aoliva@redhat.com>
11127
11128 * options.h (General_options::output_is_executable): New.
11129 (General_options::output_is_pie): New.
11130 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11131 for shared libraries.
11132 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11133
7be8330a
CD
111342008-09-11 Chris Demetriou <cgd@google.com>
11135
11136 * options.h (origin): New -z option.
11137 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11138 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11139 in DT_FLAGS_1.
11140
a9caad02
CC
111412008-09-05 Cary Coutant <ccoutant@google.com>
11142
11143 * fileread.cc (File_read::make_view): Add check for attempt to map
11144 beyond end of file.
11145
ae6dce4d
CC
111462008-09-05 Cary Coutant <ccoutant@google.com>
11147
11148 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11149 explicit instantiations.
11150
d7ab2a47
KVH
111512008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11152
11153 PR gold/6858
11154 * options.cc (General_options::finalize): Allow undefined symbols
11155 in shlibs if linking -shared.
11156
11157 PR gold/6859
11158 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11159 symbols as not needing a dynsym entry.
11160
1e52a9c1
CS
111612008-08-20 Craig Silverstein <csilvers@google.com>
11162
11163 * fileread.cc (File_read::open): Do not lock the file unless it
11164 was successfully opened.
11165
d85c80a3
CC
111662008-08-14 Cary Coutant <ccoutant@google.com>
11167
11168 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11169 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11170 * testsuite/tls_test.cc (struct int128): 128-bit struct
11171 for testing TLS relocs with non-zero addend.
11172 (v12): New TLS variable.
11173 (t12): New test.
11174 (t_last): Add check for v12.
11175 * testsuite/tls_test.h (t12): New function.
11176 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11177
2d924fd9
ILT
111782008-08-13 Ian Lance Taylor <iant@google.com>
11179
11180 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11181 set tls_segment_ or relro_segment_.
11182 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11183 when appropriate.
11184 * output.h (Output_section::clear_is_relro): New function.
11185 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11186 sections specially even when output_data_ is empty.
11187 (Output_segment::maximum_alignment): When first section is relro,
11188 only force alignment for PT_LOAD segments.
11189 * script.cc (script_data_segment_align): New function.
11190 (script_data_segment_relro_end): New function.
11191 * script-c.h (script_data_segment_align): Declare.
11192 (script_data_segment_relro_end): Declare.
11193 * script-sections.h (class Script_sections): Declare
11194 data_segment_align and data_segment_relro_end. Add fields
11195 segment_align_index_ and saw_relro_end_.
11196 * script-sections.cc (class Sections_element): Add set_is_relro
11197 virtual function. Add new bool* parameter to place_orphan_here.
11198 Add get_output_section virtual function.
11199 (class Output_section_definition): Add set_is_relro. Add new
11200 bool* parameter to place_orphan_here. Add get_output_section.
11201 Add is_relro_ field.
11202 (Output_section_definition::Output_section_definition): Initialize
11203 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11204 and is_relro_ fields.
11205 (Output_section_definition::place_orphan_here): Add is_relro
11206 parameter.
11207 (Output_section_definition::set_section_addresses): Set relro for
11208 output section.
11209 (Output_section_definition::alternate_constraint): Likewise.
11210 (class Orphan_output_section): Add new bool* parameter to
11211 place_orphan_here. Add get_output_section.
11212 (Orphan_output_section::place_orphan_here): Add is_relro
11213 parameter.
11214 (Script_sections::Script_sections): Initialize
11215 data_segment_align_index_ and saw_relro_end_.
11216 (Script_sections::data_segment_align): New function.
11217 (Script_sections::data_segment_relro_end): New function.
11218 (Script_sections::place_orphan): Set or clear is_relro.
11219 (Script_sections::set_section_addresses): Force alignment of first
11220 TLS section.
11221 * yyscript.y (exp): Call script_data_segment_align and
11222 script_data_segment_relro_end.
11223 * testsuite/relro_script_test.t: New file.
11224 * testsuite/relro_test.cc (using_script): Declare.
11225 (t1, t2): Test using_script.
11226 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11227 (relro_script_test_SOURCES): Define.
11228 (relro_script_test_DEPENDENCIES): Define.
11229 (relro_script_test_LDFLAGS): Define.
11230 (relro_script_test_LDADD): Define.
11231 (relro_script_test.so): New target.
11232 * testsuite/Makefile.in: Rebuild.
11233
f827c9a9
CC
112342008-08-06 Cary Coutant <ccoutant@google.com>
11235
11236 * archive.cc (Archive::total_archives, Archive::total_members)
11237 (Archive::total_members_loaded): New variables.
11238 (Archive::setup): Add parameter. Add option to preread
11239 archive symbols.
11240 (Archive::read_armap): Add counter.
11241 (Archive::get_file_and_offset): New function.
11242 (Archive::get_elf_object_for_member): New function.
11243 (Archive::read_all_symbols): New function.
11244 (Archive::read_symbols): New function.
11245 (Archive::add_symbols): Add counters.
11246 (Archive::include_all_members): Use armap to find members if it's
11247 already built.
11248 (Archive::include_member): Skip reading symbols if already read.
11249 Factored code into Archive::get_file_and_offset and
11250 Archive::get_elf_object_for_member. Changed call to
11251 Mapfile::report_include_archive_member.
11252 (Archive::print_stats): New function.
11253 * archive.h: Declare Object and Read_symbols_data classes.
11254 (Archive::Archive): Add initializers for new members.
11255 (Archive::setup): Add parameter.
11256 (Archive::print_stats): New function.
11257 (Archive::total_archives, Archive::total_members)
11258 (Archive::total_members_loaded): New variables.
11259 (Archive::get_file_and_offset): New function.
11260 (Archive::get_elf_object_for_member): New function.
11261 (Archive::read_all_symbols): New function.
11262 (Archive::read_symbols): New function.
11263 (Archive::Archive_member): New class.
11264 (Archive::members_): New member.
11265 (Archive::num_members_): New member.
11266 * main.cc: Include archive.h.
11267 (main): Call Archive::print_stats.
11268 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11269 archive parameter; member_name is now the fully-decorated name.
11270 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11271 * options.h: (General_options): Add --preread-archive-symbols option.
11272 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11273 Archive::setup.
11274
de4c45bd
ILT
112752008-08-04 Ian Lance Taylor <iant@google.com>
11276
11277 * symtab.h (Symbol::use_plt_offset): New function.
11278 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11279 * powerpc.cc (Relocate::relocate): Likewise.
11280 * sparc.cc (Relocate::relocate): Likewise.
11281 * x86_64.cc (Relocate::relocate): Likewise.
11282 * testsuite/weak_plt.sh: New test.
11283 * testsuite/weak_plt_main.cc: New test.
11284 * testsuite/weak_plt_shared.cc: New test.
11285 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11286 (check_PROGRAMS): Add weak_plt.
11287 (check_DATA): Add weak_plt_shared.so.
11288 (weak_plt_main_pic.o, weak_plt): New targets.
11289 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11290 * testsuite/Makefile.in: Rebuild.
11291
11292 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11293 gcctestdir/ld.
11294 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11295 * testsuite/Makefile.in: Rebuild.
11296
323ee3f4
AM
112972008-08-04 Alan Modra <amodra@bigpond.net.au>
11298
11299 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11300 * Makefile.in: Regenerate.
11301 * po/POTFILES.in: Regenerate.
11302
7c07ecec
ILT
113032008-07-29 Ian Lance Taylor <iant@google.com>
11304
11305 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11306 symbols before other symbols.
11307 * testsuite/script_test_2.cc (test_addr): Declare.
11308 (test_addr_alias): Declare.
11309 (main): Check that test_addr and test_addr_alias have the right
cd536b21 11310 values.
7c07ecec
ILT
11311 * testsuite/script_test_2.t: Define test_addr_alias and
11312 test_addr.
11313
5778530e
ILT
113142008-07-24 Ian Lance Taylor <iant@google.com>
11315
2a00e4fb
ILT
11316 PR 5990
11317 * descriptors.cc: New file.
11318 * descriptors.h: New file.
11319 * gold-threads.h (class Hold_optional_lock): New class.
11320 * fileread.cc: Include "descriptors.h".
11321 (File_read::~File_read): Release descriptor rather than closing
11322 it.
11323 (File_read::open) [file]: Call open_descriptor rather than open.
11324 Set is_descriptor_opened_.
11325 (File_read::open) [memory]: Assert that descriptor is not open.
11326 (File_read::reopen_descriptor): New function.
11327 (File_read::release): Release descriptor.
11328 (File_read::do_read): Make non-const. Reopen descriptor.
11329 (File_read::read): Make non-const.
11330 (File_read::make_view): Reopen descriptor.
11331 (File_read::do_readv): Likewise.
11332 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11333 Update declarations.
11334 * layout.cc: Include "descriptors.h".
11335 (Layout::create_build_id): Use open_descriptor rather than open.
11336 * output.cc: Include "descriptors.h".
11337 (Output_file::open): Use open_descriptor rather than open.
11338 * archive.cc (Archive::const_iterator): Change Archive to be
11339 non-const.
11340 (Archive::begin, Archive::end): Make non-const.
11341 (Archive::count_members): Likewise.
11342 * archive.h (class Archive): Update declarations.
11343 * object.h (Object::read): Make non-const.
11344 * Makefile.am (CCFILES): Add descriptors.cc.
11345 (HFILES): Add descriptors.h.
11346 * Makefile.in: Rebuild.
11347
801647d1
ILT
11348 PR 6716
11349 * gold.h: Always include <clocale>. Add Solaris workarounds
11350 following code in binutils/sysdep.h.
11351
5edd166e
ILT
11352 PR 6048
11353 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11354 this->eh_frame_hdr_ is NULL before using it.
11355
c89ad728
ILT
11356 * dynobj.cc (Versions::Versions): Update comment.
11357
aa86f06b
ILT
11358 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11359 the base version name.
11360
5778530e
ILT
11361 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11362 array size plus one.
11363 (Stringpool_template::set_string_offsets): Subtract one from key
11364 before using it as an array index.
11365 (Stringpool_template::get_offset_with_length): Likewise.
11366 (Stringpool_template::write_to_buffer): Likewise.
11367 * stringpool.h (Stringpool_template::get_offset_from_key):
11368 Likewise.
11369
057ead22
ILT
113702008-07-23 Ian Lance Taylor <iant@google.com>
11371
7f649c59
ILT
11372 PR 6658
11373 * object.h (Merged_symbol_value::value): Do our best to handle a
11374 negative addend.
11375
057ead22
ILT
11376 PR 6647
11377 * script.cc (Version_script_info::get_versions): Don't add empty
11378 version tag to return value.
11379 (Version_script_info::get_symbol_version_helper): Change return
11380 type to bool. Add pversion parameter. Change all callers.
11381 (script_register_vers_node): Don't require a non-NULL tag.
11382 * script.h (class Version_script_info): Update declarations.
11383 (Version_script_info::get_symbol_version): Change return type to
11384 bool. Add version parameter. Change all callers.
11385 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11386 handling. Handle an empty version from a version script.
11387 (Symbol_table::define_special_symbol): Likewise.
11388 * testsuite/ver_test_10.script: New file.
11389 * testsuite/ver_test_10.sh: New file.
11390 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11391 (check_DATA): Add ver_test_10.syms.
11392 (ver_test_10.syms, ver_test_10.so): New target.
11393 * testsuite/Makefile.in: Rebuild.
11394
58e54ac2
CD
113952008-07-23 Simon Baldwin <simonb@google.com>
11396
11397 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11398 to zero for undefined symbols from dynamic libraries.
11399
95d14cd3
ILT
114002008-07-23 Ian Lance Taylor <iant@google.com>
11401
11402 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11403 Change all callers.
11404 * symtab.h (class Symbol_table): Update declaration.
11405 * testsuite/ver_test_9.cc: New file.
11406 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11407 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11408 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11409 (ver_test_9.so, ver_test_9.o): New targets.
11410 * testsuite/Makefile.in: Rebuild.
11411
92de84a6
ILT
114122008-07-22 Ian Lance Taylor <iant@google.com>
11413
34810851
ILT
11414 * options.h (class General_options): Define --check-sections.
11415 * layout.cc (Layout::set_segment_offsets): Handle
11416 --check-sections.
11417
af6156ef
ILT
11418 * options.h (class General_options): Define -n/--nmagic and
11419 -N/--omagic.
11420 * options.cc (General_options::finalize): For -n/--nmagic or
11421 -N/--omagic, set -static.
11422 * layout.cc (Layout::attach_allocated_section_to_segment): If
11423 -N/--omagic, don't put read-only and read-write sections in
11424 different segments.
11425 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11426 finding a read-only segment.
11427 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11428 don't set the minimum segment alignment to the common page size,
11429 and don't set the file offset to the address modulo the page size.
11430 * script-sections.cc (Script_sections::create_segments): If
11431 -n/--omagic, don't put read-only and read-write sections in
11432 different segments.
11433
92de84a6
ILT
11434 * cref.cc: New file.
11435 * cref.h: New file.
11436 * options.h (class General_options): Add --print-symbol-counts.
11437 * main.cc (main): Issue defined symbol report if requested.
11438 * archive.cc (Archive::interpret_header): Make into a const member
11439 function.
11440 (Archive::add_symbols): Call Input_objects::archive_start and
11441 archive_stop.
11442 (Archive::const_iterator): Define new class.
11443 (Archive::begin, Archive::end): New functions.
11444 (Archive::include_all_members): Rewrite to use iterator.
11445 (Archive::count_members): New function.
11446 * archive.h (class Archive): Update declarations.
11447 (Archive::filename): New function.
11448 * object.cc: Include "cref.h".
11449 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11450 (Sized_relobj::do_get_global_symbol_counts): New function.
11451 (Input_objects::add_object): Add object to cross-referencer.
11452 (Input_objects::archive_start): New function.
11453 (Input_objects::archive_stop): New function.
11454 (Input_objects::print_symbol_counts): New function.
11455 * object.h: Declare Cref and Archive.
11456 (Object::get_global_symbol_counts): New function.
11457 (Object::do_get_global_symbol_counts): New pure virtual function.
11458 (class Sized_relobj): Add defined_count_ field. Update
11459 declarations.
11460 (class Input_objects): Add cref_ field. Update constructor.
11461 Update declarations.
11462 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11463 defined_count_.
11464 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11465 symbol counts.
11466 (Sized_dynobj::do_get_global_symbol_counts): New function.
11467 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11468 defined_count_. Update declarations. Define Symbols typedef.
11469 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11470 parameter. Change all callers.
11471 (Symbol_table::add_from_dynobj): Add sympointers and defined
11472 parameters. Change all callers.
11473 * symtab.h (class Symbol_table): Update declarations.
11474 * Makefile.am (CCFILES): Add cref.cc.
11475 (HFILES): Add cref.h.
11476 * Makefile.in: Rebuild.
11477
3f7c5e1d
CD
114782008-07-22 Simon Baldwin <simonb@google.com>
11479
11480 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11481 to zero when writing undefined symbols.
11482
e0b64032
ILT
114832008-07-22 Ian Lance Taylor <iant@google.com>
11484
11485 * output.cc (Output_section::add_input_section): Don't try to
11486 merge empty merge sections.
11487
096b02cf
CS
114882008-07-21 Craig Silverstein <csilvers@google.com>
11489
11490 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11491 Include symbol version in error message.
cd536b21 11492
1d1f116d
CD
114932008-07-20 Chris Demetriou <cgd@google.com>
11494
cd536b21 11495 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
11496 (RANDOM_SEED_CFLAGS): New substituted variable.
11497 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11498 * configure: Rebuild.
11499 * Makefile.in: Likewise.
11500 * testsuite/Makefile.in: Likewise.
11501
a18f591e
ILT
115022008-07-18 Ian Lance Taylor <iant@google.com>
11503
11504 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11505 where we see NAME/NULL and NAME/VERSION as separate symbols.
11506 * testsuite/ver_test_main.cc (main): Call t4.
11507 (t4, t4_2a): Define.
11508 * testsuite/ver_test_2.cc (t4_2): Define.
11509 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11510 * testsuite/ver_test_4.cc (t4_2a): Define.
11511 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11512 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11513
c6e3f6ed
ILT
115142008-07-17 Ian Lance Taylor <iant@google.com>
11515
11516 * dynobj.cc (Versions::add_def): If we give an error about a
11517 missing version, go ahead and create the version anyhow.
11518
ef9beddf
ILT
115192008-07-10 Ian Lance Taylor <iant@google.com>
11520
11521 Handle output sections with more than 0x7fffffff bytes.
11522 * object.h (class Relobj): Change map_to_output_ to
11523 output_sections_, and just keep a section pointer. Change all
11524 uses. Move comdat group support to Sized_relobj.
11525 (Relobj::is_section_specially_mapped): Remove.
11526 (Relobj::output_section): Remove poff parameter. Change all
11527 callers.
11528 (Relobj::output_section_offset): New function.
11529 (Relobj::set_section_offset): Rewrite.
11530 (Relobj::map_to_output): Remove.
11531 (Relobj::output_sections): New function.
11532 (Relobj::do_output_section_offset): New pure virtual function.
11533 (Relobj::do_set_section_offset): Likewise.
11534 (class Sized_relobj): Add section_offsets_ field. Add comdat
11535 group support from Relobj. Update declarations.
11536 (Sized_relobj::get_output_section_offset): New function.
11537 (Sized_relobj::do_output_section_offset): New function.
11538 (Sized_relobj::do_set_section_offset): New function.
11539 * object.cc (Relobj::output_section_address): Remove.
11540 (Sized_relobj::Sized_relobj): Initialize new fields.
11541 (Sized_relobj::include_section_group): Cast find_kept_object to
11542 Sized_relobj.
11543 (Sized_relobj::include_linkonce_section): Likewise.
11544 (Sized_relobj::do_layout): Use separate arrays for output section
11545 and output offset.
11546 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11547 output_sections.
11548 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11549 output_sections and section_offsets.
11550 (Sized_relobj::write_local_symbols): Likewise.
11551 (map_to_kept_section): Compute output address directly.
11552 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11553 output_sections and section_offsets.
11554 (Sized_relobj::write_sections): Likewise.
11555 (Sized_relobj::relocate_sections): Likewise.
11556 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11557 * output.h (class Output_reloc): Update declarations. Change
11558 u2_.relobj to Sized_relobj*.
11559 (class Output_data_reloc): Change add functions to use
11560 Sized_relobj*.
11561 * output.cc (Output_reloc::Output_reloc): Change relobj to
11562 Sized_relobj*.
11563 (Output_reloc::local_section_offset): Change return type to
11564 Elf_Addr. Use get_output_section_offset.
11565 (Output_reloc::get_address): Likewise.
11566 (Output_section::is_input_address_mapped): Don't call
11567 is_section_specially_mapped.
11568 (Output_section::output_offset): Likewise.
11569 (Output_section::output_address): Likewise.
11570 (Output_section::starting_output_address): Likewise.
11571 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11572 parameter to Sized_relobj*.
11573 (Copy_relocs::need_copy_reloc): Likewise.
11574 (Copy_relocs::save): Likewise.
11575 * copy-relocs.h (class Copy_relocs): Update declarations.
11576 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11577 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11578 * target-reloc.h (relocate_for_relocatable): Change
11579 offset_in_output_section type to Elf_Addr. Change code that uses
11580 it as well.
11581 * layout.cc (Layout::layout): Always set *off.
11582 * mapfile.cc (Mapfile::print_input_section): Use
11583 output_section_offset.
11584 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11585 Sized_relobj*.
11586 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11587 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11588 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11589
5cb66f97
ILT
115902008-07-03 Ian Lance Taylor <iant@google.com>
11591
11592 * layout.cc (Layout::include_section): Do not discard unrecognized
11593 SHT_STRTAB sections.
11594
afe47622
CS
115952008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11596
11597 * script.cc (Lex::can_continue_name): Make '?' allowable in
11598 version-script names.
11599 * testsuite/version_script.map: Change glob pattern to use '?'
11600
5adf9721
ILT
116012008-06-30 Manish Singh <yosh@gimp.org>
11602
11603 PR 6585
11604 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11605 Correct typo.
11606
e6fde208
ILT
116072008-06-30 Ian Lance Taylor <iant@google.com>
11608
11609 PR 6660
11610 PR 6682
11611 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11612 versions]: Don't try to read the value in the contents, since we
11613 don't use it. Use the template endianness when writing.
11614
3f2e6a2d
CC
116152008-06-25 Cary Coutant <ccoutant@google.com>
11616
11617 * fileread.cc (File_read::make_view): Assert on zero-length view.
11618 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11619 symbol table when there are no symbols to read.
11620
c43d3a48
CS
116212008-06-23 Craig Silverstein <csilvers@google.com>
11622
11623 * version.cc (version_string): Bump to 1.7
11624
5f494ea0
CS
116252008-06-18 Craig Silverstein <csilvers@google.com>
11626
11627 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11628 constant 0xFFFF to type Valtype.
11629 (Powerpc_relocate_functions::rel16_ha): Likewise.
11630
c42e122e
ILT
116312008-06-17 Ian Lance Taylor <iant@google.com>
11632
f34787f8
ILT
11633 * output.h (Output_section::Input_section): Initialize p2align_ to
11634 zero for Output_section_data constructors.
11635 (Output_section::Input_section::addralign): If not an input
11636 section, return the alignment of the Output_section_data.
11637 * testsuite/copy_test.cc: New file.
11638 * testsuite/copy_test_1.cc: New file.
11639 * testsuite/copy_test_2.cc: New file.
11640 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11641 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11642 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11643 (copy_test_1_pic.o, copy_test_1.so): New targets.
11644 (copy_test_2_pic.o, copy_test_2.so): New targets.
11645 * testsuite/Makefile.in: Rebuild.
11646
c42e122e
ILT
11647 * script-sections.cc (Script_sections::place_orphan): Initialize
11648 local variable exact.
11649
ce3ac18a
DE
116502008-06-13 David Edelsohn <edelsohn@gnu.org>
11651
11652 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11653
42cacb20
DE
116542008-06-12 David Edelsohn <edelsohn@gnu.org>
11655 David S. Miller <davem@davemloft.net>
11656
11657 * powerpc.cc: New file.
11658 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11659 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11660 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11661 * Makefile.in: Rebuild.
11662
7b308235
ILT
116632008-06-09 Ian Lance Taylor <iant@google.com>
11664
11665 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11666 <exception>.
11667 (throwing, orig_terminate): New static variables.
11668 (terminate_handler): New static function.
11669 (t2): Set terminate handler.
11670
f0b886e3
ILT
116712008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11672
11673 PR 6584
cd536b21 11674 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
11675 alignment.
11676
3e90f135
CC
116772008-05-30 Cary Coutant <ccoutant@google.com>
11678
11679 * archive.cc (Archive::include_all_members) Correct to step
11680 over symbol table and extended name table in thin archives.
11681
e09ad04a
ILT
116822008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11683
11684 PR 6407
11685 * target-reloc.h (relocate_for_relocatable): Fix new_offset
11686 calculation.
11687
62b01cb5
ILT
116882008-05-28 Caleb Howe <cshowe@google.com>
11689
11690 * reduced_debug_output.cc: New file.
11691 * reduced_debug_output.h: New file.
92de84a6 11692 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
11693 * options.cc (General_options::finalize): Add strip_debug_non_line
11694 to the strip heirarchy.
11695 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11696 fields.
11697 * layout.cc: Include "reduced_debug_output.h".
11698 (Layout::Layout): Initialize new fields.
11699 (line_only_debug_sections): New static array.
11700 (is_lines_only_debug_sections): New static inline function.
11701 (Layout::include_section): Handle --strip-debug-non-line.
11702 (Layout::make_output_section): If --strip-debug-non-line, build
11703 new output sections for .debug_abbrev and .debug_info.
11704 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11705 gold. Warn about possible overflow.
11706 (read_signed_LEB_128): Likewise.
11707 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11708 (read_signed_LEB_128): Declare.
11709 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11710 (HFILES): Add reduced_debug_output.h.
11711 * Makefile.in: Rebuild.
11712
7d9e3d98
ILT
117132008-05-21 Ian Lance Taylor <iant@google.com>
11714
11715 * mapfile.cc: New file.
11716 * mapfile.h: New file.
11717 * options.h (class General_options): Add -M/--print-map and -Map.
11718 * options.cc (General_options::finalize): Make -M equivalent to
11719 -Map -.
11720 * main.cc: Include <cstdio> and "mapfile.h".
11721 (main): Open mapfile if requested.
11722 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11723 constructor. Change caller.
11724 (queue_initial_tasks): Add mapfile parameter. Change caller.
11725 (queue_middle_tasks): Likewise.
11726 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11727 declarations.
11728 * archive.cc: Include "mapfile.h".
11729 (Archive::add_symbols): Add mapfile parameter. Change all
11730 callers. Pass mapfile, symbol, and reason to include_member.
11731 (Archive::include_all_members): Add mapfile parameter. Change all
11732 callers.
11733 (Archive::include_member): Add mapfile, sym, and why parameters.
11734 Change all callers. Report inclusion to map file.
11735 * archive.h: Include "fileread.h".
11736 (class Archive): Update declarations.
11737 (Archive::file): New const method.
11738 (class Add_archive_symbols): Add mapfile_ field. Update
11739 constructor. Change all callers.
11740 * readsyms.h (class Read_symbols): Likewise.
11741 (class Finish_group): Likewise.
11742 (class Read_script): Likewise.
11743 * common.cc: Include "mapfile.h".
11744 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11745 all callers.
11746 (Symbol_table::do_allocate_commons): Likewise.
11747 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11748 symbol allocation to mapfile.
11749 * common.h (class Allocate_commons_task): Add mapfile_ field.
11750 Update constructor. Change all callers.
11751 * symtab.h (class Symbol_table): Update declarations.
11752 * layout.cc: Include "mapfile.h".
11753 (Layout_task_runner::run): Print information to mapfile.
11754 (Layout::create_gold_note): Change Output_data_fixed_space to
11755 Output_data_zero_fill.
11756 (Layout::create_build_id): Likewise.
11757 (Layout::print_to_mapfile): New function.
11758 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11759 constructor. Change caller.
11760 (class Layout): Declare print_to_mapfile.
11761 * output.cc (Output_section::Input_section::print_to_mapfile): New
11762 function.
11763 (Output_section::add_input_section): If producing a map, always
11764 add to input_sections_ list.
11765 (Output_section::do_print_to_mapfile): New function.
11766 (Output_segment::print_sections_to_mapfile): New function.
11767 (Output_segment::print_section_list_to_mapfile): New function.
11768 * output.h: Include "mapfile.h".
11769 (Output_data::print_to_mapfile): New function.
11770 (Output_data::do_print_to_mapfile): New virtual function.
11771 (Output_segment_headers::do_print_to_mapfile): New function.
11772 (Output_file_header::do_print_to_mapfile): New function.
11773 (Output_data_const::do_print_to_mapfile): New function.
11774 (class Output_data_const_buffer): Add map_name_ field. Update
11775 constructor. Change all callers. Add do_print_to_mapfile
11776 function.
11777 (class Output_data_fixed_space): Likewise.
11778 (class Output_data_space): Likewise.
11779 (class Output_data_zero_fill): New class.
11780 (Output_data_strtab::do_print_to_mapfile): New function.
11781 (Output_data_reloc_base::do_print_to_mapfile): New function.
11782 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11783 (Output_data_group::do_print_to_mapfile): New function.
11784 (Output_data_got::do_print_to_mapfile): New function.
11785 (Output_data_dynamic::do_print_to_mapfile): New function.
11786 (Output_symtab_xindex::do_print_to_mapfile): New function.
11787 (class Output_section): Declare do_print_to_mapflie. Declare
11788 print_to_mapfile in Input_section.
11789 (class Output_segment): Declare new functions.
11790 * object.h (Sized_relobj::symbol_count): New function.
11791 * script-sections.cc
11792 (Output_section_element_dot_assignment::set_section_addresses):
11793 Change Output_data_fixed_space to Output_data_zero_fill.
11794 (Output_data_expression::do_print_to_mapfile): New function.
11795 * script.cc (read_input_script): Add mapfile parameter. Change
11796 all callers.
11797 * script.h (read_input_script): Update declaration.
11798 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11799 (Eh_frame::do_print_to_mapfile): New function.
11800 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11801 (Output_merge_string::do_print_to_mapfile): New function.
11802 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11803 function.
11804 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11805 function.
11806 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11807 function.
11808 * Makefile.am (CCFILES): Add mapfile.cc.
11809 (HFILES): Add mapfile.h.
11810 * Makefile.in: Rebuild.
11811
9f1d377b
ILT
118122008-05-19 Ian Lance Taylor <iant@google.com>
11813
11814 * options.h (class General_options): Add -z relro.
11815 * layout.cc (Layout::Layout): Initialize relro_segment_.
11816 (Layout::add_output_section_data): Return the output section.
11817 (Layout::make_output_section): Rcognize relro sections and mark
11818 them appropriately.
11819 (Layout::attach_allocated_section_to_segment): Put relro sections
11820 in a PT_GNU_RELRO segment.
11821 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11822 section as relro.
11823 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11824 PT_TLS segments.
11825 (Layout::linkonce_mapping): Map d.rel.ro.local to
11826 .data.rel.ro.local.
11827 (Layout::output_section_name): Us .data.rel.ro.local for any
11828 section which begins with that.
11829 * layout.h (class Layout): Update add_output_section_data
11830 declaration. Add relro_segment_ field.
11831 * output.cc (Output_section::Output_section): Initialize is_relro_
11832 and is_relro_local_ fields.
11833 (Output_segment::add_output_section): Group relro sections.
11834 (Output_segment::is_first_section_relro): New function.
11835 (Output_segment::maximum_alignment): If there is a relro section,
11836 align the segment to the common page size.
11837 (Output_segment::set_section_addresses): Track whether we are
11838 looking at relro sections. If the last section is a relro
11839 section, align to the common page size.
11840 (Output_segment::set_section_list_addresses): Add in_relro
11841 parameter. Change all callers. Align to the page size when
11842 moving from relro to non-relro section.
11843 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11844 segment.
11845 * output.h (class Output_section): Add is_relro_ and
11846 is_relro_local_ fields.
11847 (Output_section::is_relro): New function.
11848 (Output_section::set_is_relro): New function.
11849 (Output_section::is_relro_local): New function.
11850 (Output_section::set_is_relro_local): New function.
11851 (class Output_segment): Update declarations.
11852 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11853 * sparc.cc (Target_sparc::got_section): Likewise.
11854 * x86_64.cc (Target_x86_64::got_section): Likewise.
11855 * testsuite/relro_test_main.cc: New file.
11856 * testsuite/relro_test.cc: New file.
11857 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11858 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11859 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11860 (relro_test.so, relro_test_pic.o): New targets.
11861 * testsuite/Makefile.in: Rebuild.
11862
a984ee1d
ILT
118632008-05-16 Ian Lance Taylor <iant@google.com>
11864
01676dcd
ILT
11865 * output.cc (Output_segment::add_output_section): Remove front
11866 parameter.
11867 * output.h (class Output_segment): Remove
11868 add_initial_output_section and overloaded add_output_section.
11869 Update declaration of remaining add_output_section.
11870 * layout.cc (Layout::create_interp): Call add_output_section
11871 rather than add_initial_output_section.
11872 (Layout::finish_dynamic_section): Likewise.
11873
497897f9
ILT
11874 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11875 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11876 know the dynamic type.
11877 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11878 field. Initialize it in constructor.
11879 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11880 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11881 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11882 reloc.
11883
a984ee1d
ILT
11884 * output.cc (Output_reloc::get_address): Change return type to
11885 Elf_Addr.
11886 * output.h (class Output_reloc): Update get_address declaration.
11887 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11888 for section addresses.
11889
55ba0940
ILT
118902008-05-09 Ian Lance Taylor <iant@google.com>
11891
11892 PR 6493
11893 * gold.cc (gold_nomem): Use return value of write.
11894
75517b77
ILT
118952008-05-08 Ian Lance Taylor <iant@google.com>
11896
11897 * symtab.c (Symbol::init_base_output_data): Add version
11898 parameter. Change all callers.
11899 (Symbol::init_base_output_segment): Likewise.
11900 (Symbol::init_base_constant): Likewise.
11901 (Symbol::init_base_undefined): Likewise.
11902 (Sized_symbol::init_output_data): Likewise.
11903 (Sized_symbol::init_output_segment): Likewise.
11904 (Sized_symbol::init_constant): Likewise.
11905 (Sized_symbol::init_undefined): Likewise.
11906 (Symbol_table::do_define_in_output_data): If the new symbol has a
11907 version, mark it as the default.
11908 (Symbol_table::do_define_in_output_segment): Likewise.
11909 (Symbol_table::do_define_as_constant): Likewise.
11910 * symtab.h (class Symbol): Update declarations.
11911 (class Sized_symbol): Likewise.
11912 * resolve.cc (Symbol::override_version): New function.
c42e122e 11913 (Symbol::override_base): Call override_version.
75517b77
ILT
11914 (Symbol::override_base_with_special): Likewise.
11915 * testsuite/ver_script_8.script: New file.
11916 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11917 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11918 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11919 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11920
f1f70eae
ILT
119212008-05-06 Ian Lance Taylor <iant@google.com>
11922
f3e9c5c5
ILT
11923 PR 6049
11924 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11925 functions.
11926 (class General_options): Remove existing --undefined, and add
11927 --no-undefined instead. Add new --undefined as synonym for -u.
11928 * archive.cc (Archive::add_symbols): Check whether symbol was
11929 named with -u.
11930 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11931 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11932 all uses. Add IS_UNDEFINED. Update declarations to split
11933 different versions of init_base. Declare init_base_undefined.
11934 (Symbol::is_defined): Handle IS_UNDEFINED.
11935 (Symbol::is_undefined): Likewise.
11936 (Symbol::is_weak_undefined): Call is_undefined.
11937 (Symbol::is_absolute): Handle IS_CONSTANT.
11938 (class Sized_symbol): Update declarations to split different
11939 versions of init. Declare init_undefined.
11940 (class Symbol_table): Declare new functions.
11941 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11942 Change all callers.
11943 (Symbol::init_base_output_data): Likewise.
11944 (Symbol::init_base_output_segment): Likewise.
11945 (Symbol::init_base_constant): Likewise.
11946 (Symbol::init_base_undefined): New function.
11947 (Sized_symbol::init_object): Rename from init. Change all
11948 callers.
11949 (Sized_symbol::init_output_data): Likewise.
11950 (Sized_symbol::init_output_segment): Likewise.
11951 (Sized_symbol::init_constant): Likewise.
11952 (Sized_symbol::init_undefined): New function.
11953 (Symbol_table::add_undefined_symbols_from_command_line): New
11954 function.
11955 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11956 function.
11957 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11958 (Symbol::output_section): Likewise.
11959 (Symbol::set_output_section): Likewise.
11960 (Symbol_table::sized_finalize_symbol): Likewise.
11961 (Symbol_table::sized_write_globals): Likewise.
11962 * resolve.cc (Symbol_table::should_override): Likewise.
11963 (Symbol::override_base_with_special): Likewise.
11964
8bdcdf2c
ILT
11965 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11966 symbol, change it to have default visibility.
11967 * testsuite/protected_1.cc: New file.
11968 * testsuite/protected_2.cc: New file.
11969 * testsuite/protected_3.cc: New file.
11970 * testsuite/protected_main_1.cc: New file.
11971 * testsuite/protected_main_2.cc: New file.
11972 * testsuite/protected_main_3.cc: New file.
11973 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11974 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11975 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11976 (protected_1.so): New target.
11977 (protected_1_pic.o, protected_2_pic.o): New targets.
11978 (protected_3_pic.o): New target.
11979 (check_PROGRAMS): Add protected_2.
11980 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11981 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11982 * testsuite/Makefile.in: Rebuild.
11983
2b706932
ILT
11984 * options.h (DEFINE_var): Add set_user_set_##varname__.
11985 (DEFINE_bool_alias): New macro.
11986 (class General_options): Define -Bstatic using DEFINE_bool_alias
11987 rather than DEFINE_special. Add --undefined as an alias for -z
11988 defs.
11989 * options.cc (General_options::parse_Bstatic): Remove.
11990
d82a5bcc
ILT
11991 * options.h (class General_options): Add --fatal-warnings.
11992 * main.cc (main): Implement --fatal-warnings.
11993 * errors.h (Errors::warning_count): New function.
11994
f1f70eae
ILT
11995 * options.h (class General_options): Add -Bsymbolic-functions.
11996 * symtab.h (Symbol::is_preemptible): Check for
11997 -Bsymbolic-functions.
11998
8825ac63
ILT
119992008-05-05 Ian Lance Taylor <iant@google.com>
12000
d98bc257
ILT
12001 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12002 as noVARNAME rather than no-VARNAME.
12003 (class General_options): Add option -z combreloc.
12004 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12005 get_address.
12006 (Output_reloc::sort_before) [SHT_REL]: New function.
12007 (Output_reloc::sort_before) [SHT_RELA]: New function.
12008 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12009 Sort_relocs_comparison.
12010 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12011 parameter. Change all callers.
12012 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12013 sort_relocs parameter. Change all callers.
12014 * output.cc (Output_reloc::get_address): New function, broken out
12015 of write_rel.
12016 (Output_reloc::write_rel): Call it.
12017 (Output_reloc::compare): New function.
12018 (Output_data_reloc_base::do_write): Optionally sort relocs.
12019
60b2b4e7
ILT
12020 * configure.ac: If targ_extra_obj is set, link it in.
12021 * configure.tgt: Initialize all variables.
12022 (x86_64*): Set targ_extra_obj and targ_extra_size.
12023 * configure: Rebuild.
12024
8825ac63
ILT
12025 * object.cc (Sized_relobj::include_section_group): Adjust section
12026 indexes read from group data. Build vector to pass to
12027 layout_group.
12028 * layout.cc (Layout::layout_group): Add flags and shndxes
12029 parameters. Remove contents parameter. Change caller. Update
12030 explicit instantiations.
12031 * layout.h (class Layout): Update layout_group declaration.
12032 * output.cc (Output_data_group::Output_data_group): Add flags and
12033 input_shndxes parameters. Remove contents parameter. Change
12034 caller.
12035 (Output_data_group::do_write): Change input_sections_ to
12036 input_shndxes_.
12037 * output.h (class Output_data_group): Update constructor
12038 declaration. Rename input_sections_ to input_shndxes_.
12039 * testsuite/many_sections_test.cc: Add template.
12040
e94cf127
CC
120412008-04-30 Cary Coutant <ccoutant@google.com>
12042
4418b2d5
CC
12043 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12044
e94cf127
CC
12045 * layout.cc (Layout::include_section): Refactored check for debug
12046 info section.
12047 (Layout::add_comdat): Add new parameters. Change type
12048 of signature parameter. Add object and shndx to signatures table.
12049 (Layout::find_kept_object): New function.
12050 * layout.h: Include <cstring>.
12051 (Layout::is_debug_info_section): New function.
12052 (Layout::add_comdat): Add new parameters.
12053 (Layout::find_kept_object): New function.
12054 (Layout::Kept_section): New struct.
12055 (Layout::Signatures): Change type of map range.
12056 * object.cc (Relobj::output_section_address): New function.
12057 (Sized_relobj::include_section_group): Add new parameters. Change
12058 calls to Layout::add_comdat. Change to build table of kept comdat
12059 groups and table mapping discarded sections to kept sections.
12060 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12061 (Sized_relobj::do_layout): Change calls to include_section_group and
12062 include_linkonce_section.
12063 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12064 value to zero when section is discarded.
12065 (Sized_relobj::map_to_kept_section): New function.
12066 * object.h (Relobj::output_section_address): New function.
12067 (Relobj::Comdat_group): New type.
12068 (Relobj::find_comdat_group): New function.
12069 (Relobj::Comdat_group_table): New type.
12070 (Relobj::Kept_comdat_section): New type.
12071 (Relobj::Kept_comdat_section_table): New type.
12072 (Relobj::add_comdat_group): New function.
12073 (Relobj::set_kept_comdat_section): New function.
12074 (Relobj::get_kept_comdat_section): New function.
12075 (Relobj::comdat_groups_): New field.
12076 (Relobj::kept_comdat_sections_): New field.
12077 (Symbol_value::input_value): Update comment.
12078 (Sized_relobj::map_to_kept_section) New function.
12079 (Sized_relobj::include_linkonce_section): Add new parameter.
12080 * target-reloc.h (Comdat_behavior): New type.
12081 (get_comdat_behavior): New function.
12082 (relocate_section): Add code to map a discarded section to the
12083 corresponding kept section when applying a relocation.
12084
e4e5049b
CS
120852008-04-30 Craig Silverstein <csilvers@google.com>
12086
12087 * dwarf_reader.cc (next_generation_count): New static var.
12088 (Addr2line_cache_entry): New struct.
12089 (addr2line_cache): New static var.
12090 (Dwarf_line_info::one_addr2line): Added caching.
12091 (Dwarf_line_info::clear_addr2line_cache): New function.
12092 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12093 cache-size parameter.
12094 (Dwarf_line_info::one_addr2line_cache): New function.
12095 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12096 new cache-size argument to one_addr2line(), and clear cache.
12097
d09e9154
CC
120982008-04-28 Cary Coutant <ccoutant@google.com>
12099
12100 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12101 R_386_PC8 relocations.
12102
7ef73768
ILT
121032008-04-23 Ian Lance Taylor <iant@google.com>
12104
55438702
ILT
12105 * object.cc (Sized_relobj::include_section_group): Check for
12106 invalid section group.
12107
c165fb93
ILT
12108 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12109 header size.
12110
7ef73768
ILT
12111 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12112 than read for file header.
12113 * archive.cc (Archive::include_member): Likewise.
12114
6194aaab
L
121152008-04-23 Paolo Bonzini <bonzini@gnu.org>
12116
12117 * aclocal.m4: Regenerate.
12118 * configure: Regenerate.
12119
d491d34e
ILT
121202008-04-19 Ian Lance Taylor <iant@google.com>
12121
5ea2bac6
ILT
12122 * version.cc (version_string): Bump to 1.6.
12123
7bc3e21a
ILT
12124 * testsuite/Makefile.am (many_sections_r_test): New target.
12125 (many_sections_r_test_SOURCES): Remove.
12126 (many_sections_r_test_DEPENDENCIES): Remove.
12127 (many_sections_r_test_LDFLAGS): Remove.
12128 (many_sections_r_test_LDADD): Remove.
12129
7fcd3aa9
ILT
12130 * object.cc (Sized_relobj::do_add_symbols): Always pass
12131 local_symbol_count_ to add_from_relobj.
12132
4c94d6ae
ILT
12133 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12134 every thousand variables.
12135 * testsuite/Makefile.in: Rebuild.
12136
d491d34e
ILT
12137 * object.cc (Xindex::initialize_symtab_xindex): New function.
12138 (Xindex::read_symtab_xindex): New function.
12139 (Xindex::sym_xindex_to_shndx): New function.
12140 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12141 available.
12142 (Sized_relobj::do_initialize_xindex): New function.
12143 (Sized_relobj::do_read_symbols): Adjust section links.
12144 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12145 parameter. Change all callers.
12146 (Sized_relobj::include_section_group): Adjust section links and
12147 symbol section indexes.
12148 (Sized_relobj::do_layout): Adjust section links.
12149 (Sized_relobj::do_count_local_symbols): Adjust section links and
12150 symbol section indexes.
12151 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12152 ordinary and special symbols.
12153 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12154 dynsym_xindex parameters. Change all callers. Adjust section
12155 links. Use SHN_XINDEX when needed.
12156 (Sized_relobj::get_symbol_location_info): Adjust section links.
12157 Don't get fooled by special symbols.
12158 * object.h (class Xindex): Define.
12159 (class Object): Add xindex_ parameter. Declare virtual functoin
12160 do_initialize_xindex.
12161 (Object::adjust_sym_shndx): New function.
12162 (Object::set_xindex): New protected function.
12163 (class Symbol_value): Add is_ordinary_shndx_ field.
12164 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12165 (Symbol_value::value): Assert ordinary section.
12166 (Symbol_value::initialize_input_to_output_map): Likewise.
12167 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12168 Change all callers.
12169 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12170 all callers.
12171 (class Sized_relobj): Update declarations.
12172 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12173 parameter. Change all callers.
12174 (Sized_relobj::adjust_shndx): New function.
12175 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12176 field.
12177 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12178 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12179 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12180 (Sized_dynobj::read_dynsym_section): Adjust section links.
12181 (Sized_dynobj::read_dynamic): Likewise.
12182 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12183 section links.
12184 (Sized_dynobj::do_initialize_xindex): New function.
12185 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12186 do_initialize_xindex.
12187 (Sized_dynobj::adjust_shndx): New function.
12188 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12189 dynsym_xindex_ fields.
12190 (Layout::finalize): Add a call to set_section_indexes before
12191 creating the symtab sections.
12192 (Layout::set_section_indexes): Don't do anything if the section
12193 already has a section index.
12194 (Layout::create_symtab_sections): Add shnum parameter. Change
12195 caller. Create .symtab_shndx section if needed.
12196 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12197 caller.
12198 (Layout::allocated_output_section_count): New function.
12199 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12200 needed.
12201 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12202 fields. Update declarations.
12203 (Layout::symtab_xindex): New function.
12204 (Layout::dynsym_xindex): New function.
12205 (class Write_symbols_task): Add layout_ field.
12206 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12207 Change caller.
12208 * output.cc (Output_section_headers::Output_section_headers): Add
12209 shstrtab_section parameter. Change all callers.
12210 (Output_section_headers::do_sized_write): Store overflow values
12211 for section count and section string table section index in
12212 section header zero.
12213 (Output_file_header::do_sized_write): Check for overflow of
12214 section count and section string table section index.
12215 (Output_symtab_xindex::do_write): New function.
12216 (Output_symtab_xindex::endian_do_write): New function.
12217 * output.h (class Output_section_headers): Add shstrtab_section_.
12218 Update declarations.
12219 (class Output_symtab_xindex): Define.
12220 (Output_section::has_out_shndx): New function.
12221 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12222 field.
12223 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12224 Change all callers.
12225 (Sized_symbol::init): Likewise.
12226 (Symbol::output_section): Check for ordinary symbol.
12227 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12228 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12229 callers.
12230 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12231 Change all callers. Simplify handling of symbols from sections
12232 not included in the link.
12233 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12234 distinction.
12235 (Weak_alias_sorter::operator()): Assert that symbols are
12236 ordinary.
12237 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12238 distinction.
12239 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12240 parameters. Change all callers.
12241 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12242 symbol distinction. Use SHN_XINDEX when needed.
12243 (Symbol_table::write_section_symbol): Add symtab_xindex
12244 parameter. Change all callers.
12245 (Symbol_table::sized_write_section_symbol): Likewise. Use
12246 SHN_XINDEX when needed.
12247 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12248 declarations.
12249 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12250 (Symbol::is_defined): Check is_ordinary.
12251 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12252 (Symbol::is_absolute, Symbol::is_common): Likewise.
12253 (class Sized_symbol): Update declarations.
12254 (class Symbol_table): Update declarations.
12255 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12256 parameters. Change all callers.
12257 (Sized_symbol::override): Likewise.
12258 (Symbol_table::override): Likewise.
12259 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12260 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12261 is_ordinary, and orig_st_shndx parameters. Change all callers.
12262 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12263 to be in an ordinary section.
12264 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12265 object and is_ordinary parameters. Change all callers.
12266 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12267 Change all callers. Don't add undefined or non-ordinary symbols
12268 to reloc_map_.
12269 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12270 Change all callers.
12271 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12272 declarations.
12273 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12274 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12275 (Sized_relobj::relocate_sections): Likewise.
12276 * target-reloc.h (scan_relocs): Adjust section symbol index.
12277 (scan_relocatable_relocs): Likewise.
12278 * i386.cc (Scan::local): Check for ordinary symbols.
12279 * sparc.cc (Scan::local): Likewise.
12280 * x86_64.cc (Scan::local): Likewise.
12281 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12282 to symbol_section_and_value.
12283 * testsuite/many_sections_test.cc: New file.
12284 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12285 (check_PROGRAMS): Add many_sections_test.
12286 (many_sections_test_SOURCES): Define.
12287 (many_sections_test_DEPENDENCIES): Define.
12288 (many_sections_test_LDFLAGS): Define.
12289 (BUILT_SOURCES): Add many_sections_define.h.
12290 (many_sections_define.h): New target.
12291 (BUILT_SOURCES): Add many_sections_check.h.
12292 (many_sections_check.h): New target.
12293 (check_PROGRAMS): Add many_sections_r_test.
12294 (many_sections_r_test_SOURCES): Define.
12295 (many_sections_r_test_DEPENDENCIES): Define.
12296 (many_sections_r_test_LDFLAGS): Define.
12297 (many_sections_r_test_LDADD): Define.
12298 (many_sections_r_test.o): New target.
12299 * testsuite/Makefile.in: Rebuild.
12300
c5818ff1
CC
123012008-04-17 Cary Coutant <ccoutant@google.com>
12302
12303 * errors.cc (Errors::info): New function.
12304 (gold_info): New function.
12305 * errors.h (Errors::info): New function.
12306 * gold.h (gold_info): New function.
12307 * object.cc (Input_objects::add_object): Print trace output.
12308 * options.cc (options::parse_set): New function.
12309 (General_options::parse_wrap): Deleted.
12310 (General_options::General_options): Deleted initializer.
12311 * options.h (options::String_set): New typedef.
12312 (options::parse_set): New function.
12313 (DEFINE_set): New macro.
12314 (General_options::wrap): Changed to use DEFINE_set. Changed
12315 callers of any_wrap_symbols and is_wrap_symbol.
12316 (General_options::trace, General_options::trace_symbol):
12317 New options.
12318 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12319 (General_options::wrap_symbols_): Deleted.
12320 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12321
b5be4a7c
DM
123222008-04-17 David S. Miller <davem@davemloft.net>
12323
12324 * options.cc (General_options::parse_V): New function.
12325 * options.h: Add entries for -V and -Qy.
12326
155a0dd7
ILT
123272008-04-17 Ian Lance Taylor <iant@google.com>
12328
12329 * common.cc (Symbol_table::allocate_commons): Remove options
12330 parameter. Change caller.
12331 (Symbol_table::do_allocate_commons): Remove options parameter.
12332 Change caller. Just call do_allocate_commons_list twice.
12333 (Symbol_table::do_allocate_commons_list): New function, broken out
12334 of do_allocate_commons.
12335 * common.h (class Allocate_commons_task): Remove options_ field.
12336 Update constructor.
12337 * symtab.cc (Symbol_table::Symbol_table): Initialize
12338 tls_commons_.
12339 (Symbol_table::add_from_object): Put TLS common symbols on
12340 tls_commons_ list.
12341 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12342 which are IN_OUTPUT_DATA.
12343 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12344 allocate_commons and do_allocate_commons declarations. Declare
12345 do_allocate_commons_list.
12346 * gold.cc (queue_middle_tasks): Update creation of
12347 Allocate_commons_task to not pass options.
12348 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12349 (TLS_TEST_C_FLAGS): New variable.
12350 (tls_test_c_pic.o): New target.
12351 (tls_test_shared.so): Link in tls_test_c_pic.o.
12352 (tls_test_c_pic_ie.o): New target.
12353 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12354 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12355 (tls_test_c.o): New target.
12356 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12357 (tls_pic_test_LDADD): Likewise.
12358 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12359 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12360 (tls_test_c_gnu2.o): New target.
12361 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12362 tls_test_c_gnu2.o.
12363 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12364 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12365 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12366 * testsuite/tls_test.cc: Include "config.h".
12367 (t_last): Call t11_last.
12368 * testsuite/tls_test.h (t11, t11_last): Declare.
12369 * testsuite/tls_test_c.c: New file.
12370 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12371 * configure.ac: Check for OpenMP support.
12372 * configure, config.in, Makefile.in: Rebuild.
12373 * testsuite/Makefile.in: Rebuild.
12374
edfbb029
CC
123752008-04-16 Cary Coutant <ccoutant@google.com>
12376
12377 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12378 (Target_i386::tls_base_symbol_defined_): New field.
12379 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12380 (Target_i386::Scan::global): Likewise.
12381 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12382 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12383 (Target_x86_64::tls_base_symbol_defined_): New field.
12384 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12385 (Target_x86_64::Scan::global): Likewise.
12386
f3c69fca
CC
123872008-04-16 Cary Coutant <ccoutant@google.com>
12388
12389 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12390 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12391 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12392 building shared libraries.
12393 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12394 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12395 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12396 * testsuite/Makefile.in: Rebuild.
12397 * testsuite/weak_undef.h: New file.
12398 * testsuite/weak_undef_file1.cc: Add extra test cases.
12399 * testsuite/weak_undef_file2.cc: Likewise.
12400 * testsuite/weak_undef_test.cc: Likewise.
12401
7c414435
DM
124022008-04-16 David S. Miller <davem@davemloft.net>
12403
32b769e1
DM
12404 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12405 Add issued_non_pic_error_ field. Declare check_non_pic.
12406 (Target_sparc::Scan::check_non_pic): New function.
12407 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12408 (Target_sparc::Scan::global): Likewise.
12409
11936fb1
DM
12410 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12411 * configure: Rebuild.
12412
7c414435
DM
12413 * options.h (DEFINE_enable): New macro.
12414 (new_dtags): New enable option.
12415 (initfirst, interpose, loadfltr, nodefaultlib,
12416 nodelete, nodlopen, nodump): New -z options.
12417 * layout.cc (Layout:finish_dynamic_section): If new
12418 dtags enabled, emit DT_RUNPATH. Also, emit a
12419 DT_FLAGS_1 containing any specified -z flags.
12420
85c7bf8b
ILT
124212008-04-16 Ian Lance Taylor <iant@google.com>
12422
12c0daef
ILT
12423 * copy-relocs.cc: New file.
12424 * copy-relocs.h: New file.
12425 * reloc.cc: Remove Copy_relocs code.
12426 * reloc.h: Likewise.
12427 * reloc-types.h (struct Reloc_types) [both versions]: Add
12428 get_reloc_addend_noerror.
12429 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12430 variants of add_global which take an addend which must be zero.
12431 * i386.cc: Include "copy-relocs.h".
12432 (class Target_i386): Change type of copy_relocs_ to variable,
12433 update initializer.
12434 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12435 Change all callers.
12436 (Target_i386::do_finalize_sections): Change handling of
12437 copy_relocs_.
12438 * sparc.cc: Include "copy-relocs.h".
12439 (class Target_sparc): Change type of copy_relocs_ to variable,
12440 update initializer.
12441 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12442 Change all callers.
12443 (Target_sparc::do_finalize_sections): Change handling of
12444 copy_relocs_.
12445 * x86_64.cc: Include "copy-relocs.h".
12446 (class Target_x86_64): Change type of copy_relocs_ to variable,
12447 update initializer.
12448 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12449 class. Change all callers.
12450 (Target_x86_64::do_finalize_sections): Change handling of
12451 copy_relocs_.
12452 * Makefile.am (CCFILES): Add copy-relocs.cc.
12453 (HFILES): Add copy-relocs.h.
12454
4f4995b6
ILT
12455 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12456
85c7bf8b
ILT
12457 * testsuite/script_test_4.sh: Permit leading zeroes.
12458
4f2a9edd
ILT
124592008-04-15 Ian Lance Taylor <iant@google.com>
12460
e6188289
ILT
12461 * script-sections.cc (Script_sections::create_segments): Use
12462 header_size_adjustment even when there is enough room for the
12463 headers.
12464 * testsuite/script_test_4.sh: New file.
12465 * testsuite/script_test_4.t: New file.
12466 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12467 (check_DATA): Add script_test_4.stdout.
12468 (MOSTLYCLEANFILES): Likewise.
12469 (script_test_4): New target.
12470 (script_test_4.stdout): New target.
12471 * testsuite/Makefile.in: Rebuild.
12472
4f2a9edd
ILT
12473 * sparc.cc: Add definitions for Output_data_plt_sparc class
12474 constants.
12475
f5314dd5
DM
124762008-04-14 David S. Miller <davem@davemloft.net>
12477
12478 * sparc.cc: New file.
12479 * Makefile.am (TARGETSOURCES): Add sparc.cc
12480 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12481 * configure.tgt: Document targ_extra_size and
12482 targ_extra_big_endian. Add entries for sparc-* and
12483 sparc64-*.
12484 * configure.ac: Handle targ_extra_size and
12485 targ_extra_big_endian.
12486 * Makefile.in: Rebuild.
12487 * configure: Likewise.
12488 * po/POTFILES.in: Likewise.
12489 * po/gold.pot: Likewise.
12490
154e0e9a
ILT
124912008-04-14 Ian Lance Taylor <iant@google.com>
12492
12493 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12494 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12495 in the name/type/flags to section mapping. Don't call
12496 allocate_output_section.
12497 (Layout::choose_output_section): Change parameter from adjust_name
12498 to is_input_section. Don't permit input sections after sections
12499 are attached to segments. Don't call allocate_output_section.
12500 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12501 not write_enable_output_section.
12502 (Layout::make_output_section): Don't push to
12503 unattached_section_list_ nor call attach_to_segment. Call
12504 attach_section_to_segment if sections are attached.
12505 (Layout::attach_sections_to_segments): New function.
12506 (Layout::attach_section_to_segment): New function.
12507 (Layout::attach_allocated_section_to_segment): Rename from
12508 attach_to_segment. Remove flags parameter.
12509 (Layout::allocate_output_section): Remove function.
12510 (Layout::write_enable_output_section): Remove function.
12511 * layout.h (class Layout): Update for above changes. Add new
12512 field sections_are_attached_.
12513 * output.h (Output_section::update_flags_for_input_section): New
12514 function.
12515 * output.cc (Output_section::add_input_section): Call
12516 update_flags_for_input_section.
12517 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12518
009a67a2
CC
125192008-04-11 Cary Coutant <ccoutant@google.com>
12520
12521 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12522 thought unnecessary.
12523 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12524
759b1a24
ILT
125252008-04-11 Ian Lance Taylor <iant@google.com>
12526
12527 * output.h (class Output_section_data): Remove inline definition
12528 of set_addralign.
12529 * output.cc (Output_section_data::set_addralign): New function.
12530
c2b45e22
CC
125312008-04-11 Cary Coutant <ccoutant@google.com>
12532
12533 Add support for TLS descriptors for i386 and x86_64.
12534 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12535 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12536 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12537 GOT_TYPE_TLS_DESC.
12538 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12539 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12540 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12541 relocations.
12542 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12543 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12544 Fix problem with initial-exec relocations.
12545 (Target_i386::Relocate::relocate_tls): Likewise.
12546 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12547 relaxation.
12548 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12549 support for section-plus-offset dynamic table entries.
12550 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12551 (Output_data_dynamic::Dynamic_entry): Add support for
12552 section-plus-offset dynamic table entries.
12553 (Output_data_dynamic::Classification): Likewise.
12554 (Output_data_dynamic::classification_): Renamed offset_.
12555 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12556 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12557 (Target_x86_64::make_plt_section): New function.
12558 (Target_x86_64::reserve_tlsdesc_entries): New function.
12559 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12560 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12561 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12562 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12563 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12564 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12565 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12566 add extra PLT entry for TLS descriptors.
12567 (Output_data_plt_x86_64::got_): New field.
12568 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12569 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12570 fields.
12571 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12572 descriptors.
12573 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12574 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12575 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12576 R_386_TLS_DESC_CALL relocations.
12577 (Target_x86_64::Scan::global): Likewise.
12578 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12579 for TLS descriptors.
12580 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12581 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12582 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12583 GD-to-IE relaxation.
12584 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12585 and TLS_DESCRIPTORS.
12586 * Makefile.in: Rebuild.
12587 * configure: Rebuild.
12588 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12589 (tls_test_shared2.so): New target.
12590 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12591 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12592 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12593 (tls_shared_gd_to_ie_test_LDADD): New variable.
12594 (tls_shared_gnu2_gd_to_ie_test): New target.
12595 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12596 New targets.
12597 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12598 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12599 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12600 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12601 (tls_shared_gnu2_test): New target.
12602 (tls_test_gnu2_shared.so): New target.
12603 (tls_shared_gnu2_test_SOURCES): New variable.
12604 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12605 (tls_shared_gnu2_test_LDFLAGS): New variable.
12606 (tls_shared_gnu2_test_LDADD): New variable.
12607 * testsuite/Makefile.in: Rebuild.
12608 * testsuite/Makefile.
12609
83bfb6b7
ILT
126102008-04-11 Ian Lance Taylor <iant@google.com>
12611
12612 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12613 justsyms.t.
12614 * testsuite/Makefile.in: Rebuild.
12615
12616 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12617 long.
12618 * testsuite/script_test_2.cc (main): Adjust test.
12619
706e1f5e
ILT
126202008-04-11 David S. Miller <davem@davemloft.net>
12621 Ian Lance Taylor <iant@google.com>
12622
12623 * options.h (General_options): Add entries for '-Y' and
12624 '-relax'.
12625 * options.cc (General_options:finalize): If -Y was used, add those
12626 entries to the library path instead of the default "/lib" and
12627 "/usr/lib".
12628
7c98e6bb
DM
126292008-04-11 David S. Miller <davem@davemloft.net>
12630
12631 * testsuite/justsyms.t: Start at 0x100.
12632 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
12633 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12634 long.
12635 * testsuite/script_test_2.cc: Adjust string and section length
12636 checks.
7c98e6bb 12637
99a37bfd
ILT
126382008-04-09 Ian Lance Taylor <iant@google.com>
12639
2cefc357
ILT
12640 PR gold/5996
12641 * script-sections.cc (Sections_element::allocate_to_segment): Add
12642 orphan parameter.
12643 (Output_section_definition::allocate_to_segment): Likewise.
12644 (Orphan_output_section::allocate_to_segment): Likewise.
12645 (Script_sections::attach_sections_using_phdrs_clause): Don't
12646 propagate non-PT_LOAD segments to orphan sections.
12647 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12648 readelf rather than objdump.
12649 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12650 .interp section and PT_INTERP segment are the same size.
12651 * testsuite/Makefile.in: Rebuild.
12652
99a37bfd
ILT
12653 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12654 aliases for symbols defined in the same object.
12655 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12656 (weak_alias_test_SOURCES): New variable.
12657 (weak_alias_test_DEPENDENCIES): New variable.
12658 (weak_alias_test_LDFLAGS): New variable.
12659 (weak_alias_test_LDADD): New variable.
12660 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12661 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12662 (weak_alias_test_3.o): New target.
12663 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12664 * testsuite/weak_alias_test_main.cc: New file.
12665 * testsuite/weak_alias_test_1.cc: New file.
12666 * testsuite/weak_alias_test_2.cc: New file.
12667 * testsuite/weak_alias_test_3.cc: New file.
12668
780e49c5
ILT
126692008-04-08 Ian Lance Taylor <iant@google.com>
12670
cdb0b8f5
ILT
12671 * options.h (class General_options): Add --noinhibit-exec option.
12672 * main.cc (main): Check --noinhibit-exec.
12673
0864d551
ILT
12674 * options.h (class General_options): Define --wrap as a special
12675 option. Add wrap_symbols_ field.
12676 (General_options::any_wrap_symbols): New function.
12677 (General_options::is_wrap_symbol): New function.
12678 * options.cc (General_options::parse_wrap): New function.
12679 (General_options::General_options): Initialize wrap_symbols_.
12680 * symtab.cc (Symbol_table::wrap_symbol): New function.
12681 (Symbol_table::add_from_object): Handle --wrap.
12682 * symtab.h (class Symbol_table): Declare wrap_symbol.
12683 * target.h (Target::wrap_char): New function.
12684 (Target::Target_info): Add wrap_char field.
12685 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12686 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12687 * testsuite/testfile.cc (Target_test::test_target_info):
12688 Likewise.
12689
789aa6de
ILT
12690 * errors.cc (Errors::undefined_symbol): Mention symbol version if
12691 there is one.
12692
2c38906f
ILT
12693 * layout.h (class Layout): Add added_eh_frame_data_ field.
12694 * layout.cc (Layout::Layout): Initialize new field.
12695 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12696 output section until we find a section we merged successfully.
12697 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12698 that the size be non-zero.
12699
780e49c5
ILT
12700 * merge.cc (Object_merge_map::get_output_offset): Remove inline
12701 qualifier.
12702
7fcd0256
ILT
127032008-04-08 Craig Silverstein <csilvers@google.com>
12704
12705 * configure.ac: Export new conditional variable HAVE_ZLIB.
12706 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12707 on HAVE_ZLIB.
12708 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12709 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12710
6835af53
ILT
127112008-04-07 Ian Lance Taylor <iant@google.com>
12712
e24f324c
ILT
12713 * version.cc (version_string): Set to "1.5".
12714
a036edd8
ILT
12715 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12716 Add issued_non_pic_error_ field. Declare check_non_pic.
12717 (Target_x86_64::Scan::check_non_pic): New function.
12718 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12719 (Target_x86_64::Scan::global): Likewise.
12720
624f8810
ILT
12721 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12722 addend parameter. Change caller. Handle merge sections.
12723 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12724 Address to Addend. Don't add in the result of
12725 local_section_offset, pass down the addend and use the returned
12726 value.
12727 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12728 Update declarations of local_section_offset and symbol_value.
12729 * testsuite/two_file_test_1.cc (t18): New function.
12730 * testsuite/two_file_test_2.cc (f18): New function.
12731 * testsuite/two_file_test_main.cc (main): Call t18.
12732 * testsuite/two_file_test.h (t18, f18): Declare.
12733
6835af53
ILT
12734 * configure.ac: Don't test for objdump, c++filt, or readelf.
12735 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12736 conditionals.
12737 (TEST_READELF): New variable.
12738 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12739 (check_PROGRAMS): Add two_file_strip_test.
12740 (two_file_strip_test): New target.
12741 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12742 (two_file_same_shared_strip_test_SOURCES): New variable.
12743 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12744 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12745 (two_file_same_shared_strip_test_LDADD): New variable.
12746 (two_file_shared_strip.so): New target.
12747 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12748 (ver_test_5.syms, ver_test_7.syms): Likewise.
12749 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12750 (strip_test_3.stdout): Use TEST_OBJDUMP.
12751 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12752
86925eef
CC
127532008-04-04 Cary Coutant <ccoutant@google.com>
12754
12755 * symtab.h (Symbol::is_weak_undefined): New function.
12756 (Symbol::is_strong_undefined): New function.
12757 (Symbol::is_absolute): New function.
12758 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12759 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12760 absolute symbols.
12761 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12762 (weak_undef_test): New target.
12763 * testsuite/Makefile.in: Rebuild.
12764 * testsuite/weak_undef_file1.cc: New file.
12765 * testsuite/weak_undef_file2.cc: New file.
12766 * testsuite/weak_undef_test.cc: New file.
12767
126f3ece
ILT
127682008-04-03 Craig Silverstein <csilvers@google.com>
12769
12770 * compressed_output.h (class Output_compressed_section): Use
12771 unsigned buffer.
12772 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12773 add zlib header.
12774 (zlib_compressed_suffix): Removed.
12775 (Output_compressed_section::set_final_data_size): Use unsigned
12776 buffers.
12777 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12778 Fix linker invocation.
12779 (flagstest_o_specialfile_and_compress_debug_sections):
12780 Likewise.
12781 * testsuite/Makefile.in: Regenerated.
12782
deae2a14
DM
127832008-04-02 David S. Miller <davem@davemloft.net>
12784
12785 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12786 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12787
70752818
ILT
127882008-04-02 Craig Silverstein <csilvers@google.com>
12789
12790 * TODO: New file.
12791
39d0cb0e
ILT
127922008-04-02 Ian Lance Taylor <iant@google.com>
12793
12794 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12795 parameters. Update for new key type to views_. Change all
12796 callers.
12797 (File_read::read): Adjust for byteshift in returned view.
12798 (File_read::add_view): New function, broken out of
12799 find_and_make_view.
12800 (File_read::make_view): New function, broken out of
12801 find_and_make_view.
12802 (File_read::find_or_make_view): Add offset and aligned
12803 parameters. Rewrite accordingly. Change all callers.
12804 (File_read::get_view): Add offset and aligned parameters. Adjust
12805 for byteshift in return value.
12806 (File_read::get_lasting_view): Likewise.
12807 * fileread.h (class File_read): Update declarations.
12808 (class File_read::View): Add byteshift_ field. Add byteshift to
12809 constructor. Add byteshift method.
12810 * archive.h (Archive::clear_uncached_views): New function.
12811 (Archive::get_view): Add aligned parameter. Change all callers.
12812 * object.h (Object::get_view): Add aligned parameter. Change all
12813 callers.
12814 (Object::get_lasting_view): Likewise.
12815
12816 * fileread.cc (File_read::release): Don't call clear_views if
12817 there are multiple objects.
12818 * fileread.h (File_read::clear_uncached_views): New function.
12819 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12820 on the archive.
12821
a1207466
CC
128222008-03-31 Cary Coutant <ccoutant@google.com>
12823
12824 Add thin archive support.
12825 * archive.cc (Archive::armagt): New const.
12826 (Archive::setup): Remove task parameter and calls to unlock.
12827 (Archive::unlock_nested_archives): New function.
12828 (Archive::read_header): Add nested_off parameter. Change
12829 all callers.
12830 (Archive::interpret_header): Likewise.
12831 (Archive::include_all_members): Change to handle thin
12832 archives.
12833 (Archive::include_member): Likewise.
12834 * archive.h (Archive::Archive): Add new parameters and
12835 initializers.
12836 (Archive::armagt): New const.
12837 (Archive::setup): Remove task parameter.
12838 (Archive::unlock_nested_archives): New function.
12839 (Archive::read_header): Add nested_off parameter.
12840 (Archive::interpret_header): Likewise.
12841 (Archive::Nested_archive_table): New typedef.
12842 (Archive::is_thin_archive_): New field.
12843 (Archive::nested_archives_): New field.
12844 (Archive::options_): New field.
12845 (Archive::dirpath_): New field.
12846 (Archive::task_): New field.
12847 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12848 for thin archives. Pass additional parameters to
12849 Archive::Archive. Unlock the archive file after calling
12850 Archive::setup.
cd536b21 12851
479f6503
ILT
128522008-03-29 Ian Lance Taylor <iant@google.com>
12853
686c8caf
ILT
12854 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12855 version symbol to be local.
12856 * testsuite/ver_test_4.sh: New file.
12857 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12858 (check_DATA): Add ver_test_4.syms.
12859 (ver_test_4.syms): New target.
12860 * testsuite/Makefile.in: Rebuild.
12861
ab794b6b
ILT
12862 * output.cc
12863 (Output_section::Input_section_sort_entry::has_priority): New
12864 function.
12865 (Output_section::Input_section_sort_entry::match_file_name): New
12866 function.
12867 (Output_section::Input_section_sort_entry::match_section_name):
12868 Remove.
12869 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12870 Remove.
12871 (Output_section::Input_section_sort_entry::match_section_file):
12872 Remove.
12873 (Output_section::Input_section_sort_compare::operator()): Rewrite
12874 using new Input_section_sort_entry functions. Sort crtbegin and
12875 crtend first. Sort sections with no priority before sections with
12876 a priority.
12877 * testsuite/initpri1.c (d3): Check j != 4.
12878 (cd5): New constructor/destructor function.
12879 (main): Check j != 2.
12880
479f6503
ILT
12881 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12882 new symbol when resolving, don't call set_is_default.
12883 * testsuite/ver_test_7.cc: New file.
12884 * testsuite/ver_test_7.sh: New file.
12885 * testsuite/Makefile.am (ver_test_7.so): New target.
12886 (ver_test_7.o): New target.
12887 (check_SCRIPTS): Add ver_test_7.sh.
12888 (check_DATA): Add ver_test_7.syms.
12889 (ver_test_7.syms): New target.
12890
2fd32231
ILT
128912008-03-28 Ian Lance Taylor <iant@google.com>
12892
12893 * layout.cc (Layout::layout): If we see an input section with a
12894 name that needs sorting, set the must_sort flag for the output
12895 section.
12896 (Layout::make_output_section): If the name of the output section
12897 indicates that it might require sorting, set the may_sort flag.
12898 * output.h (Output_section::may_sort_attached_input_sections): New
12899 function.
12900 (Output_section::set_may_sort_attached_input_sections): New
12901 function.
12902 (Output_section::must_sort_attached_input_sections): New
12903 function.
12904 (Output_section::set_must_sort_attached_input_sections): New
12905 function.
12906 (class Output_section): Declare Input_section_sort_entry. Define
12907 Input_section_sort_compare. Declare
12908 sort_attached_input_sections. Add new fields:
12909 may_sort_attached_input_sections_,
12910 must_sort_attached_input_sections_,
12911 attached_input_sections_are_sorted_.
12912 * output.cc (Output_section::Output_section): Initialize new
12913 fields.
12914 (Output_section::add_input_section): Add an entry to
12915 input_sections_ if may_sort or must_sort are true.
12916 (Output_section::set_final_data_size): Call
12917 sort_attached_input_sections if necessary.
12918 (Output_section::Input_section_sort_entry): Define new class.
12919 (Output_section::Input_section_sort_compare::operator()): New
12920 function.
12921 (Output_section::sort_attached_input_sections): New function.
12922 * configure.ac: Check whether the compiler supports constructor
12923 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12924 * testsuite/initpri1.c: New file.
12925 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12926 CONSTRUCTOR_PRIORITY.
12927 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12928 (initpri1_LDFLAGS): New variable.
12929 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12930
18e6b24e
ILT
129312008-03-27 Ian Lance Taylor <iant@google.com>
12932
49bdd526
ILT
12933 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12934 * testsuite/common_test_1.c: New file.
12935 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12936 (common_test_1_SOURCES): New variable.
12937 (common_test_1_DEPENDENCIES): New variable.
12938 (common_test_1_LDFLAGS): New variable.
12939
18e6b24e
ILT
12940 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12941 and commons_ correctly when NAME/VERSION does not override
12942 NAME/NULL.
12943 * testsuite/ver_test_6.c: New file.
12944 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12945 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12946 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12947
04bf7072
ILT
129482008-03-26 Ian Lance Taylor <iant@google.com>
12949
5871526f
ILT
12950 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12951 of an undefined symbol from a version script.
12952 * testsuite/Makefile.am (ver_test_5.so): New target.
12953 (ver_test_5.o): New target.
12954 (check_SCRIPTS): Add ver_test_5.sh.
12955 (check_DATA): Add ver_test_5.syms.
12956 (ver_test_5.syms): New target.
12957 * testsuite/ver_test_5.cc: New file.
12958 * testsuite/ver_test_5.script: New file.
12959 * testsuite/ver_test_5.sh: New file.
12960 * Makefile.in, testsuite/Makefile.in: Rebuild.
12961
04bf7072
ILT
12962 PR gold/5986
12963 Fix problems building gold with gcc 4.3.0.
12964 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12965 (gold_error_at_location, gold_warning_at_location): Use it.
12966 * configure.ac: Check whether we can compile and use a template
12967 function with a printf attribute.
12968 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12969 when jumping over bytes.
12970 * object.cc: Instantiate Object::read_section_data.
12971 * debug.h: Include <cstring>
12972 * dwarf_reader.cc: Include <algorithm>
12973 * main.cc: Include <cstring>.
12974 * options.cc: Include <cstring>.
12975 * output.cc: Include <cstring>.
12976 * script.cc: Include <cstring>.
12977 * script.h: Include <string>.
12978 * symtab.cc: Include <cstring> and <algorithm>.
12979 * target-select.cc: Include <cstring>.
12980 * version.cc: Include <string>.
12981 * testsuite/testmain.cc: Include <cstdlib>.
12982 * configure, config.in: Rebuild.
12983
874c5b28
ILT
129842008-03-25 Ian Lance Taylor <iant@google.com>
12985
819d6c3a
ILT
12986 * options.cc: Include "../bfd/bfdver.h".
12987 (options::help): Print bug reporting address.
12988
f4b2c6f5
ILT
12989 * version.cc (print_version): Adjust output for current value of
12990 BFD_VERSION_STRING.
12991
12992 * NEWS: New file.
12993
e96caa79
ILT
12994 * options.cc (options::help): Print list of supported targets.
12995 * target-select.h: Include <vector>.
12996 (class Target_selector): Make machine_, size_, and is_big_endian_
12997 fields const. Add bfd_name_ and instantiated_target_ fields.
12998 (Target_selector::Target_selector): Add bfd_name parameter.
12999 (Target_selector::recognize): Make non-virtual, call
13000 do_recognize.
13001 (Target_selector::recognize_by_name): Make non-virtual, call
13002 do_recognize_by_name.
13003 (Target_selector::supported_names): New function.
13004 (Target_selector::bfd_name): New function.
13005 (Target_selector::do_instantiate_target): New pure virtual
13006 function.
13007 (Target_selector::do_recognize): New virtual function.
13008 (Target_selector::do_recognize_by_name): New virtual function.
13009 (Target_selector::instantiate_target): New private function.
13010 (supported_target_names): Declare.
13011 * target-select.cc (Target_selector::Target_selector): Update for
13012 new parameter and fields.
13013 (select_target_by_name): Check that the name matches before
13014 calling recognize_by_name.
13015 (supported_target_names): New function.
13016 * i386.cc (class Target_selector_i386): Update Target_selector
13017 constructor call. Remove recognize and recognize_by_name. Add
13018 do_instantiate_target.
13019 * x86_64.cc (class Target_selector_x86_64): Likewise.
13020 * testsuite/testfile.cc (class Target_selector_test): Update for
13021 changes to Target_selector.
13022
874c5b28
ILT
13023 * README: Rewrite, with some notes on unsupported features.
13024
0a65a3a7
CC
130252008-03-24 Cary Coutant <ccoutant@google.com>
13026
13027 * i386.cc (Target_i386::Got_type): New enum declaration.
13028 (Target_i386::Scan::local): Updated callers of Output_data_got
13029 member functions.
13030 (Target_i386::Scan::global): Likewise.
13031 (Target_i386::Relocate::relocate): Likewise.
13032 (Target_i386::Relocate::relocate_tls): Likewise.
13033 * object.h (Got_offset_list): New class.
13034 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13035 (Sized_relobj::local_got_offset): Likewise.
13036 (Sized_relobj::set_local_got_offset): Likewise.
13037 (Sized_relobj::local_has_tls_got_offset): Removed.
13038 (Sized_relobj::local_tls_got_offset): Removed.
13039 (Sized_relobj::set_local_tls_got_offset): Removed.
13040 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13041 * output.cc (Output_data_got::add_global): Added got_type parameter.
13042 (Output_data_got::add_global_with_rel): Likewise.
13043 (Output_data_got::add_global_with_rela): Likewise.
13044 (Output_data_got::add_global_pair_with_rel): New function.
13045 (Output_data_got::add_global_pair_with_rela): New function.
13046 (Output_data_got::add_local): Added got_type parameter.
13047 (Output_data_got::add_local_with_rel): Likewise.
13048 (Output_data_got::add_local_with_rela): Likewise.
13049 (Output_data_got::add_local_pair_with_rel): New function.
13050 (Output_data_got::add_local_pair_with_rela): New function.
13051 (Output_data_got::add_global_tls): Removed.
13052 (Output_data_got::add_global_tls_with_rel): Removed.
13053 (Output_data_got::add_global_tls_with_rela): Removed.
13054 (Output_data_got::add_local_tls): Removed.
13055 (Output_data_got::add_local_tls_with_rel): Removed.
13056 (Output_data_got::add_local_tls_with_rela): Removed.
13057 * output.h (Output_data_got::add_global): Added got_type parameter.
13058 (Output_data_got::add_global_with_rel): Likewise.
13059 (Output_data_got::add_global_with_rela): Likewise.
13060 (Output_data_got::add_global_pair_with_rel): New function.
13061 (Output_data_got::add_global_pair_with_rela): New function.
13062 (Output_data_got::add_local): Added got_type parameter.
13063 (Output_data_got::add_local_with_rel): Likewise.
13064 (Output_data_got::add_local_with_rela): Likewise.
13065 (Output_data_got::add_local_pair_with_rel): New function.
13066 (Output_data_got::add_local_pair_with_rela): New function.
13067 (Output_data_got::add_global_tls): Removed.
13068 (Output_data_got::add_global_tls_with_rel): Removed.
13069 (Output_data_got::add_global_tls_with_rela): Removed.
13070 (Output_data_got::add_local_tls): Removed.
13071 (Output_data_got::add_local_tls_with_rel): Removed.
13072 (Output_data_got::add_local_tls_with_rela): Removed.
13073 * resolve.cc (Symbol::override_base_with_special): Removed
13074 reference to has_got_offset_ field.
13075 * symtab.cc (Symbol::init_fields): Replaced initialization
13076 of got_offset_ with got_offsets_. Removed initialization
13077 of has_got_offset_
53fcba31 13078 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
13079 (Symbol::got_offset): Likewise.
13080 (Symbol::set_got_offset): Likewise.
13081 (Symbol::has_tls_got_offset): Removed.
13082 (Symbol::tls_got_offset): Removed.
13083 (Symbol::set_tls_got_offset): Removed.
13084 (Symbol::got_offset_): Removed.
13085 (Symbol::tls_mod_got_offset_): Removed.
13086 (Symbol::tls_pair_got_offset_): Removed.
13087 (Symbol::got_offsets_): New field.
13088 (Symbol::has_got_offset): Removed.
13089 (Symbol::has_tls_mod_got_offset): Removed.
13090 (Symbol::has_tls_pair_got_offset): Removed.
13091 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13092 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13093 member functions.
13094 (Target_x86_64::Scan::global): Likewise.
13095 (Target_x86_64::Relocate::relocate): Likewise.
13096 (Target_x86_64::Relocate::relocate_tls): Likewise.
13097
bd52eafb
BE
130982008-03-25 Ben Elliston <bje@au.ibm.com>
13099
13100 * yyscript.y: Fix spelling error in comment.
13101
8b105e34
ILT
131022008-03-24 Ian Lance Taylor <iant@google.com>
13103
8ed814a9
ILT
13104 * options.h (class General_options): Define build_id option.
13105 * layout.h (class Layout): Declare write_build_id, create_note,
13106 create_build_id. Add build_id_note_ member.
13107 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13108 "libiberty.h", "md5.h", "sha1.h".
13109 (Layout::Layout): Initialize eh_frame_data_,
13110 eh_frame_hdr_section_, and build_id_note_.
13111 (Layout::finalize): Call create_build_id.
13112 (Layout::create_note): New function, broken out of
13113 Layout::create_gold_note.
13114 (Layout::create_gold_note): Call create_note.
13115 (Layout::create_build_id): New function.
13116 (Layout::write_build_id): New function.
13117 (Close_task_runner::run): Call write_build_id.
13118
8b105e34
ILT
13119 * x86_64.cc: Correct license to GPLv3.
13120
086a1841
ILT
131212008-03-23 Ian Lance Taylor <iant@google.com>
13122
13123 * options.cc: Include "demangle.h".
13124 (parse_optional_string): New function.
13125 (parse_long_option): Handle takes_optional_argument.
13126 (parse_short_option): Update dash_z initializer. Handle
13127 takes_optional_argument.
13128 (General_options::General_options): Initialize do_demangle_.
13129 (General_options::finalize): Set do_demangle_. Handle demangling
13130 style.
13131 * options.h (parse_optional_string): Declare.
13132 (struct One_option): Add optional_arg field. Update constructor.
13133 Update call constructor calls. Add takes_optional_argument
13134 function.
13135 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13136 (DEFINE_optional_string): Define.
13137 (General_options::demangle): Change from DEFINE_bool to
13138 DEFINE_optional_string.
13139 (General_options::no_demangle): New function.
13140 (General_options::do_demangle): New function.
13141 (General_options::set_do_demangle): New function.
13142 (General_options::execstack_status_): Move definition to end of
13143 class definition.
13144 (General_options::static_): Likewise.
13145 (General_options::do_demangle_): New field.
13146 * object.cc (big_endian>::get_symbol_location_info): Call
13147 Options::do_demangle, not Options::demangle.
13148 * symtab.cc (demangle): Likewise.
13149
cbb93e63
ILT
131502008-03-22 Ian Lance Taylor <iant@google.com>
13151
13152 * gold.h: Include <cstddef> and <sys/types.h>
13153 * options.h: Include <cstring>.
13154
ec531623
ILT
131552008-03-21 Ian Lance Taylor <iant@google.com>
13156
13157 * Added source code to GNU binutils.
This page took 0.771869 seconds and 4 git commands to generate.