Age | Commit message (Collapse) | Author | Files | Lines |
|
The newer update-copyright.py fixes file encoding too, removing cr/lf
on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
|
|
This patch removes the bfd_malloc in default_indirect_link_order and
bfd_simple_get_relocated_section_contents, pushing the allocation down
to bfd_get_relocated_section_contents. The idea is to make use of the
allocation done with sanity checking in bfd_get_full_section_contents,
which is called by bfd_generic_get_relocated_section_contents.
Doing this exposed a bug in bfd_get_full_section_contents. With
relaxation it is possible that an input section rawsize is different
to the section size. In that case we want to use the larger of
rawsize (the on-disk size for input sections) and size.
* reloc.c (bfd_generic_get_relocated_section_contents),
* reloc16.c (bfd_coff_reloc16_get_relocated_section_contents),
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents),
* coff-sh.c (sh_coff_get_relocated_section_contents),
* elf-m10200.c (mn10200_elf_get_relocated_section_contents),
* elf-m10300.c (mn10300_elf_get_relocated_section_contents),
* elf32-avr.c (elf32_avr_get_relocated_section_contents),
* elf32-cr16.c (elf32_cr16_get_relocated_section_contents),
* elf32-crx.c (elf32_crx_get_relocated_section_contents),
* elf32-h8300.c (elf32_h8_get_relocated_section_contents),
* elf32-nds32.c (nds32_elf_get_relocated_section_contents),
* elf32-sh.c (sh_elf_get_relocated_section_contents),
* elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents):
Handle NULL data buffer.
* bfd.c (bfd_get_section_alloc_size): New function.
* bfd-in2.h: Regenerate.
* compress.c (bfd_get_full_section_contents): Correct section
malloc size.
* linker.c (default_indirect_link_order): Don't malloc memory
here before calling bfd_get_relocated_section_contents.
* simple.c (bfd_simple_get_relocated_section_contents): Likewise.
|
|
static variables like mips_hi16_list are nasty for applications using
bfd. It is possible when opening and closing bfds with mis-matched
hi/lo relocs to leave a stale section pointer on the list. That can
cause a segfault if multiple bfds are being processed.
Tidying the list when closing is sufficient to stop this happening
(and fixes small memory leaks). This patch goes further and moves
mips_hi16_list to where it belongs in the bfd tdata.
* elf32-mips.c (bfd_elf32_close_and_cleanup(: Define.
* elf64-mips.c (bfd_elf64_close_and_cleanup): Define.
* elfn32-mips.c (bfd_elf32_close_and_cleanup(: Define.
* elfxx-mips.c (struct mips_hi16): Move earlier.
(mips_hi16_list): Move to..
(struct mips_elf_obj_tdata): ..here.
(_bfd_mips_elf_close_and_cleanup): New function.
(_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_lo16_reloc),
(_bfd_elf_mips_get_relocated_section_contents): Adjust uses of
mips_hi16_list.
* elfxx-mips.h (_bfd_mips_elf_close_and_cleanup): Declare.
|
|
Access to section data during relocation processing should be bounds
checked, as it is in bfd_perform_relocation. bfd_perform_relocation
does these checks after any special_function is called. So a reloc
special_function needs to do its own bounds checking before accessing
section data. This patch adds many such checks to the mips backend.
Checking mips relocs is not without some difficulty. See the comment
in _bfd_mips_reloc_offset_in_range. In a multitple reloc sequence
applied to the same location, relocs that may appear somewhere other
than the last one of the sequence need to be treated specially since
they apply to the addend for the next relocation rather than the
section contents. If the addend is in the section then it needs to be
checked but not when the addend is in the reloc. check_inplace
handles this situation. _bfd_mips_reloc_offset_in_range with
check_shuffle handles the case where contents are shuffled before
applying the relocation.
PR 28306
* elf32-mips.c (_bfd_mips_elf32_gprel16_reloc): Check reloc
address using _bfd_mips_reloc_offset_in_range.
(gprel32_with_gp, mips16_gprel_reloc): Likewise.
* elf64-mips.c (mips_elf64_gprel32_reloc): Likewise.
(mips16_gprel_reloc): Likewise.
* elfn32-mips.c (mips16_gprel_reloc): Likewise.
(gprel32_with_gp): Check reloc address using
bfd_reloc_offset_in_range.
* elfxx-mips.h (enum reloc_check): Define.
(_bfd_mips_reloc_offset_in_range): Declare.
* elfxx-mips.c (needs_shuffle): New function.
(_bfd_mips_elf_reloc_unshuffle, _bfd_mips_elf_reloc_shuffle): Use it.
(_bfd_mips_reloc_offset_in_range): New function.
(_bfd_mips_elf_gprel16_with_gp): Move reloc address checks to
partial_inplace handling. Use bfd_reloc_offset_in_range.
(_bfd_mips_elf_lo16_reloc): Check reloc address using
bfd_reloc_offset_in_range.
(_bfd_mips_elf_generic_reloc): Check reloc address using
_bfd_mips_reloc_offset_in_range.
(mips_elf_calculate_relocation): Check reloc address before calling
mips_elf_nullify_got_load.
(_bfd_mips_elf_check_relocs): Likewise.
(mips_elf_read_rel_addend): Add sec param, check reloc address
before reading. Adjust callers.
(mips_elf_add_lo16_rel_addend): Add sec param, adjust callers.
|
|
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Use
bfd_malloc_and_get_section to read contents of .MIPS.options.
|
|
This changes the HOWTO macro to encode the howto.size field from a
value given in bytes. This of course requires editing all target
uses of HOWTO, a major pain, but makes it a little nicer to specify
new target HOWTOs. Object files before/after this patch are
unchanged in .data and .rodata.
bfd/
* reloc.c (HOWTO_RSIZE): Encode size in bytes.
(EMPTY_HOWTO): Adjust to keep it all zero.
* aout-ns32k.c, * aoutx.h, * coff-alpha.c, * coff-arm.c,
* coff-i386.c, * coff-mcore.c, * coff-mips.c, * coff-rs6000.c,
* coff-sh.c, * coff-tic30.c, * coff-tic4x.c, * coff-tic54x.c,
* coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c,
* elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c,
* elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-gen.c,
* elf32-h8300.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c,
* elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c,
* elf32-m68hc12.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c,
* elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c,
* elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s12z.c,
* elf32-s390.c, * elf32-score.c, * elf32-score7.c,
* elf32-sh-relocs.h, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
* elf32-visium.c, * elf32-wasm32.c, * elf32-xc16x.c,
* elf32-xgate.c, * elf32-xstormy16.c, * elf32-xtensa.c,
* elf32-z80.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-gen.c,
* elf64-mips.c, * elf64-mmix.c, * elf64-nfp.c, * elf64-ppc.c,
* elf64-s390.c, * elf64-x86-64.c, * elfn32-mips.c,
* elfnn-aarch64.c, * elfxx-ia64.c, * elfxx-loongarch.c,
* elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * mach-o-aarch64.c, * mach-o-arm.c,
* mach-o-i386.c, * mach-o-x86-64.c, * pdp11.c, * reloc.c,
* som.c, * vms-alpha.c: Adjust all uses of HOWTO.
* bfd-in2.h: Regenerate.
include/
* elf/arc-reloc.def: Adjust all uses of HOWTO.
|
|
Make them all zero size standard do-nothing howtos.
* elf32-csky.c (csky_elf_howto_table <R_CKCORE_NONE>): Correct howto.
* elf32-ft32.c (ft32_elf_howto_table <R_FT32_NONE>): Likewise.
* elf32-gen.c (dummy): Likewise.
* elf32-nds32.c (none_howto): Likewise.
* elf32-nios2.c (elf_nios2_r2_howto_table_rel <R_NIOS2_NONE>):
Likewise.
* elf32-pru.c (elf_pru_howto_table_rel <R_PRU_NONE>): Likewise.
* elf32-v850.c (v800_elf_howto_table <R_V810_NONE>): Likewise.
* elf64-gen.c (dummy): Likewise.
* elfn32-mips.c (elf_mips_howto_table_rela <R_MIPS_NONE): Likewise.
* elfxx-mips.c (none_howto): Likewise.
* reloc.c (none_howto): Likewise.
|
|
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Sanity check
intopt.size and remaining bytes in section for reginfo.
|
|
The result of running etc/update-copyright.py --this-year, fixing all
the files whose mode is changed by the script, plus a build with
--enable-maintainer-mode --enable-cgen-maint=yes, then checking
out */po/*.pot which we don't update frequently.
The copy of cgen was with commit d1dd5fcc38ead reverted as that commit
breaks building of bfp opcodes files.
|
|
Leaving entries on mips_hi16_list from a previous pass over relocs
leads to confusing bugs.
* elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents):
Free mips_hi16_list entries on error exit.
|
|
No need to use anything fancy, plain inline works just as well.
* bfd-in.h (INLINE): Don't define.
* bfd-in2.h: Regenerate.
* aoutx.h: Replace use of INLINE with inline.
* elf-eh-frame.c: Likewise.
* elf32-score7.c: Likewise.
* elfxx-mips.c: Likewise.
* ihex.c: Likewise.
* mach-o.c: Likewise.
* mmo.c: Likewise.
|
|
PR mips/28009
* bfd/elfxx-mips.c (_bfd_mips_elf_section_from_shdr,
_bfd_mips_elf_fake_sections): Mark LTO debug info as
SHT_MIPS_DWARF.
|
|
* sysdep.h: POISON_BFD_BOOLEAN: Define.
* aix5ppc-core.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h,
* aoutx.h, * arc-got.h, * archive.c, * archive64.c, * archures.c,
* bfd-in.h, * bfd.c, * bfdwin.c, * binary.c, * cache.c,
* coff-alpha.c, * coff-arm.c, * coff-arm.h, * coff-bfd.c,
* coff-bfd.h, * coff-go32.c, * coff-i386.c, * coff-ia64.c,
* coff-mcore.c, * coff-mips.c, * coff-rs6000.c, * coff-sh.c,
* coff-stgo32.c, * coff-tic30.c, * coff-tic4x.c, * coff-tic54x.c,
* coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c,
* coffcode.h, * coffgen.c, * cofflink.c, * compress.c,
* corefile.c, * cpu-aarch64.c, * cpu-aarch64.h, * cpu-alpha.c,
* cpu-arc.c, * cpu-arm.c, * cpu-arm.h, * cpu-avr.c, * cpu-bfin.c,
* cpu-bpf.c, * cpu-cr16.c, * cpu-cris.c, * cpu-crx.c,
* cpu-csky.c, * cpu-d10v.c, * cpu-d30v.c, * cpu-dlx.c,
* cpu-epiphany.c, * cpu-fr30.c, * cpu-frv.c, * cpu-ft32.c,
* cpu-h8300.c, * cpu-hppa.c, * cpu-i386.c, * cpu-ia64.c,
* cpu-iamcu.c, * cpu-ip2k.c, * cpu-iq2000.c, * cpu-k1om.c,
* cpu-l1om.c, * cpu-lm32.c, * cpu-m10200.c, * cpu-m10300.c,
* cpu-m32c.c, * cpu-m32r.c, * cpu-m68hc11.c, * cpu-m68hc12.c,
* cpu-m68k.c, * cpu-m9s12x.c, * cpu-m9s12xg.c, * cpu-mcore.c,
* cpu-mep.c, * cpu-metag.c, * cpu-microblaze.c, * cpu-mips.c,
* cpu-mmix.c, * cpu-moxie.c, * cpu-msp430.c, * cpu-mt.c,
* cpu-nds32.c, * cpu-nfp.c, * cpu-nios2.c, * cpu-ns32k.c,
* cpu-or1k.c, * cpu-pdp11.c, * cpu-pj.c, * cpu-powerpc.c,
* cpu-pru.c, * cpu-riscv.c, * cpu-rl78.c, * cpu-rs6000.c,
* cpu-rx.c, * cpu-s12z.c, * cpu-s390.c, * cpu-score.c,
* cpu-sh.c, * cpu-sparc.c, * cpu-spu.c, * cpu-tic30.c,
* cpu-tic4x.c, * cpu-tic54x.c, * cpu-tic6x.c, * cpu-tilegx.c,
* cpu-tilepro.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-vax.c,
* cpu-visium.c, * cpu-wasm32.c, * cpu-xc16x.c, * cpu-xgate.c,
* cpu-xstormy16.c, * cpu-xtensa.c, * cpu-z80.c, * cpu-z8k.c,
* dwarf1.c, * dwarf2.c, * ecoff-bfd.h, * ecoff.c, * ecofflink.c,
* elf-attrs.c, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-nacl.c,
* elf-nacl.h, * elf-properties.c, * elf-s390-common.c,
* elf-s390.h, * elf-strtab.c, * elf-vxworks.c, * elf-vxworks.h,
* elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c,
* elf32-arm.h, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c,
* elf32-bfin.h, * elf32-cr16.c, * elf32-cr16.h, * elf32-cris.c,
* elf32-crx.c, * elf32-csky.c, * elf32-csky.h, * elf32-d10v.c,
* elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-gen.c,
* elf32-h8300.c, * elf32-hppa.c, * elf32-hppa.h, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c,
* elf32-m68k.h, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c,
* elf32-metag.h, * elf32-microblaze.c, * elf32-mips.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-nios2.h, * elf32-or1k.c, * elf32-pj.c,
* elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c,
* elf32-rx.c, * elf32-s12z.c, * elf32-s390.c, * elf32-score.c,
* elf32-score.h, * elf32-score7.c, * elf32-sh-relocs.h,
* elf32-sh.c, * elf32-sparc.c, * elf32-spu.c, * elf32-spu.h,
* elf32-tic6x.c, * elf32-tic6x.h, * elf32-tilegx.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-v850.h,
* elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
* elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c,
* elf32-xtensa.c, * elf32-z80.c, * elf64-alpha.c, * elf64-bpf.c,
* elf64-gen.c, * elf64-hppa.c, * elf64-ia64-vms.c,
* elf64-mips.c, * elf64-mmix.c, * elf64-nfp.c, * elf64-ppc.c,
* elf64-ppc.h, * elf64-s390.c, * elf64-sparc.c,
* elf64-tilegx.c, * elf64-x86-64.c, * elfcode.h,
* elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c,
* elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c,
* elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h,
* elfxx-mips.c, * elfxx-mips.h, * elfxx-riscv.c, * elfxx-riscv.h,
* elfxx-sparc.c, * elfxx-sparc.h, * elfxx-target.h,
* elfxx-tilegx.c, * elfxx-tilegx.h, * elfxx-x86.c, * elfxx-x86.h,
* format.c, * genlink.h, * hash.c, * i386aout.c, * i386lynx.c,
* i386msdos.c, * ihex.c, * libaout.h, * libbfd-in.h,
* libbfd.c, * libcoff-in.h, * libecoff.h, * libpei.h,
* libxcoff.h, * linker.c, * mach-o-aarch64.c, * mach-o-arm.c,
* mach-o-i386.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h,
* merge.c, * mmo.c, * netbsd.h, * opncls.c, * pc532-mach.c,
* pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-sh.c,
* pe-x86_64.c, * peXXigen.c, * pef.c, * pei-arm.c, * pei-i386.c,
* pei-ia64.c, * pei-mcore.c, * pei-sh.c, * pei-x86_64.c,
* peicode.h, * plugin.c, * plugin.h, * ppcboot.c, * reloc.c,
* reloc16.c, * rs6000-core.c, * section.c, * simple.c, * som.c,
* som.h, * srec.c, * stabs.c, * syms.c, * targets.c, * tekhex.c,
* verilog.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * vms.h,
* wasm-module.c, * xcofflink.c, * xcofflink.h, * xsym.c,
* xsym.h: Replace bfd_boolean with bool, FALSE with false, and
TRUE with true throughout.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
|
|
There is really no need to write code like "foo != 0 ? TRUE : FALSE"
unless we had stupidly defined FALSE as something other than 0 or TRUE
as something other than 1. The simpler "foo != 0" does just as well.
Similarly "(condition == TRUE)" or "(condition == FALSE) can be
simplified to "(condition)" and "(!condition)" respectively.
I'll note that there is reason to use "integer_expression != 0" when
assigning a bfd_boolean rather than the simpler "integer_expression",
if you expect the variable to have 0 or 1 value. It's probably even a
good idea to not rely on implicit conversion if bfd_boolean were _Bool.
bfd/
* aoutx.h (aout_link_write_symbols): Don't cast boolean expression
to bfd_boolean.
* elf32-or1k.c (or1k_set_got_and_rela_sizes): Dont compare booleans
against FALSE.
* elf32-arc.c (name_for_global_symbol): Don't compare boolean to TRUE.
(is_reloc_PC_relative): Don't use "boolean_condition ? TRUE : FALSE".
(is_reloc_SDA_relative, is_reloc_for_GOT): Likewise.
(is_reloc_for_PLT, is_reloc_for_TLS): Likewise.
* elf32-arm.c (stm32l4xx_need_create_replacing_stub): Likewise.
* elf32-nds32.c (insert_nds32_elf_blank): Likewise.
* elf32-rx.c (rx_set_section_contents): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
* elfxx-mips.c (_bfd_mips_elf_ignore_undef_symbol): Likewise.
* mach-o.c (bfd_mach_o_read_command): Likewise.
* targets.c (bfd_get_target_info): Likewise.
binutils/
* dlltool.c (main): Don't use "boolean_condition ? TRUE : FALSE".
* dwarf.c (read_and_display_attr_value): Likewise.
(display_debug_str_offsets): Likewise.
* objdump.c (dump_bfd): Likewise.
* readelf.c (dump_section_as_strings): Likewise.
(dump_section_as_bytes): Likewise.
gas/
* atof-generic.c (FALSE, TRUE): Don't define.
* config/obj-elf.h (FALSE, TRUE): Don't define.
* config/obj-som.h (FALSE, TRUE): Don't define.
* config/tc-hppa.h (FALSE, TRUE): Don't define.
* config/tc-pdp11.c (FALSE, TRUE): Don't define.
* config/tc-iq2000.h (obj_fix_adjustable): Delete.
* config/tc-m32r.h (TC_FIX_ADJUSTABLE): Delete.
* config/tc-mt.h (obj_fix_adjustable): Delete.
* config/tc-nds32.h (TC_FIX_ADJUSTABLE): Delete.
* config/tc-arc.c (parse_opcode_flags): Simplify boolean expression.
(relaxable_flag, relaxable_operand, assemble_insn): Likewise.
(tokenize_extregister): Likewise.
* config/tc-csky.c (parse_opcode, get_operand_value): Likewise.
(parse_operands_op, parse_operands, md_assemble): Likewise.
* config/tc-d10v.c (build_insn): Likewise.
* config/tc-score.c (s3_gen_insn_frag): Likewise.
* config/tc-score7.c (s7_gen_insn_frag, s7_relax_frag): Likewise.
* config/tc-tic6x.c (tic6x_update_features, md_assemble): Likewise.
* config/tc-z80.c (emit_byte): Likewise.
include/
* opcode/aarch64.h (alias_opcode_p): Simplify boolean expression.
(opcode_has_alias, pseudo_opcode_p, optional_operand_p): Likewise.
(opcode_has_special_coder): Likewise.
ld/
* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Simplify
boolean expression.
* lexsup.c (parse_args): Likewise.
* pe-dll.c (pe_dll_id_target): Likewise.
opcodes/
* aarch64-opc.c (vector_qualifier_p): Simplify boolean expression.
(fp_qualifier_p, get_data_pattern): Likewise.
(aarch64_get_operand_modifier_from_value): Likewise.
(aarch64_extend_operator_p, aarch64_shift_operator_p): Likewise.
(operand_variant_qualifier_p): Likewise.
(qualifier_value_in_range_constraint_p): Likewise.
(aarch64_get_qualifier_esize): Likewise.
(aarch64_get_qualifier_nelem): Likewise.
(aarch64_get_qualifier_standard_value): Likewise.
(get_lower_bound, get_upper_bound): Likewise.
(aarch64_find_best_match, match_operands_qualifier): Likewise.
(aarch64_print_operand): Likewise.
* aarch64-opc.h (operand_has_inserter, operand_has_extractor): Likewise.
(operand_need_sign_extension, operand_need_shift_by_two): Likewise.
(operand_need_shift_by_four, operand_maybe_stack_pointer): Likewise.
* arm-dis.c (print_insn_mve, print_insn_thumb32): Likewise.
* tic6x-dis.c (tic6x_check_fetch_packet_header): Likewise.
(print_insn_tic6x): Likewise.
|
|
Correct return type of callbacks invoked by htab_traverse and other
hashtab.h functions to int, and one case of a callback invoked by
elf_link_hash_traverse to bfd_boolean.
* elf32-i386.c (elf_i386_finish_local_dynamic_symbol): Return int.
* elf64-ia64-vms.c (elf64_ia64_local_dyn_info_free): Likewise.
(elf64_ia64_local_dyn_sym_thunk): Likewise.
* elf64-x86-64.c (elf_x86_64_finish_local_dynamic_symbol): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_allocate_local_ifunc_dynrelocs),
(elfNN_aarch64_finish_local_dynamic_symbol): Likewise.
* elfnn-ia64.c (elfNN_ia64_local_dyn_info_free): Likewise.
(elfNN_ia64_local_dyn_sym_thunk): Likewise.
* elfnn-riscv.c (allocate_local_ifunc_dynrelocs): Likewise.
(riscv_pcrel_reloc_eq): Likewise.
(riscv_elf_finish_local_dynamic_symbol): Likewise.
* elfxx-sparc.c (allocate_local_dynrelocs): Likewise.
(finish_local_dynamic_symbol): Likewise.
* elfxx-x86.c (elf_x86_allocate_local_dynreloc): Likewise.
* elfxx-mips.c (mips_elf_resolve_got_page_ref): Likewise.
(mips_elf_count_got_symbols): Change return type to bfd_boolean.
|
|
This functions was changed to return an int in commit ece5ef60797f but
since bfd_boolean was an int typedef I lazily left all the ELF
relocate_section functions as returning bfd_boolean, except the SPU
one. In order to use _Bool or bool in place of bfd_boolean we need to
be fussy about the return types.
* elf-m10200.c (mn10200_elf_relocate_section): Return int.
* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
* elf32-arc.c (elf_arc_relocate_section): Likewise.
* elf32-arm.c (elf32_arm_relocate_section): Likewise.
* elf32-avr.c (elf32_avr_relocate_section): Likewise.
* elf32-bfin.c (bfin_relocate_section): Likewise.
(bfinfdpic_relocate_section): Likewise.
* elf32-cr16.c (elf32_cr16_relocate_section): Likewise.
* elf32-cris.c (cris_elf_relocate_section): Likewise.
* elf32-crx.c (elf32_crx_relocate_section): Likewise.
* elf32-csky.c (csky_elf_relocate_section): Likewise.
* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
* elf32-epiphany.c (epiphany_elf_relocate_section): Likewise.
* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
* elf32-frv.c (elf32_frv_relocate_section): Likewise.
* elf32-ft32.c (ft32_elf_relocate_section): Likewise.
* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
* elf32-m32c.c (m32c_elf_relocate_section): Likewise.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
* elf32-m68hc1x.h (elf32_m68hc11_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
* elf32-mep.c (mep_elf_relocate_section): Likewise.
* elf32-metag.c (elf_metag_relocate_section): Likewise.
* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
* elf32-moxie.c (moxie_elf_relocate_section): Likewise.
* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
* elf32-mt.c (mt_elf_relocate_section): Likewise.
* elf32-nds32.c (nds32_elf_relocate_section): Likewise.
* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
* elf32-or1k.c (or1k_elf_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-pru.c (pru_elf32_relocate_section): Likewise.
* elf32-rl78.c (rl78_elf_relocate_section): Likewise.
* elf32-rx.c (rx_elf_relocate_section): Likewise.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
(_bfd_score_elf_relocate_section): Likewise.
* elf32-score.h (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
* elf32-v850.c (v850_elf_relocate_section): Likewise.
* elf32-vax.c (elf_vax_relocate_section): Likewise.
* elf32-visium.c (visium_elf_relocate_section): Likewise.
* elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
* elf32-z80.c (z80_elf_relocate_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise.
(elf64_alpha_relocate_section): Likewise.
* elf64-bpf.c (bpf_elf_relocate_section): Likewise.
* elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
* elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
* elf64-mmix.c (mmix_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
* elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
* elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
* elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise.
* elfxx-mips.h (_bfd_mips_elf_relocate_section): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_relocate_section): Likewise.
* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
* elfxx-tilegx.h (tilegx_elf_relocate_section): Likewise.
|
|
bfd/ChangeLog:
* bfd-in.h (startswith): Add startswith function.
(CONST_STRNEQ): Remove.
* bfd-in2.h (startswith): Regenerate with make headers.
* archive.c (bfd_slurp_armap): Replace usage of CONST_STRNEQ with startswith.
(_bfd_slurp_extended_name_table): Likewise.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
* bfd.c (bfd_get_sign_extend_vma): Likewise.
(bfd_convert_section_size): Likewise.
(bfd_convert_section_contents): Likewise.
* coff-stgo32.c (go32exe_create_stub): Likewise.
(go32exe_check_format): Likewise.
* coffcode.h (styp_to_sec_flags): Likewise.
(GNU_DEBUGALTLINK): Likewise.
* coffgen.c (_bfd_coff_section_already_linked): Likewise.
(coff_gc_sweep): Likewise.
(bfd_coff_gc_sections): Likewise.
* cofflink.c (coff_link_add_symbols): Likewise.
(process_embedded_commands): Likewise.
* compress.c (bfd_is_section_compressed_with_header): Likewise.
(bfd_init_section_decompress_status): Likewise.
* dwarf2.c (find_debug_info): Likewise.
(place_sections): Likewise.
* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
* elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
(assign_section_numbers): Likewise.
(elfcore_grok_win32pstatus): Likewise.
* elf32-arm.c (cmse_scan): Likewise.
(elf32_arm_gc_mark_extra_sections): Likewise.
(elf32_arm_size_dynamic_sections): Likewise.
(is_arm_elf_unwind_section_name): Likewise.
* elf32-bfin.c (bfin_size_dynamic_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
* elf32-csky.c (csky_elf_size_dynamic_sections): Likewise.
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
* elf32-msp430.c (msp430_elf_relax_delete_bytes): Likewise.
* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
* elf32-tic6x.c (is_tic6x_elf_unwind_section_name): Likewise.
(elf32_tic6x_size_dynamic_sections): Likewise.
* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
(xtensa_is_insntable_section): Likewise.
(xtensa_is_littable_section): Likewise.
(xtensa_is_proptable_section): Likewise.
(xtensa_property_section_name): Likewise.
(xtensa_callback_required_dependence): Likewise.
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
* elf64-ia64-vms.c (is_unwind_section_name): Likewise.
(get_reloc_section): Likewise.
(elf64_ia64_size_dynamic_sections): Likewise.
(elf64_ia64_object_p): Likewise.
* elf64-mmix.c (mmix_elf_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elflink.c (elf_link_add_object_symbols): Likewise.
(_bfd_elf_gc_mark_extra_sections): Likewise.
(bfd_elf_parse_eh_frame_entries): Likewise.
(_bfd_elf_section_already_linked): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
* elfnn-ia64.c (is_unwind_section_name): Likewise.
(elfNN_ia64_size_dynamic_sections): Likewise.
(elfNN_ia64_object_p): Likewise.
* elfxx-mips.c (FN_STUB_P): Likewise.
(CALL_STUB_P): Likewise.
(CALL_FP_STUB_P): Likewise.
(_bfd_mips_elf_section_from_shdr): Likewise.
(_bfd_mips_elf_fake_sections): Likewise.
(_bfd_mips_elf_size_dynamic_sections): Likewise.
(_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_link): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
* elfxx-x86.c (elf_i386_is_reloc_section): Likewise.
(elf_x86_64_is_reloc_section): Likewise.
* hpux-core.c (thread_section_p): Likewise.
* libcoff.h (bfd_pei_p): Likewise.
* linker.c (REAL): Likewise.
(unwrap_hash_lookup): Likewise.
(_bfd_generic_link_add_one_symbol): Likewise.
* mmo.c (mmo_internal_write_section): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* pef.c (bfd_pef_print_symbol): Likewise.
* pei-x86_64.c (pex64_print_all_pdata_sections): Likewise.
* som.c (som_slurp_symbol_table): Likewise.
(som_slurp_armap): Likewise.
* wasm-module.c (wasm_compute_custom_section_file_position): Likewise.
binutils/ChangeLog:
* dlltool.c (scan_drectve_symbols): Replace usage of CONST_STRNEQ with startswith.
* emul_aix.c (ar_emul_aix_parse_arg): Likewise.
* objcopy.c (is_mergeable_note_section): Likewise.
* objdump.c (dump_dwarf_section): Likewise.
* prdbg.c (pr_method_type): Likewise.
(pr_class_baseclass): Likewise.
(tg_class_baseclass): Likewise.
* readelf.c (process_lto_symbol_tables): Likewise.
* stabs.c (ULLHIGH): Likewise.
(parse_stab_argtypes): Likewise.
(stab_demangle_function_name): Likewise.
gas/ChangeLog:
* config/tc-i386.c (md_parse_option): Replace usage of CONST_STRNEQ with startswith.
(x86_64_section_word): Likewise.
* config/tc-sparc.c (md_parse_option): Likewise.
gdb/ChangeLog:
* arm-tdep.c (show_disassembly_style_sfunc): Replace usage of CONST_STRNEQ with startswith.
(_initialize_arm_tdep): Likewise.
ld/ChangeLog:
* emultempl/aix.em: Replace usage of CONST_STRNEQ with startswith.
* emultempl/beos.em: Likewise.
* emultempl/elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* ldctor.c (ctor_prio): Likewise.
* ldelf.c (ldelf_try_needed): Likewise.
(ldelf_parse_ld_so_conf): Likewise.
(ldelf_after_open): Likewise.
(output_rel_find): Likewise.
(ldelf_place_orphan): Likewise.
* ldfile.c (ldfile_add_library_path): Likewise.
* ldlang.c (lang_add_input_file): Likewise.
* ldmain.c (get_sysroot): Likewise.
(get_emulation): Likewise.
(add_archive_element): Likewise.
* ldwrite.c (unsplittable_name): Likewise.
(clone_section): Likewise.
* lexsup.c (parse_args): Likewise.
* pe-dll.c (is_import): Likewise.
(pe_implied_import_dll): Likewise.
opcodes/ChangeLog:
* aarch64-dis.c (parse_aarch64_dis_option): Replace usage of CONST_STRNEQ with startswith.
* arc-dis.c (parse_option): Likewise.
* arm-dis.c (parse_arm_disassembler_options): Likewise.
* cris-dis.c (print_with_operands): Likewise.
* h8300-dis.c (bfd_h8_disassemble): Likewise.
* i386-dis.c (print_insn): Likewise.
* ia64-gen.c (fetch_insn_class): Likewise.
(parse_resource_users): Likewise.
(in_iclass): Likewise.
(lookup_specifier): Likewise.
(insert_opcode_dependencies): Likewise.
* mips-dis.c (parse_mips_ase_option): Likewise.
(parse_mips_dis_option): Likewise.
* s390-dis.c (disassemble_init_s390): Likewise.
* wasm32-dis.c (parse_wasm32_disassembler_options): Likewise.
|
|
In particular, bfd_get_full_section_contents rather than
bfd_get_section_contents so that compressed sections are handled
properly.
Necessary for mips if objdump is to not cache debug sections.
* elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Apply
all fixes to bfd_generic_get_relocated_section_contents since this
function was split out.
|
|
|
|
This tidies initialisation of target common sections, doing so using a
static initialiser rather than via code and deleting unnecessary
symbol_ptr_ptr variables (the one in asection is used instead).
The patch also initialises ecoff.c:bfd_debug_section using
BFD_FAKE_SECTION. That does change bfd_debug_section slightly,
output_section was NULL now bfd_debug_section, and symbol_ptr_ptr
was NULL now &bfd_debug_section.symbol, but I believe those changes
are safe.
bfd/
* ecoff.c (bfd_debug_section): Init using BFD_FAKE_SECTION.
(ecoff_scom_section, ecoff_scom_symbol): Statically init using
BFD_FAKE_SECTION and GLOBAL_SYM_INIT. Delete initialisation code.
(ecoff_scom_symbol_ptr): Delete.
* elf32-m32r.c (m32r_elf_scom_section, m32r_elf_scom_symbol),
(m32r_elf_scom_symbol_ptr),
* elf32-score.c (score_elf_scom_section, score_elf_scom_symbol),
(score_elf_scom_symbol_ptr),
* elf32-score7.c (score_elf_scom_section, score_elf_scom_symbol),
(score_elf_scom_symbol_ptr),
* elf32-tic6x.c (tic6x_elf_scom_section, tic6x_elf_scom_symbol),
(tic6x_elf_scom_symbol_ptr),
* elf32-v850.c (v850_elf_scom_section, v850_elf_scom_symbol),
(v850_elf_scom_symbol_ptr),
(v850_elf_tcom_section, v850_elf_tcom_symbol),
(v850_elf_tcom_symbol_ptr),
(v850_elf_zcom_section, v850_elf_zcom_symbol),
(v850_elf_zcom_symbol_ptr),
* elf64-mmix.c (mmix_elf_reg_section, mmix_elf_reg_section_symbol),
(mmix_elf_reg_section_symbol_ptr),
* elfxx-mips.c (mips_elf_scom_section, mips_elf_scom_symbol),
(mips_elf_scom_symbol_ptr): Likewise.
gas/
* ecoff.c (ecoff_frob_symbol): Rename scom_section to
ecoff_scom_section and statically initialise.
|
|
Also, undefined foo should constrain the visibility of foo@@v1 just as
it does for a later plain foo definition.
bfd/
PR 26979
* elf-bfd.h (elf_backend_merge_symbol_attribute): Update prototype.
* elf32-m68hc1x.h (elf32_m68hc11_merge_symbol_attribute): Likewise.
* elfxx-mips.h (_bfd_mips_elf_merge_symbol_attribute): Likewise.
* elfxx-x86.h (_bfd_x86_elf_merge_symbol_attribute): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_merge_symbol_attribute): Replace
isym parameter with st_other. Adjust code.
* elf64-alpha.c (elf64_alpha_merge_symbol_attribute): Likewise.
* elf64-ppc.c (ppc64_elf_merge_symbol_attribute): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_merge_symbol_attribute): Likewise.
* elfxx-mips.c (_bfd_mips_elf_merge_symbol_attribute): Likewise.
* elfxx-x86.c (_bfd_x86_elf_merge_symbol_attribute): Likewise.
* elflink.c (elf_merge_st_other): Likewise.
(_bfd_elf_merge_symbol, elf_link_add_object_symbols): Adjust to suit.
(_bfd_elf_copy_link_hash_symbol_type): Likewise.
(_bfd_elf_add_default_symbol): Merge st_other from undecorated
symbol and @VER symbol to @@VER symbol.
ld/
* testsuite/ld-elf/pr26979a.s,
* testsuite/ld-elf/pr26979b.s,
* testsuite/ld-elf/pr26979c.s,
* testsuite/ld-elf/pr26979.ver,
* testsuite/ld-elf/pr26979a.d,
* testsuite/ld-elf/pr26979b.d: New tests.
|
|
PR 26476
PR 26477
* elfxx-mips.c (CRINFO_CTYPE, CRINFO_RTYPE, CRINFO_DIST2TO),
(CRINFO_RELVADDR): Make unsigned.
(mips_elf_nullify_got_load): Use unsigned constant when shifting
into sign bit.
|
|
Another memset(0,0,0)
PR 26475
* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Check
sstubs->contents != NULL.
|
|
* elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table
before accessing elf_hash_table_id.
* elf32-arc.c (elf_arc_hash_table): Likewise.
* elf32-arm.c (elf32_arm_hash_table): Likewise.
* elf32-avr.c (avr_link_hash_table): Likewise.
* elf32-bfin.c (bfinfdpic_hash_table): Likewise.
* elf32-cris.c (elf_cris_hash_table): Likewise.
* elf32-csky.c (csky_elf_hash_table): Likewise.
* elf32-frv.c (frvfdpic_hash_table): Likewise.
* elf32-hppa.c (hppa_link_hash_table): Likewise.
* elf32-lm32.c (lm32_elf_hash_table): Likewise.
* elf32-m32r.c (m32r_elf_hash_table): Likewise.
* elf32-m68hc1x.h (m68hc11_elf_hash_table): Likewise.
* elf32-m68k.c (elf_m68k_hash_table): Likewise.
* elf32-metag.c (metag_link_hash_table): Likewise.
* elf32-microblaze.c (elf32_mb_hash_table): Likewise.
* elf32-nds32.h (nds32_elf_hash_table): Likewise.
* elf32-or1k.c (or1k_elf_hash_table): Likewise.
* elf32-s390.c (elf_s390_hash_table): Likewise.
* elf32-sh.c (sh_elf_hash_table): Likewise.
* elf32-spu.c (spu_hash_table): Likewise.
* elf32-tilepro.c (tilepro_elf_hash_table): Likewise.
* elf32-xtensa.c (elf_xtensa_hash_table): Likewise.
* elf64-alpha.c (alpha_elf_hash_table): Likewise.
* elf64-hppa.c (hppa_link_hash_table): Likewise.
* elf64-ia64-vms.c (elf64_ia64_hash_table): Likewise.
* elf64-s390.c (elf_s390_hash_table): Likewise.
* elfnn-ia64.c (elfNN_ia64_hash_table): Likewise.
* elfnn-riscv.c (riscv_elf_hash_table): Likewise.
* elfxx-mips.c (mips_elf_hash_table): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_hash_table): Likewise.
* elfxx-tilegx.c (tilegx_elf_hash_table): Likewise.
|
|
Unlike the previous patch setting SEC_SMALL_DATA during
elf_backend_symbol_processing, this patch is mostly cosmetic.
* elf32-frv.c (elf32_frv_add_symbol_hook): Set SEC_SMALL_DATA on
small common section.
* elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
* elf32-microblaze.c (microblaze_elf_add_symbol_hook): Likewise.
* elf32-nds32.c (nds32_elf_add_symbol_hook): Likewise.
* elf32-nios2.c (nios2_elf_add_symbol_hook): Likewise.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-score.c (s3_bfd_score_elf_add_symbol_hook): Likewise.
* elf32-score7.c (s7_bfd_score_elf_add_symbol_hook): Likewise.
* elf32-tic6x.c (elf32_tic6x_add_symbol_hook): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
(v850_elf_add_symbol_hook): Likewise.
* elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
* elf64-ia64-vms.c (elf64_ia64_add_symbol_hook): Likewise.
* elfnn-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise.
|
|
git commit 49d9fd42acef chose to make nm print 'C' for the normal
common section, and 'c' for other commons. This was an attempt to
make common symbols in .scommon and other small common sections show
a 'c' type without a section name comparison, but it failed for
nm --plugin on lto objects where normal common symbols are stashed in
a "plug" section. It's also wrong for large common symbols. So
instead set SEC_SMALL_DATA on sections created for small commons, and
key off that flag to show 'c' type. If your ELF target doesn't have
an elf_backend_symbol_processing function, then you won't see 'c' for
symbols in .scommon.
Note that due to bfd_decode_symclass decoding common symbols without
a chance for coff_section_type to treat .scommon specially, then
having .scommon in the array of special sections handled by
coff_section_type prior to 49d9fd42acef was entirely ineffective.
That fact escaped me when writing 49d9fd42acef. Unless .scommon
didn't have SEC_IS_COMMON set, which would be a little weird.
PR 26389
* syms.c (bfd_decode_symclass): Choose 'c' for commons only when
SEC_SMALL_DATA.
* elf32-m32r.c (_bfd_m32r_elf_symbol_processing): Set SEC_SMALL_DATA
on small common section.
* elf32-score.c (s3_bfd_score_elf_symbol_processing): Likewise.
* elf32-score7.c (s7_bfd_score_elf_symbol_processing): Likewise.
* elf32-tic6x.c (elf32_tic6x_symbol_processing): Likewise.
* elf32-v850.c (v850_elf_symbol_processing): Likewise.
* elfxx-mips.c (_bfd_mips_elf_symbol_processing): Likewise.
* ecoff.c (ecoff_set_symbol_info, ecoff_link_add_externals): Likewise.
|
|
Since many ELF backends have sym_cache to their link hash tables, add
sym_cache to elf_link_hash_table. Also use sdynbss and srelbss in
elf_link_hash_table.
* elf-bfd.h (sym_cache): Moved before elf_link_hash_table.
(elf_link_hash_table): Add sym_cache.
* elf32-arm.c (elf32_arm_link_hash_table): Remove sym_cache.
(elf32_arm_check_relocs): Updated.
(elf32_arm_size_dynamic_sections): Likewise.
* elf32-bfin.c (bfin_link_hash_table): Removed.
(bfin_link_hash_newfunc): Updated.
(bfin_hash_table): Removed.
* elf32-csky.c (csky_elf_link_hash_table): Remove sym_cache.
(csky_elf_check_relocs): Updated.
* elf32-hppa.c (elf32_hppa_link_hash_table): Remove sym_cache.
(elf32_hppa_check_relocs): Updated.
* elf32-i386.c (elf_i386_tls_transition): Updated.
(elf_i386_convert_load_reloc): Likewise.
(elf_i386_check_relocs): Likewise.
* elf32-m32r.c (elf_m32r_link_hash_table): Removed.
(m32r_elf_hash_table): Updated.
(m32r_elf_link_hash_table_create): Likewise.
(m32r_elf_create_dynamic_sections): Likewise.
(m32r_elf_adjust_dynamic_symbol): Likewise.
(allocate_dynrelocs): Likewise.
(m32r_elf_size_dynamic_sections): Likewise.
(m32r_elf_relocate_section): Likewise.
(m32r_elf_finish_dynamic_symbol): Likewise.
(m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.h (m68hc11_elf_link_hash_table): Remove
sym_cache.
* elf32-m68k.c (elf_m68k_link_hash_table): Likewise.
(elf_m68k_check_relocs): Updated.
* elf32-metag.c (elf_metag_link_hash_table): Remove sym_cache.
(elf_metag_check_relocs): Updated.
* elf32-microblaze.c (elf32_mb_link_hash_table): Remove sym_sec.
(microblaze_elf_check_relocs): Updated.
* elf32-nds32.c (nds32_elf_link_hash_table_create): Likewise.
(nds32_elf_create_dynamic_sections): Likewise.
(nds32_elf_adjust_dynamic_symbol): Likewise.
(nds32_elf_check_relocs): Likewise.
* elf32-nds32.h (elf_nds32_link_hash_table): Remove sdynbss,
srelbss and aym_cache.
* elf32-nios2.c (elf32_nios2_link_hash_table): Remove sym_cache.
(nios2_elf32_check_relocs): Updated.
* elf32-or1k.c (elf_or1k_link_hash_table): Remove sym_sec.
(or1k_elf_check_relocs): Updated.
* elf32-ppc.c (ppc_elf_check_relocs): Remove sym_cache.
(ppc_elf_check_relocs): Updated.
* elf32-s390.c (elf_s390_link_hash_table): Remove sym_cache.
(elf_s390_check_relocs): Updated.
(elf_s390_finish_dynamic_sections): Likewise.
* elf32-sh.c (elf_sh_link_hash_table): Remove sdynbss, srelbss
and aym_cache.
(sh_elf_create_dynamic_sections): Updated.
(sh_elf_adjust_dynamic_symbol): Likewise.
(sh_elf_size_dynamic_sections): Likewise.
(sh_elf_check_relocs): Likewise.
* elf32-tic6x.c (elf32_tic6x_link_hash_table): Remove sym_cache.
(elf32_tic6x_check_relocs): Updated.
* elf32-tilepro.c (tilepro_elf_link_hash_table): Removed.
(tilepro_elf_hash_table): Updated.
(tilepro_elf_link_hash_table_create): Likewise.
(tilepro_elf_check_relocs): Likewise.
(tilepro_elf_adjust_dynamic_symbol): Likewise.
(allocate_dynrelocs): Likewise.
(tilepro_elf_size_dynamic_sections): Likewise.
(tilepro_elf_relocate_section): Likewise.
(tilepro_elf_finish_dynamic_symbol): Likewise.
(tilepro_finish_dyn): Likewise.
(tilepro_elf_finish_dynamic_sections): Likewise.
* elf64-ppc.c (ppc_link_hash_table): Remove sym_cache.
(ppc64_elf_before_check_relocs): Updated.
(ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_link_hash_table): Remove sym_cache.
(elf_s390_check_relocs): Updated.
(elf_s390_relocate_section): Likewise.
(elf_s390_finish_dynamic_sections): Likewise.
* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
(elf_x86_64_check_relocs): Likewise.
* elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
sym_cache.
(elfNN_aarch64_check_relocs): Updated.
* elfnn-riscv.c (riscv_elf_link_hash_table): Remove sym_cache.
(riscv_elf_check_relocs): Updated.
* elfxx-mips.c (mips_elf_link_hash_table): Remove sym_cache.
(mips_elf_resolve_got_page_ref): Updated.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
sym_cache.
* elfxx-tilegx.c (tilegx_elf_link_hash_table): Likewise.
(tilegx_elf_check_relocs): Updated.
* elfxx-x86.h (elf_x86_link_hash_table): Remove sym_cache.
|
|
Make the MIPS/IRIX naming of local section symbols consistent between
files produced by generic ELF code and ELF linker code, complementing
commit 174fd7f95561 ("New bfd elf hook: force naming of local section
symbols"), <https://sourceware.org/ml/binutils/2004-02/msg00072.html>.
Local section symbols have no names in the standard ELF gABI, however
the lack of a name causes problems with IRIX's MIPSpro linker. To work
around the issue we give them names, however we do that in generic ELF
code only, based on what the `elf_backend_name_local_section_symbols'
hook returns if present. That makes objects created by GAS or `objdump'
work correctly, however not ones created by `ld -r'. That would not
normally cause issues with IRIX systems using GAS and `objdump' only
with the MIPSpro linker, however if GNU LD was used for whatever reason
in producing objects later fed to IRIX's MIPSpro linker, then things
would break.
Modify ELF linker code accordingly then, using the same hook. Adjust
the `ld-elf/64ksec-r' test accordingly so that it also accepts a section
symbol with a name.
Also modify the hook itself so that only actual ET_REL objects have
names assigned to local section symbols. Other kinds of ELF files are
not ever supposed to be relocated with the MIPSpro linker, so we can
afford producing more standard output.
Add suitable GAS, LD and `objcopy' test cases to the relevant testsuites
to keep these tools consistently verified. This change also fixes:
FAIL: objcopy executable (pr25662)
across MIPS targets using the IRIX compatibility mode.
bfd/
* elflink.c (bfd_elf_final_link): Give local symbols a name if
so requested.
* elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): Only
return TRUE if making ET_REL output.
binutils/
* testsuite/binutils-all/mips/global-local-symtab-sort-o32.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-sort-n32.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-sort-n64.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-final-o32.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-final-n32.d:
New test.
* testsuite/binutils-all/mips/global-local-symtab-final-n64.d:
New test.
* testsuite/binutils-all/mips/mips.exp: Run the new tests.
gas/
* testsuite/gas/mips/global-local-symtab-sort-o32.d: New test.
* testsuite/gas/mips/global-local-symtab-sort-o32t.d: New test.
* testsuite/gas/mips/global-local-symtab-sort-n32.d: New test.
* testsuite/gas/mips/global-local-symtab-sort-n32t.d: New test.
* testsuite/gas/mips/global-local-symtab-sort-n64.d: New test.
* testsuite/gas/mips/global-local-symtab-sort-n64t.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* testsuite/ld-elf/sec64k.exp: Also accept a section symbol with
a name.
* testsuite/ld-mips-elf/global-local-symtab-sort-o32.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-sort-o32t.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-sort-n32.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-sort-n32t.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-sort-n64.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-sort-n64t.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-final-o32.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-final-n32.d: New
test.
* testsuite/ld-mips-elf/global-local-symtab-final-n64.d: New
test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
|
|
Add target_os to elf_backend_data to identify target OS. Add target_os,
to elf_link_hash_table to identify target OS for linker output.
* elf-bfd.h (elf_target_os): New.
(elf_link_hash_table): Add target_os.
(elf_backend_data): Add target_os.
* elf32-arm.c (elf32_arm_link_hash_table): Remove vxworks_p,
symbian_p and nacl_p.
(create_got_section): Updated.
(elf32_arm_create_dynamic_sections): Likewise.
(arm_type_of_stub): Likewise.
(elf32_arm_create_or_find_stub_sec): Likewise.
(elf32_arm_allocate_plt_entry): Likewise.
(elf32_arm_populate_plt_entry): Likewise.
(elf32_arm_final_link_relocate): Likewise.
(elf32_arm_check_relocs): Likewise.
(allocate_dynrelocs_for_symbol): Likewise.
(elf32_arm_finish_dynamic_symbol): Likewise.
(elf32_arm_finish_dynamic_sections): Likewise.
(elf32_arm_output_plt_map_1): Likewise.
(elf32_arm_output_arch_local_syms): Likewise.
(elf32_arm_add_symbol_hook): Likewise.
(elf32_arm_nacl_link_hash_table_create): Likewise.
(elf32_arm_vxworks_link_hash_table_create): Likewise.
(elf32_arm_symbian_link_hash_table_create): Likewise.
(ELF_TARGET_OS): New.
* elf32-i386.c (elf_i386_arch_bed): Removed.
(elf_backend_arch_data): Likewise.
(elf_i386_solaris_arch_bed): Likewise.
(elf_i386_nacl_arch_bed): Likewise.
(elf_i386_vxworks_arch_bed): Likewise.
(elf_i386_relocate_section): Updated.
(elf_i386_finish_dynamic_sections): Likewise.
(elf_i386_get_synthetic_symtab): Likewise.
(elf_i386_link_setup_gnu_properties): Likewise.
(ELF_TARGET_OS): New.
* elf32-mips.c (ELF_TARGET_OS): New.
* elf32-ppc.c (ppc_elf_link_hash_table): Remove is_vxworks.
(ppc_elf_create_got): Updated.
(ppc_elf_create_dynamic_sections): Likewise.
(ppc_elf_check_relocs): Likewise.
(ppc_elf_adjust_dynamic_symbol): Likewise.
(ppc_elf_size_dynamic_sections): Likewise.
(ppc_elf_relocate_section): Likewise.
(ppc_elf_finish_dynamic_sections): Likewise.
(ppc_elf_vxworks_link_hash_table_create): Likewise.
(ELF_TARGET_OS): New.
* elf32-sh.c (elf_sh_link_hash_table): Remove vxworks_p.
(sh_elf_link_hash_table_create): Updated.
(sh_elf_create_dynamic_sections): Likewise.
(allocate_dynrelocs): Likewise.
(sh_elf_size_dynamic_sections): Likewise.
(sh_elf_relocate_section): Likewise.
(sh_elf_finish_dynamic_symbol): Likewise.
(sh_elf_finish_dynamic_sections): Likewise.
(ELF_TARGET_OS): New.
* elf32-sparc.c (elf32_sparc_vxworks_link_hash_table_create):
Removed.
(bfd_elf32_bfd_link_hash_table_create): Likewise.
(ELF_TARGET_OS): New.
* elf64-x86-64.c (elf_x86_64_arch_bed): Removed.
(elf_x86_64_solaris_arch_bed): Likewise.
(elf_x86_64_nacl_arch_bed): Likewise.
(elf_x86_64_finish_dynamic_sections): Updated.
(elf_x86_64_get_synthetic_symtab): Likewise.
(elf_x86_64_link_setup_gnu_properties): Likewise.
(ELF_TARGET_OS): New.
* elflink.c (_bfd_elf_link_hash_table_init): Initialize
target_o.
* elfxx-mips.c (mips_elf_link_hash_table): Remove is_vxworks.
(MIPS_ELF_REL_DYN_NAME): Updated.
(ELF_MIPS_GP_OFFSET): Likewise.
(mips_elf_create_local_got_entry): Likewise.
(mips_elf_allocate_dynamic_relocations): Likewise.
(mips_elf_count_got_symbols): Likewise.
(is_gott_symbol): Likewise.
(mips_elf_calculate_relocation): Likewise.
(mips_elf_create_dynamic_relocation): Likewise.
(_bfd_mips_elf_check_relocs): Likewise.
(allocate_dynrelocs): Likewise.
(_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
(mips_elf_lay_out_got): Likewise.
(mips_elf_set_plt_sym_value): Likewise.
(_bfd_mips_elf_size_dynamic_sections): Likewise.
(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
(_bfd_mips_elf_finish_dynamic_sections): Likewise.
(_bfd_mips_elf_final_link): Likewise.
(_bfd_mips_init_file_header): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_create_dynamic_sections):
Likewise.
(allocate_dynrelocs): Likewise.
(_bfd_sparc_elf_size_dynamic_sections): Likewise.
(_bfd_sparc_elf_relocate_section): Likewise.
(_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
(sparc_finish_dyn): Likewise.
(_bfd_sparc_elf_finish_dynamic_sections): Likewise.
* elfxx-target.h (ELF_TARGET_OS): New.
(elfNN_bed): Add ELF_TARGET_OS.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
(_bfd_x86_elf_link_hash_table_create): Likewise.
(_bfd_x86_elf_size_dynamic_sections): Likewise.
(_bfd_x86_elf_finish_dynamic_sections): Likewise.
(_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
(_bfd_x86_elf_link_setup_gnu_properties): Likewise.
* elfxx-x86.h (elf_x86_target_os): Removed.
(elf_x86_backend_data): Likewise.
(get_elf_x86_backend_data): Likewise.
(elf_x86_link_hash_table): Remove target_os.
|
|
Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate.
Since check_relocs is no longer called on non-loaded, non-alloced
sections, remove SEC_ALLOC check. Resolve relocation in debug section
against symbol defined in shared library to 0.
bfd/
PR ld/26080
* elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
in debug section against symbol defined in shared library to 0.
* elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
* elf32-lm32.c (lm32_elf_check_relocs): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
* elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
reference.
(elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
there is non-GOT reference.
* elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
non-alloced sections.
ld/
PR ld/26080
* testsuite/ld-elf/comm-data.exp: Remove copy_reloc.
* testsuite/ld-elf/comm-data2r.rd: Removed.
* testsuite/ld-elf/comm-data2r.sd: Likewise.
* testsuite/ld-elf/comm-data2r.xd: Likewise.
|
|
* aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
* archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
* coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
* cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
* ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
* elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
* elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
* elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
* elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
* elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
* elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
* elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
* elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
* elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
* elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
* mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
* peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
* targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
|
|
Code in the linker, present before the addition of .gnu.attributes
support, results in shared libraries not being considered by BFD when
merging e_flags and .gnu.attributes from input files to the output.
That doesn't seem correct to me, but I don't know enough about all the
various ABIs to change the behaviour with any confidence. So this
patch merely punts on dynamic objects in merge_private_bfd_data target
functions, with a FIXME for maintainer attention.
I haven't excluded shared libraries from being considered where the
target merge_private_bfd_data (a) already has code dealing with shared
libraries, or (b) where that function just sets the output to the most
constraining arch/mach combination and other fairly trivial merges, or
(c) when the target has no shared library linker support.
In (a) are: arc, arm, aarch64, riscv, sparc.
In (b) are: bpf, cris, csky, m32r, m68k, mn10300, nios2, tilegx,
tilepro, vax, visium, xtensa.
In (c) are: bpf, cr16, h8300, iq2000, m32c, m68hc11, m68hc12, mcore,
mep, msp430, mt, rl78, rx, v850.
PR 25882
* elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
* elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
* elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
* elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
* elf32-sh.c (sh_elf_merge_private_data): Likewise.
* elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
* elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
|
|
PR 25803
gas * config/obj-elf.c (obj_elf_type): Reject ifunc symbols on MIPS
targets.
* testsuite/gas/elf/elf.exp: Add MIPS targets to the list to skip
for the type-2 test.
* testsuite/gas/elf/type-noifunc.e: Update to allow for MIPS
targets running this test.
bfd * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
abort with a more helpful error message.
|
|
unresolved symbol references. (PR 24613)
PR binutils/24613
include * bfdlink.h (enum report_method): Delete RM_GENERATE_WARNING and
RM_GENERATE_ERROR. Add RM_DIAGNOSE.
(struct bfd_link_info): Add warn_unresolved_syms.
ld * lexsup.c (parse_args): Change RM_GENERATE_WARNING and
RM_GENERATE_ERROR to RM_DIAGNOSE.
* emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Change
RM_GENERATE_ERROR to RM_DIAGNOSE.
* emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise.
bfd * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
to RM_DIAGNOSE plus a check of warn_unresolved_syms.
* coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
* elf-bfd.h (_bfd_elf_large_com_section): Likewise.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf32-spu.c (spu_elf_relocate_section): Likewise.
* elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
* elflink.c (elf_link_output_extsym): Likewise.
* elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
|
|
For those ELF targets that have .sdata or .sbss sections, or similar
sections, arrange to mark the sections with the SEC_SMALL_DATA flag.
This fixes regressions in nm symbol type caused by removing .sdata
and .sbss from coff_section_type with commit 49d9fd42ac.
* elf32-m32r.c (m32r_elf_section_flags): New function.
(elf_backend_section_flags): Define.
* elf32-nds32.c (nds32_elf_section_flags): New function.
(elf_backend_section_flags): Define.
* elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
.sbss and .sdata sections.
* elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
for SHF_V850_GPREL sections.
* elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
FIXME.
* elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
for SHF_PARISC_SHORT sections.
* elf64-ppc.c (ppc64_elf_section_flags): New function.
(elf_backend_section_flags): Define.
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
for SHF_MIPS_GPREL sections. Delete FIXME.
|
|
Labels don't go in the first column according to standard emacs C
indent rules, and I got annoyed enough at seeing diff -p show a label
rather than the function name to fix this.
bfd/
* aoutx.h: Indent labels correctly. Format error strings.
* archive.c: Likewise.
* archive64.c: Likewise.
* coff-arm.c: Likewise.
* coff-rs6000.c: Likewise.
* coff-stgo32.c: Likewise.
* cpu-arm.c: Likewise.
* dwarf2.c: Likewise.
* elf-ifunc.c: Likewise.
* elf-properties.c: Likewise.
* elf-s390-common.c: Likewise.
* elf-strtab.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-csky.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-msp430.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-nios2.c: Likewise.
* elf32-pru.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfcode.h: Likewise.
* elfcore.h: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfnn-riscv.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-x86.c: Likewise.
* i386lynx.c: Likewise.
* merge.c: Likewise.
* pdp11.c: Likewise.
* plugin.c: Likewise.
* reloc.c: Likewise.
binutils/
* elfedit.c: Indent labels correctly.
* readelf.c: Likewise.
* resres.c: Likewise.
gas/
* config/obj-elf.c: Indent labels correctly.
* config/obj-macho.c: Likewise.
* config/tc-aarch64.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-crx.c: Likewise.
* config/tc-frv.c: Likewise.
* config/tc-i386-intel.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-nds32.c: Likewise.
* config/tc-riscv.c: Likewise.
* config/tc-s12z.c: Likewise.
* config/tc-xtensa.c: Likewise.
* config/tc-z80.c: Likewise.
* read.c: Likewise.
* symbols.c: Likewise.
* write.c: Likewise.
ld/
* emultempl/cskyelf.em: Indent labels correctly.
* ldfile.c: Likewise.
* ldlang.c: Likewise.
* plugin.c: Likewise.
opcodes/
* aarch64-asm.c: Indent labels correctly.
* aarch64-dis.c: Likewise.
* aarch64-gen.c: Likewise.
* aarch64-opc.c: Likewise.
* alpha-dis.c: Likewise.
* i386-dis.c: Likewise.
* nds32-asm.c: Likewise.
* nfp-dis.c: Likewise.
* visium-dis.c: Likewise.
|
|
This patch provides two new inline functions that are then used in
places that allocate memory, read from file, and then deallocate on a
read failure.
* libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
* aoutx.h (aout_get_external_symbols): Replace calls to
bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
(slurp_reloc_table): Likewise.
* archive.c (do_slurp_bsd_armap): Likewise.
(do_slurp_coff_armap): Likewise.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
* coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
* coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
* coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
(_bfd_coff_get_external_symbols): Likewise.
* ecoff.c (ecoff_slurp_symbolic_header),
(_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
(_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
(ecoff_indirect_link_order): Likewise.
* elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
(_bfd_elf_slurp_version_tables): Likewise.
* elf32-m32c.c (m32c_elf_relax_section): Likewise.
* elf32-rl78.c (rl78_elf_relax_section): Likewise.
* elf32-rx.c (elf32_rx_relax_section): Likewise.
* elf64-alpha.c (READ): Likewise.
* elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
* elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
* elfcode.h (elf_slurp_symbol_table),
(elf_slurp_reloc_table_from_section): Likewise.
* elflink.c (elf_link_add_object_symbols),
(elf_link_check_versioned_symbol): Likewise.
* elfxx-mips.c (READ): Likewise.
* i386lynx.c (slurp_reloc_table): Likewise.
* lynx-core.c (lynx_core_file_p): Likewise.
* mach-o.c (bfd_mach_o_canonicalize_relocs),
(bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
(bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
* pdp11.c (aout_get_external_symbols, slurp_reloc_table
* pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
(bfd_pef_parse_symbols): Likewise.
* peicode.h (pe_ILF_object_p, pe_bfd_object_p
* som.c (setup_sections, som_slurp_string_table),
(som_slurp_reloc_table, som_bfd_count_ar_symbols),
(som_bfd_fill_in_ar_symbols): Likewise.
* vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
(evax_bfd_print_image): Likewise.
* vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
* wasm-module.c (wasm_scan): Likewise.
* xcofflink.c (xcoff_link_add_symbols): Likewise.
* xsym.c (bfd_sym_read_name_table),
(bfd_sym_print_type_information_table_entry): Likewise.
* libbfd.h: Regenerate.
|
|
This patch removes the bfd_alloc2 series of memory allocation functions,
replacing them with __builtin_mul_overflow followed by bfd_alloc. Why
do that? Well, a followup patch will implement _bfd_alloc_and_read
and I don't want to implement alloc2 variants as well.
* coffcode.h (buy_and_read, coff_slurp_line_table),
(coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
corresponding bfd_alloc call. Adjust variables to suit.
* coffgen.c (_bfd_coff_get_external_symbols): Likewise.
* ecoff.c (_bfd_ecoff_slurp_symbolic_info),
(_bfd_ecoff_slurp_symbol_table, READ): Likewise.
* elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
(swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
* elf32-m32c.c (m32c_elf_relax_section): Likewise.
* elf32-rl78.c (rl78_elf_relax_section): Likewise.
* elf32-rx.c (elf32_rx_relax_section): Likewise.
* elf64-alpha.c (READ): Likewise.
* elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
(elf_slurp_symbol_table, elf_slurp_reloc_table),
(bfd_from_remote_memory): Likewise.
* elfcore.h (core_find_build_id): Likewise.
* elfxx-mips.c (READ): Likewise.
* mach-o.c (bfd_mach_o_mangle_sections),
(bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
(bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
(bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
* som.c (setup_sections, som_prep_for_fixups)
(som_build_and_write_symbol_table, som_slurp_symbol_table),
(som_slurp_reloc_table, som_bfd_count_ar_symbols),
(som_bfd_fill_in_ar_symbols, som_slurp_armap),
(som_bfd_ar_write_symbol_stuff): Likewise.
* vms-alpha.c (vector_grow1): Likewise.
* vms-lib.c (vms_add_index): Likewise.
* wasm-module.c (wasm_scan_name_function_section): Likewise.
* libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
* opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
* libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
(bfd_alloc2, bfd_zalloc2): Delete.
(_bfd_mul_overflow): Define.
* libbfd.h: Regenerate.
|
|
bfd_size_type was invented a long time ago in the K&R days. Many
places in binutils ought to be using size_t instead (and there are
lots of places that use long or unsigned long that really ought to use
size_t too). Note that you can't change everything over to size_t: A
32-bit host needs a larger type than size_t to support reading and
processing of 64-bit ELF object files. This patch just tidies some
of the more obvious uses of bfd_size_type that could be size_t. There
no doubt are more lurking in the source. Incidentally, practically
all functions used for output of object files can use size_t and don't
need to worry about overflow of size expressions. If you have
something like
symcount * sizeof (void *)
when symcount is counting symbols already in memory then you know that
this expression can't overflow since the size of a symbol in memory is
larger by far than that of a pointer.
* aix386-core.c (aix386_core_file_p): Use size_t for "amt".
* aout-target.h (object_p): Likewise.
* aout-tic30.c (tic30_aout_object_p): Likewise.
* aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
(emit_stringtab, write_syms, link_hash_table_create),
(aout_link_write_other_symbol): Likewise.
* archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
(bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
(_bfd_compute_and_write_armap): Likewise.
* archures.c (bfd_arch_list): Likewise.
* bfd.c (bfd_record_phdr): Likewise.
* binary.c (binary_canonicalize_symtab): Likewise.
* cisco-core.c (cisco_core_file_validate): Likewise.
* coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
(find_arm_glue, record_arm_to_thumb_glue),
(record_thumb_to_arm_glue): Likewise.
* coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
(ppc_allocate_toc_section): Likewise.
* coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
* coff-sh.c (sh_relax_section): Likewise.
* coff64-rs6000.c (xcoff64_archive_p): Likewise.
* coffcode.h (handle_COMDAT, coff_new_section_hook),
(coff_set_alignment_hook, coff_mkobject),
(coff_compute_section_file_positions): Likewise.
* coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
(coff_find_nearest_line_with_names),
( bfd_coff_set_symbol_class): Likewise.
* cofflink.c (_bfd_coff_link_hash_table_create),
(_bfd_coff_link_input_bfd): Likewise.
* dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
* dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
(build_line_info_table, sort_line_sequences),
(line_info_add_include_dir, line_info_add_file_name),
(decode_line_info, scan_unit_for_symbols, parse_comp_unit),
(place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
* ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
(_bfd_ecoff_find_nearest_line),
(_bfd_ecoff_bfd_link_hash_table_create): Likewise.
* ecofflink.c (bfd_ecoff_debug_init): Likewise.
* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
* elf-m10300.c (mn10300_elf_relax_section),
(elf32_mn10300_link_hash_table_create): Likewise.
* elf-strtab.c (_bfd_elf_strtab_init): Likewise.
* elf.c (make_mapping, copy_elf_program_header): Likewise.
* elf32-arm.c (elf32_arm_link_hash_table_create),
(elf32_arm_setup_section_lists, elf32_arm_check_relocs),
(elf32_arm_new_section_hook): Likewise.
* elf32-avr.c (elf_avr_new_section_hook),
(elf32_avr_link_hash_table_create, get_local_syms),
(elf32_avr_setup_section_lists): Likewise.
* elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
(bfin_link_hash_table_create): Likewise.
* elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
* elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
* elf32-csky.c (csky_elf_link_hash_table_create),
(csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
* elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
* elf32-hppa.c (elf32_hppa_link_hash_table_create),
(elf32_hppa_setup_section_lists, get_local_syms): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
* elf32-m32r.c (m32r_elf_link_hash_table_create),
(m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
(elf32_m68hc11_setup_section_lists),
(elf32_m68hc11_size_stubs): Likewise.
* elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
* elf32-metag.c (elf_metag_link_hash_table_create),
(elf_metag_setup_section_lists): Likewise.
* elf32-microblaze.c (microblaze_elf_link_hash_table_create),
(microblaze_elf_check_relocs): Likewise.
* elf32-nds32.c (nds32_elf_link_hash_table_create),
(nds32_elf_check_relocs): Likewise.
* elf32-nios2.c (nios2_elf32_setup_section_lists),
(get_local_syms, nios2_elf32_check_relocs),
(nios2_elf32_link_hash_table_create): Likewise.
* elf32-or1k.c (or1k_elf_link_hash_table_create),
(or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
* elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
* elf32-s390.c (elf_s390_link_hash_table_create),
(elf_s390_check_relocs): Likewise.
* elf32-score.c (score_elf_create_got_section),
(s3_elf32_score_new_section_hook),
(elf32_score_link_hash_table_create): Likewise.
* elf32-score7.c (score_elf_create_got_section),
(s7_elf32_score_new_section_hook): Likewise.
* elf32-sh.c (sh_elf_link_hash_table_create),
(sh_elf_check_relocs): Likewise.
* elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
(elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
* elf32-tilepro.c (tilepro_elf_link_hash_table_create),
(tilepro_elf_check_relocs): Likewise.
* elf32-v850.c (remember_hi16s_reloc): Likewise.
* elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
* elf32-xtensa.c (elf_xtensa_link_hash_table_create),
(elf_xtensa_new_section_hook): Likewise.
* elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
(get_got_entry, elf64_alpha_check_relocs): Likewise.
* elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
* elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
* elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
* elf64-ppc.c (ppc64_elf_new_section_hook),
(ppc64_elf_link_hash_table_create, update_local_sym_info),
(update_plt_info, ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_link_hash_table_create),
(elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elflink.c (bfd_elf_link_record_local_dynamic_symbol),
(_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
(elf_link_add_archive_symbols, compute_bucket_count),
(bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
(bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
(bfd_elf_final_link): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
(elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
(elfNN_aarch64_new_section_hook): Likewise.
* elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
* elfnn-riscv.c (riscv_elf_link_hash_table_create),
(riscv_elf_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_new_section_hook),
(_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
(_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
(_bfd_mips_elf_link_hash_table_create): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
(_bfd_sparc_elf_check_relocs),
(_bfd_sparc_elf_new_section_hook): Likewise.
* elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
(tilegx_elf_check_relocs): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
* format.c (bfd_check_format_matches): Likewise.
* hash.c (_bfd_stringtab_init): Likewise.
* ihex.c (ihex_scan): Likewise.
* irix-core.c (irix_core_core_file_p): Likewise.
* linker.c (bfd_wrapped_link_hash_lookup),
(_bfd_generic_link_hash_table_create),
(_bfd_generic_reloc_link_order): Likewise.
* lynx-core.c (lynx_core_file_p): Likewise.
* netbsd-core.c (netbsd_core_file_p): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
(link_hash_table_create, aout_link_write_other_symbol): Likewise.
* peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
* peicode.h (pe_mkobject): Likewise.
* ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
* ptrace-core.c (ptrace_unix_core_file_p): Likewise.
* sco5-core.c (read_uarea): Likewise.
* som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
(som_write_fixups, som_write_space_strings, som_write_symbol_strings),
(som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
(som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
(bfd_som_attach_aux_hdr, som_write_armap): Likewise.
* srec.c (srec_scan): Likewise.
* syms.c (_bfd_generic_make_empty_symbol): Likewise.
* targets.c (bfd_target_list): Likewise.
* tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
* trad-core.c (trad_unix_core_file_p): Likewise.
* vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
(vms_new_section_hook): Likewise.
* wasm-module.c (wasm_make_empty_symbol): Likewise.
* xcofflink.c (xcoff_get_section_contents),
(_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
(xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
(bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
|
|
|
|
* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): Avoid signed overflow.
* elf32-hppa.c (final_link_relocate): Likewise.
* elf32-ppc.c (_bfd_elf_ppc_at_tls_transform): Likewise.
(_bfd_elf_ppc_at_tprel_transform, is_insn_ds_form): Likewise.
(is_insn_dq_form, ppc_elf_relocate_section): Likewise.
* elf64-ppc.c (ok_lo_toc_insn, ppc64_elf_edit_toc): Likewise.
(ppc64_elf_relocate_section): Likewise.
* elfxx-mips.c (mips_elf_perform_relocation): Likewise.
* netbsd.h (N_SET_FLAGS): Likewise.
|
|
There were a number of problems with the previous patch. Firstly,
_bfd_dwarf2_stash_syms didn't do anything when the original file had
dynamic symbols, and secondly, info found by the symbol search didn't
make it out of _bfd_elf_find_nearest_line except in the case of DWARF
functions without external linkage.
PR 23652
* dwarf2.c (_bfd_dwarf2_stash_syms): Break out of loop on finding
matching section.
(_bfd_dwarf2_find_nearest_line): Return an int, with value 2 when
returning info from the symbol table. Do the _bfd_elf_find_function
search also when !found. Call _bfd_dwarf2_stash_syms regardless of
symbols.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Accept dwarf2
result of 1 only.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
* libbfd.h: Regenerate.
|
|
Sometimes DWARF info for a function is incomplete, and the function
can be retrieved by examining symbols. However, when separate debug
files are used it may be that the original file is completely
stripped of symbols. This patch teaches BFD to look at symbols from
the debug file in that case.
The patch also removes arm_elf_find_function, instead implementing
elf_backend_maybe_function_sym. arm_elf_find_function was written
before the generic _bfd_elf_find_function called maybe_function_sym.
aarch64 copied arm, so that file gets the same treatment. There is
some chance this will speed up arm and aarch64 lookup of function/line.
PR 23652
* dwarf2.c (_bfd_dwarf2_stash_syms): New function.
(_bfd_dwarf2_find_nearest_line): Use it here, passing syms to
_bfd_elf_find_function. Call _bfd_elf_find_function in cases
where _bfd_elf_find_nearest_line would do so.
* elf.c (_bfd_elf_find_nearest_line): Omit _bfd_elf_find_function
for dwarf2.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. Tidy.
* elf32-arm.c (elf32_arm_maybe_function_sym): New function.
(elf_backend_maybe_function_sym): Define.
(arm_elf_find_function, elf32_arm_find_nearest_line): Delete.
(bfd_elf32_find_nearest_line): Don't define.
* elfnn-aarch64.c (elfNN_aarch64_maybe_function_sym): New function.
(elf_backend_maybe_function_sym): Define.
(aarch64_elf_find_function, elfNN_aarch64_find_nearest_line): Delete.
(bfd_elfNN_find_nearest_line): Don't define.
|
|
This patch renames elf_backend_post_process_headers and moves the
prep_headers code into the new function. Naming the backend functions
elf_backend_init_file_header and elf_backend_modify_headers makes it
clear which function is called first.
* elf-bfd.h (struct elf_backend_data <elf_backend_init_file_header>):
Rename from elf_backend_post_process_headers.
(_bfd_elf_post_process_headers): Delete.
(_bfd_elf_init_file_header): Declare.
* elf.c (_bfd_elf_compute_section_file_positions): Call new function
in place of prep_headers and elf_backend_post_process_headers.
(_bfd_elf_init_file_header): Renamed from prep_headers with
updated args and made global. Delete dead code.
(_bfd_elf_post_process_headers): Delete.
* elf32-arm.c (elf32_arm_init_file_header): Rename from
elf32_arm_post_process_headers and call _bfd_elf_init_file_header.
Return status.
(elf_backend_init_file_header): Define.
(elf_backend_post_process_headers): Don't define.
* elf32-i386.c (elf_i386_fbsd_init_file_header): Similarly.
* elf32-m68hc1x.c (elf32_m68hc11_init_file_header): Similarly.
* elf32-metag.c (elf_metag_init_file_header): Similarly.
* elf32-spu.c (spu_elf_init_file_header
* elf32-visium.c (visium_elf_init_file_header
* elf64-alpha.c (elf64_alpha_fbsd_init_file_header
* elf64-hppa.c (elf64_hppa_init_file_header
* elf64-ia64-vms.c (elf64_vms_init_file_header
* elfnn-aarch64.c (elfNN_aarch64_init_file_header
* elfnn-ia64.c (elfNN_hpux_init_file_header
* elfxx-mips.c (_bfd_mips_init_file_header
* elfxx-mips.h (_bfd_mips_post_process_headers): Delete.
(_bfd_mips_init_file_header): Declare.
(elf_backend_post_process_headers): Delete.
(elf_backend_init_file_header): Define.
* elfxx-target.h (elf_backend_post_process_headers): Delete.
(elf_backend_init_file_header): Define and use.
* elf32-m68hc12.c (elf_backend_init_file_header): Define.
(elf_backend_post_process_headers): Don't define.
* elf32-m68hc1x.h (elf32_m68hc11_post_process_headers): Delete.
(elf32_m68hc11_init_file_header): Declare.
* elf32-ppc.c (elf_backend_post_process_headers): Remove
unnecessary undef.
|
|
bfd/
* bfd-in.h: Move ecoff function declarations..
* ecoff-bfd.h: ..to here, new file.
* ecoff.c: Include ecoff-bfd.h.
* ecofflink.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
gas/
* config/obj-ecoff.c: Include ecoff-bfd.h.
* config/obj-elf.c: Likewise.
|
|
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
|
|
The main point of this patch is to give bfd_get_section a better name,
bfd_asymbol_section.
bfd/
* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.
(bfd_get_output_section): Delete.
(bfd_asymbol_base): Delete.
(bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy.
(bfd_set_asymbol_name): New macro.
* bfd-in2.h: Regenerate.
* aout-cris.c: Update throughout to use bfd_asymbol_section.
* aoutx.h: Likewise.
* cofflink.c: Likewise.
* dwarf2.c: Likewise.
* ecoff.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elfn32-mips.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfxx-mips.c: Likewise.
* linker.c: Likewise.
* pdp11.c: Likewise.
* elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section.
binutils/
* nm.c: Update bfd_get_section to bfd_asymbol_section throughout.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* rdcoff.c: Likewise.
* objcopy.c (create_new_symbol): Use bfd_set_asymbol_name.
(filter_symbols): Likewise.
gas/
* symbols.c (S_IS_LOCAL): Update bfd_get_section to
bfd_asymbol_section.
gdb/
* arm-tdep.c (arm_record_special_symbol): Update bfd_get_section
to bfd_asymbol_section.
ld/
* ldcref.c (check_reloc_refs): Update bfd_get_section to
bfd_asymbol_section.
|
|
This parameter might appear to be used to set up offset_size, but
since git commit 024b2372f5 offset_size is either set from the
debug_info data or is set to 4.
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter.
* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
* coffgen.c (coff_find_nearest_line_with_names): Adjust
_bfd_dwarf2_find_nearest_line calls.
* elf.c (_bfd_elf_find_nearest_line, _bfd_elf_find_line): Likewise.
* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_find_nearest_line): Likewise.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
* libbfd.h: Regenerate.
|
|
This patch is a reimplementation of [1] which was submitted in 2015 by
Neil Schellenberger. Copyright issue was sorted out [2] last year.
It proposed a new section (.gnu.xhash) and related dynamic tag
(DT_GNU_XHASH). The new section would be virtually identical to the
existing .gnu.hash except for the translation table (xlat) which would
contain correct MIPS .dynsym indexes corresponding to the hashvals in
chains. This is because MIPS ABI imposes a different ordering on the
dynsyms than the one expected by the .gnu.hash section. Another addition
would be a leading word (ngnusyms) which would contain the number of
entries in the translation table.
In this patch, the new section name and dynamic tag are changed to
reflect the fact that the section should be treated as MIPS-specific
(.MIPS.xhash and DT_MIPS_XHASH).
This patch addresses the alignment issue as reported in [3], which is
caused by the leading word added to the .MIPS.xhash section. Leading word
is removed in this patch, and the number of entries in the translation
table is now calculated using DT_MIPS_SYMTABNO dynamic tag (this is
addressed by the corresponding glibc patch).
Suggestions on coding style in [4] were taken into account. Existing
GNU hash testcase was covered, and another one was added in the MIPS
part of the testsuite.
The other major change is reserving MIPS ABI version 5 for .MIPS.xhash,
marking the need of support for .MIPS.xhash in the dynamic linker (again,
addressed in the corresponding glibc patch). This is something which I
am not sure of, especially after reading [5]. I am confused on whether
this ABI version is reserved for IFUNC, or it can be used for this
purpose.
Already mentioned glibc patch is submitted at:
https://sourceware.org/ml/libc-alpha/2019-06/msg00456.html
[1] https://sourceware.org/ml/binutils/2015-10/msg00057.html
[2] https://sourceware.org/ml/binutils/2018-03/msg00025.html
[3] https://sourceware.org/ml/binutils/2016-01/msg00006.html
[4] https://sourceware.org/ml/binutils/2016-02/msg00097.html
[5] https://sourceware.org/ml/libc-alpha/2016-12/msg00853.html
ld * emulparams/elf32bmip.sh: Add .MIPS.xhash section.
* emulparams/elf32bmipn32-defs.sh: Add .MIPS.xhash section.
* emulparams/elf64bmip-defs.sh: Add .MIPS.xhash section.
* emultempl/mipself.em: Remove mips_after_parse function.
* testsuite/ld-elf/hash.d: Update comment.
* testsuite/ld-mips-elf/hash1.d: New test.
* testsuite/ld-mips-elf/hash1.s: Ditto.
* testsuite/ld-mips-elf/hash1a.d: Remove.
* testsuite/ld-mips-elf/hash1b.d: Ditto.
* testsuite/ld-mips-elf/hash1c.d: Ditto
* testsuite/ld-mips-elf/hash2.d: New test.
* testsuite/ld-mips-elf/mips-elf.exp: New tests.
* testsuite/ld-mips-elf/start.s: New test.
bfd * elf-bfd.h (struct elf_backend_data): New members.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Create
.gnu.hash section if necessary.
(struct collect_gnu_hash_codes): New member.
(elf_gnu_hash_process_symidx): New function name.
(elf_renumber_gnu_hash_syms): Ignore local and undefined
symbols. Record xlat location for every symbol which should have
a .MIPS.xhash entry.
(bfd_elf_size_dynamic_sections): Add DT_GNU_HASH dynamic tag to
dynamic section if necessary.
(GNU_HASH_SECTION_NAME): New define.
(bfd_elf_size_dynsym_hash_dynstr): Get .MIPS.xhash section.
Update the section size info.
* elfxx-mips.c (struct mips_elf_hash_sort_data): New members.
(struct mips_elf_link_hash_entry): New member.
(mips_elf_link_hash_newfunc): Initialize .MIPS.xhash translation
table location.
(mips_elf_sort_hash_table): Initialize the pointer to the
.MIPS.xhash section.
(mips_elf_sort_hash_table_f): Populate the .MIPS.xhash
translation table entry with the symbol dynindx.
(_bfd_mips_elf_section_from_shdr): Add SHT_MIPS_XHASH.
(_bfd_mips_elf_fake_sections): Initialize .MIPS.xhash section
info.
(_bfd_mips_elf_create_dynamic_sections): Create .MIPS.xhash
section.
(_bfd_mips_elf_size_dynamic_sections): Add DT_MIPS_XHASH tag to
dynamic section.
(_bfd_mips_elf_finish_synamic_sections): Add DT_MIPS_XHASH.
(_bfd_mips_elf_final_write_processing): Set .MIPS.xhash section
sh_link info.
(_bfd_mips_elf_get_target_dtag): Get DT_MIPS_XHASH tag.
(MIPS_LIBC_ABI_XHASH): New ABI version enum value.
(_bfd_mips_post_process_headers): Mark the ABI version as
MIPS_LIBC_ABI_XHASH if there exists a .MIPS.xhash section,
but not a .hash section.
(_bfd_mips_elf_record_xhash_symbol): New function. Record a
position in the translation table, associated with the hash
entry.
* elfxx-mips.h (literal_reloc_p): Define
elf_backend_record_xhash_symbol backend hook.
* elfxx-target.h: Initialize elf_backend_record_xhash_symbol
backend hook.
include * elf/mips.h (SHT_GNU_XHASH): New define.
(DT_GNU_XHASH): New define.
binutils * readelf.c (get_mips_dynamic_type): Return MIPS_XHASH dynamic type.
(get_mips_section_type_name): Return MI{S_XHASH name string.
(dynamic_section_mips_val): Initialize the .MIPS.xhash dynamic
info.
(process_symbol_table): Initialize the .MIPS.xhash section
pointer. Adjust the readelf output to support the new section.
(process_object): Set the .MIPS.xhash dynamic info to zero.
|
|
emaulation for 64-bit objects.
PR 24832
* elfxx-mips.c (mips_set_isa_flags): Default to MIPS 3 for 64-bit
mips inputs.
|