2010-03-18 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/11396
* libcoff-in.h (pe_tdata): Add dont_strip_reloc.
* libcoff.h: Regenerated.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Clear F_RELFLG
if dont_strip_reloc is set.
(_bfd_XX_bfd_copy_private_bfd_data_common): Set
dont_strip_reloc on output if there is no .reloc and
IMAGE_FILE_RELOCS_STRIPPED isn't set in input.
(record_thumb_to_arm_glue, bfd_arm_process_before_allocation):
Change member name class to symbol_class.
* bfd/coff-i960.c (coff_i960_relocate_section) Rename variable
class to class_val. Change member name class to symbol_class.
* bfd/coff-rs6000.c (_bfd_xcoff_swap_aux_in)
(_bfd_xcoff_swap_aux_out): Rename arguments class to in_class.
* bfd/coff-stgo32.c (adjust_aux_in_post)
(adjust_aux_out_pre, adjust_aux_out_post): Rename arguments class
to in_class.
* bfd/coff64-rs6000.c (_bfd_xcoff64_swap_aux_in)
(_bfd_xcoff64_swap_aux_out): Rename arguments class to in_class.
* bfd/coffcode.h (coff_pointerize_aux_hook): Rename variable class
to n_sclass.
* bfd/coffgen.c (coff_write_symbol, coff_pointerize_aux): Rename
variables named class to n_sclass. (coff_write_symbols): Rename
variable class to sym_class. (bfd_coff_set_symbol_class): Rename
argument class to symbol_class.
* bfd/cofflink.c (_bfd_coff_link_hash_newfunc)
(coff_link_add_symbols, _bfd_coff_link_input_bfd)
(_bfd_coff_write_global_sym, _bfd_coff_generic_relocate_section):
Update code to use renamed members.
* bfd/coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Rename
argument class to in_class.
* bfd/libcoff-in.h (struct coff_link_hash_entry, struct
coff_debug_merge_type) Renamed members class to symbol_class and
type_class.
* bfd/libcoff.h Regenerated.
* bfd/peXXigen.c: (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out):
Rename argument class to in_class.
* bfd/pef.c (bfd_pef_parse_imported_symbol): Update code to use
renamed members.
* bfd/pef.h (struct bfd_pef_imported_symbol): Changed name of
member class to symbol_class.
* binutils/ieee.c (ieee_read_cxx_misc, ieee_read_cxx_class)
(ieee_read_reference): Rename variables named class to cxxclass.
* gas/config/tc-arc.c (struct syntax_classes): Rename member class
to s_class. (arc_extinst): Rename variable class to
s_class. Update code to use renamed members.
* gas/config/tc-mips.c (insn_uses_reg): Rename argument class to
regclass.
* gas/config/tc-ppc.c (ppc_csect, ppc_change_csect, ppc_function)
(ppc_tc, ppc_is_toc_sym, ppc_symbol_new_hook, ppc_frob_label)
(ppc_fix_adjustable, md_apply_fix): Update code to use renamed
members.
* gas/config/tc-ppc.h (struct ppc_tc_sy): Change name of member
from class to symbol_class. (OBJ_COPY_SYMBOL_ATTRIBUTES): Update
code to use renamed members.
* gas/config/tc-score.c (s3_adjust_paritybit): Rename argument
class to i_class.
* gas/config/tc-score7.c (s7_adjust_paritybit): Rename argument
class to i_class.
* gprof/corefile.c (core_create_function_syms): Rename variable
class to cxxclass.
* include/coff/ti.h (GET_LNSZ_SIZE, PUT_LNSZ_SIZE): Updated name
of class variable to in_class to match changes in function that
use this macro.
* include/opcode/ia64.h (struct ia64_operand): Renamed member
class to op_class
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_load_symbols)
(gld${EMULATION_NAME}_try_needed): Rename variable class to
link_class
* opcodes/ia64-dis.c (print_insn_ia64): Update code to use renamed
member.
* opcodes/m88k-dis.c (m88kdis): Rename variable class to in_class.
* opcodes/tic80-opc.c (tic80_symbol_to_value)
(tic80_value_to_symbol): Rename argument class to symbol_class.
Stop using bfd_usrdata in libbfd.
* coff-stgo32.c (bfd_coff_go32stub): Remove.
(stub_bytes, comment): Replace STUBSIZE by GO32_STUBSIZE.
(adjust_filehdr_in_post): Declare the abfd parameter as unused.
Replace STUBSIZE by GO32_STUBSIZE. Save now the stub in
filehdr_dst->u.go32.stub. New comment with the reason.
(adjust_filehdr_out_pre): Replace STUBSIZE by GO32_STUBSIZE.
Substitute the removed macro bfd_coff_go32stub.
(adjust_filehdr_out_post, adjust_scnhdr_in_post, adjust_scnhdr_out_pre)
(adjust_scnhdr_out_post, adjust_aux_in_post, adjust_aux_out_pre)
(adjust_aux_out_post): Replace STUBSIZE by GO32_STUBSIZE.
(create_go32_stub, go32_stubbed_coff_bfd_copy_private_bfd_data):
Replace STUBSIZE by GO32_STUBSIZE. Substitute the removed macro
bfd_coff_go32stub.
* coffcode.h (coff_mkobject_hook): Initialize coff->go32stub.
* libcoff-in.h (coff_data_type): New field go32stub.
* libcoff.h: Regenerated.
include/coff/
Stop using bfd_usrdata in libbfd.
* go32exe.h (struct external_filehdr_go32_exe <stub>, FILHSZ): Replace
STUBSIZE by GO32_STUBSIZE.
(STUBSIZE): Move the definition ...
* internal.h (GO32_STUBSIZE): ... here and rename it.
(struct internal_filehdr <go32stub>, F_GO32STUB): New.
* libcoff-in.h (xcoff_tdata): Add a lineno_counts field.
* libcoff.h: Regenerate.
* xcofflink.c (xcoff_link_add_symbols): Record per-symbol
line-number counts in the bfd's lineno_counts field.
Don't keep per-csect line-number counts.
(xcoff_sweep): Don't update per-csect line-number counts.
(bfd_xcoff_size_dynamic_sections): Count the number of line-number
entries in each output section.
(xcoff_link_input_bfd): Get the number of line numbers from
the bfd's lineno_counts field, rather than recalculating it
from scratch. Fix the range check when updating C_BINCL and
C_EINCL symbols.
(_bfd_xcoff_bfd_final_link): Don't count the output line numbers
here. Don't expect csects to have line-number counts.
ld/testsuite/
* ld-powerpc/aix-lineno-1.s, ld-powerpc/aix-lineno-1.txt,
ld-powerpc/aix-lineno-1a.dd, ld-powerpc/aix-lineno-1a.nd,
ld-powerpc/aix-lineno-1b.dd, ld-powerpc/aix-lineno-1b.nd: New tests.
* ld-powerpc/aix52.exp: Run them. Copy aix-lineno-1.txt to tmpdir.
* libcoff-in.h (xcoff_tdata): Change debug_indices to a signed long.
* libcoff.h: Regenerate.
* xcofflink.c (xcoff_keep_symbol_p): New function, using the
"skip" logic from xcoff_link_input_bfd.
(bfd_xcoff_size_dynamic_sections): Explicitly skip dynamic
objects in a dynamic link, rather than checking whether csectpp
is null. Always allocate debug_index for other objects,
and always go through the loop. Update the type of debug_index
after the change above. Read the auxillary csect information
and use xcoff_keep_symbol_p to decide whether a symbol should
be kept. Set its debug_index to -2 if not.
(xcoff_link_input_bfd): Update the type of debug_index after
the change above and always expect it to be nonnull. Use it to
test whether a symbol should be stripped, rather than making the
decision here. Postpone all symbol creation to the second pass.
* libcoff-in.h (xcoff_section_tdata): Update commentary.
* libcoff.h: Regenerate.
* xcofflink.c (xcoff_link_add_symbols): Set the csect of XTY_ER
symbols to bfd_und_section_ptr or bfd_abs_section_ptr, rather than
the previous symbol's csect. Treat last_symndx as an inclusive value
and simplify its handling.
(xcoff_mark): Treat last_symndx as an inclusive value. Only mark
symbols with the right csect. Don't mark rsec when processing
relocations against undefined or absolute sections.
(bfd_xcoff_size_dynamic_sections): Don't check the SEC_MARK flag
of bfd_und_section_ptr.
(xcoff_link_input_bfd): Likewise.
* coff-alpha.c (alpha_ecoff_backend_data): Initialise fields which
control long section name handling with ECOFF_NO_LONG_SECTION_NAMES.
* coff-mips.c (mips_ecoff_backend_data): Likewise.
* coff-rs6000.c (bfd_xcoff_backend_data): Initialise fields which
control long section name handling with XCOFF_NO_LONG_SECTION_NAMES.
(bfd_pmac_xcoff_backend_data): Likewise.
* coff64-rs6000.c (bfd_xcoff_backend_data): Likewise.
(bfd_xcoff_aix5_backend_data): Likewise.
(xcoff64_write_object_contents): Delete unused long_section_names
local variable.
* coff-sh.c (bfd_coff_small_swap_table): Initialise long section
name members using COFF_DEFAULT_LONG_SECTION_NAMES and make entire
struct non-const.
* coffcode.h (documentation): Update to describe long section names.
(COFFLONGSECTIONCATHELPER): New helper macro.
(BLANKOR1TOODD): Likewise.
(COFF_ENABLE_LONG_SECTION_NAMES): Likewise.
(COFF_LONG_SECTION_NAMES_SETTER): Likewise.
(COFF_DEFAULT_LONG_SECTION_NAMES): Likewise.
(bfd_coff_set_long_section_names_allowed): New function.
(bfd_coff_set_long_section_names_disallowed): Likewise.
(struct bfd_coff_backend_data): Add new backend hook function
pointer _bfd_coff_set_long_section_names.
(bfd_coff_set_long_section_names): New backend hook.
(coff_write_object_contents): Only generate long section names if
bfd_coff_long_section_names() indicates they are currently enabled.
(bfd_coff_std_swap_table): Make non-const, and initialise long
section name fields using COFF_DEFAULT_LONG_SECTION_NAMES.
(ticoff0_swap_table): Likewise to both.
(ticoff1_swap_table): Again, likewise to both.
* coffgen.c (make_a_section_from_file): Allow long section names
as inputs even if not currently allowed for outputs.
* ecoff.c (_bfd_ecoff_no_long_sections): New function.
* efi-app-ia32.c (COFF_LONG_SECTION_NAMES): Define to 0, not blank.
* efi-app-ia64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-app-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-bsdrv-ia32.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-bsdrv-ia64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-bsdrv-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-rtdrv-ia32.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-rtdrv-ia64.c (COFF_LONG_SECTION_NAMES): Likewise.
* efi-rtdrv-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-arm.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-i386.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-mcore.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-mips.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-ppc.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-sh.c (COFF_LONG_SECTION_NAMES): Likewise.
* pei-x86_64.c (COFF_LONG_SECTION_NAMES): Likewise.
* libcoff-in.h: Update copyright year to cause updated copyright
year in generated libcoff.h, and fix typo.
* libcoff.h: Regenerated.
* libecoff.h (ECOFF_NO_LONG_SECTION_NAMES): New macro.
(_bfd_ecoff_no_long_sections): Add prototype.
* libxcoff.h (XCOFF_NO_LONG_SECTION_NAMES): New macro.
* pe-mips.c (COFF_LONG_SECTION_NAMES): Define empty if not already
defined by an including .c file.
* ticoff.h (ticoff0_swap_table): Make non-const, and initialise
long section name fields using COFF_DEFAULT_LONG_SECTION_NAMES.
(ticoff1_swap_table): Likewise to both.
ld/ChangeLog
* ld.texinfo: Update to mention long section name options.
* NEWS: Mention new behaviour and command-line options.
* pe-dll.c (pe_use_coff_long_section_names): New global variable.
(pe_output_file_set_long_section_names): New function.
(pe_dll_build_sections): Call it on output BFDs.
(pe_exe_build_sections): Likewise.
(pe_dll_fill_sections): Likewise.
(pe_exe_fill_sections): Likewise.
* pe-dll.h (pe_use_coff_long_section_names): Declare extern.
(pe_output_file_set_long_section_names): Add prototype.
* pep-dll.c (pe_use_coff_long_section_names): Define pep_ alias.
(pe_output_file_set_long_section_names): Likewise.
* pep-dll.h (pep_use_coff_long_section_names): Declare extern.
(pep_output_file_set_long_section_names): Add prototype.
* pe.em (OPTION_ENABLE_LONG_SECTION_NAMES): New getopt value macro.
(OPTION_DISABLE_LONG_SECTION_NAMES): Likewise.
(gld${EMULATION_NAME}_add_options): Add new options to xtra_long[].
(gld_${EMULATION_NAME}_list_options): Describe them.
(gld${EMULATION_NAME}_handle_option): Set or clear global
pe_use_coff_long_section_names flag when options recognised.
(gld_${EMULATION_NAME}_after_open): En/disable long section names
for main output bfd by calling pe_output_file_set_long_section_names.
* pep.em (enum options): Extend enum with new getopt option values.
(gld${EMULATION_NAME}_add_options): Add new options to xtra_long[].
(gld_${EMULATION_NAME}_list_options): Describe them.
(gld${EMULATION_NAME}_handle_option): Set or clear global
pe_use_coff_long_section_names flag when options recognised.
(gld_${EMULATION_NAME}_after_open): En/disable long section names
for main output bfd by calling pep_output_file_set_long_section_names.
ld/testsuite/ChangeLog
* ld-pe/longsecn-1.d: New test file.
* ld-pe/longsecn-2.d: Likewise.
* ld-pe/longsecn-3.d: Likewise.
* ld-pe/longsecn-4.d: Likewise.
* ld-pe/longsecn-5.d: Likewise.
* ld-pe/longsecn.d: Likewise.
* ld-pe/longsecn.exp: New test control script.
* ld-pe/longsecn.s: New test source file.
2005-05-23 Fred Fish <fnf@specifixinc.com>
* dwarf2.c (struct dwarf2_debug): Add inliner_chain member.
(struct funcinfo): Add caller_func, caller_file, caller_line.
tag, and nesting_level members.
(lookup_address_in_function_table): Change first passed parameter
from "struct funcinfo *" to "struct comp_unit *".
(lookup_address_in_function_table): Dereference unit to find function
table.
(lookup_address_in_function_table): Traverse the function list to
create a chain of inlined functions back to the first non inlined
function.
(scan_unit_for_functions): Remember tag and nesting level. Handle
DW_AT_call_file and DW_AT_call_line.
(comp_unit_find_nearest_line): Adjust lookup_address_in_function_table
call to pass unit pointer instead of function table pointer. For
inlined functions, save pointer to the inliner chain.
(_bfd_dwarf2_find_nearest_line): Initialize inliner_chain to NULL.
(_bfd_dwarf2_find_inliner_info): New function that returns information
from the inliner chain after a call to bfd_find_nearest_line.
* bfd.c (bfd_find_inliner_info): Define using BFD_SEND.
* targets.c (BFD_JUMP_TABLE_SYMBOLS): Add entry for
NAME##_find_inliner_info.
(bfd_target): Add _bfd_find_inliner_info.
* bfd-in2.h: Regenerate.
* libbfd-in.h (_bfd_nosymbols_find_inliner_info): Define as
macro that always returns bfd_false.
(_bfd_dwarf2_find_inliner_info): Declare.
* libbfd.h: Regenerate.
* elf32-arm.c (elf32_arm_find_inliner_info): New function
that calls _bfd_dwarf2_find_inliner_info.
(bfd_elf32_find_inliner_info): Define to elf32_arm_find_inliner_info.
* elfxx-mips.c (_bfd_mips_elf_find_inliner_info): New function
that calls _bfd_dwarf2_find_inliner_info.
* elfxx-mips.h (_bfd_mips_elf_find_inliner_info): Declare.
* elfn32-mips.c (bfd_elf32_find_inliner_info): Define to
_bfd_mips_elf_find_inliner_info.
* elf64-mips.c (bfd_elf64_find_inliner_info): Ditto.
* elf32-mips.c (bfd_elf32_find_inliner_info): Ditto.
* elf.c (_bfd_elf_find_inliner_info): New function that calls
_bfd_dwarf2_find_inliner_info.
* elf-bfd.h (_bfd_elf_find_inliner_info): Declare.
* elfxx-target.h (bfd_elfNN_find_inliner_info): Define to
_bfd_elf_find_inliner_info.
* coffgen.c (coff_find_inliner_info): New function that
calls _bfd_dwarf2_find_inliner_info.
* libcoff-in.h (coff_find_inliner_info): Declare.
* libcoff.h: Regenerate.
* coff-rs6000.c (rs6000coff_vec): Add coff_find_inliner_info.
(pmac_xcoff_vec) Ditto.
* coff64-rs6000.c (rs6000coff64_vec): Ditto.
(aix5coff64_vec): Ditto.
* aout-target.h (MY_find_inliner_info): Define as
_bfd_nosymbols_find_inliner_info.
* aout-tic30.c (MY_find_inliner_info): Ditto.
* binary.c (binary_find_inliner_info): Ditto.
* i386msdos.c (msdos_find_inliner_info): Ditto.
* ihex.c (ihex_find_inliner_info): Ditto.
* libaout.h (aout_32_find_inliner_info): Ditto.
* libecoff.h (_bfd_ecoff_find_inliner_info): Ditto.
* mach-o.c (bfd_mach_o_find_inliner_info): Ditto.
* mmo.c (mmo_find_inliner_info): Ditto.
* nlm-target.h (nlm_find_inliner_info): Ditto.
* pef.c (bfd_pef_find_inliner_info): Ditto.
* ppcboot.c (ppcboot_find_inliner_info): Ditto.
* srec.c (srec_find_inliner_info): Ditto.
* tekhex.c (tekhex_find_inliner_info): Ditto.
* versados.c (versados_find_inliner_info): Ditto.
* xsym.c (bfd_sym_find_inliner_info): Ditto.
* ieee.c (ieee_find_inliner_info): New function that always
returns FALSE.
* oasys.c (oasys_find_inliner_info): Ditto.
* vms.c (vms_find_inliner_info): Ditto.
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
* libcoff-in.h (coff_tdata): Add `strings_written' flag.
(obj_coff_strings_written): New accessor macro for above.
* libcoff.h: Regenerate.
* cofflink.c (_bfd_coff_final_link): Say that we wrote the
strings.
* coffcode.h (coff_write_object_contents): No need to write out
the string table if it's already been done.
* coff-i386.c (coff_i386_reloc): Handle R_IMAGEBASE.
(RTYPE2HOWTO): Return NULL if reloc type is out of range.
(coff_i386_rtype_to_howto): Likewise.
* coffcode.h (coff_slurp_symbol_table): Change a -2 to N_DEBUG.
Completely ignore symbols which are all zero.
(dummy_reloc16_estimate): Add return 0.
* cofflink.c (_bfd_coff_link_input_bfd): Rename inner scope
variable copy to name_copy to avoid shadowing outer scope
variable.
* libcoff-in.h (coff_data_type): Change raw_syment_count field
from unsigned int to unsigned long. Add timestamp field.
* libcoff.h: Rebuild.
Also comment changes.