aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2019-09-16Automatic date update in version.inGDB Administrator1-1/+1
2019-09-15Automatic date update in version.inGDB Administrator1-1/+1
2019-09-14Automatic date update in version.inGDB Administrator1-1/+1
2019-09-13Automatic date update in version.inGDB Administrator1-1/+1
2019-09-12Automatic date update in version.inGDB Administrator1-1/+1
2019-09-11Introduce bfd_set_filenameTom Tromey3-0/+27
This introduces a new bfd_set_filename function, which is then used in various spots in gdb. This allows for the removal of some casts. bfd/ChangeLog 2019-09-11 Tom Tromey <tom@tromey.com> * opncls.c (bfd_set_filename): New function. * bfd-in2.h: Regenerate. gdb/ChangeLog 2019-09-11 Tom Tromey <tom@tromey.com> * symfile-mem.c (symbol_file_add_from_memory): Use bfd_set_filename. * solib-darwin.c (darwin_bfd_open): Use bfd_set_filename. * solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename.
2019-09-11Tidy ld/ldmisc.cAlan Modra35-2/+143
The idea here is to not use elf-bfd.h and coff-bfd.h in generic linker code. bfd/ * targets.c (struct bfd_target): Add _bfd_group_name. (BFD_JUMP_TABLE): Likewise. * coffgen.c (bfd_coff_group_name): New function. * elf.c (bfd_elf_group_name): New function. * linker.c (_bfd_nolink_bfd_group_name): New function. * section.c (bfd_generic_group_name): New function. * elf-bfd.h (bfd_elf_group_name): Declare. * libbfd-in.h (_bfd_nolink_bfd_group_name): Declare. * libcoff-in.h (bfd_coff_group_name): Declare. * aout-target.h (MY_bfd_group_name): Define. * aout-tic30.c (MY_bfd_group_name): Define. * bfd.c (bfd_group_name): Define. * binary.c (binary_bfd_group_name): Define. * coff-alpha.c (_bfd_ecoff_bfd_group_name): Define. * coff-mips.c (_bfd_ecoff_bfd_group_name): Define. * coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define. * coffcode.h (coff_bfd_group_name): Define. * elfxx-target.h (bfd_elfNN_bfd_group_name): Define. * i386msdos.c (msdos_bfd_group_name): Define. * ihex.c (ihex_bfd_group_name): Define. * mach-o-target.c (bfd_mach_o_bfd_group_name): Define. * mmo.c (mmo_bfd_group_name): Define. * pef.c (bfd_pef_bfd_group_name): Define. * plugin.c (bfd_plugin_bfd_group_name): Define. * ppcboot.c (ppcboot_bfd_group_name): Define. * som.c (som_bfd_group_name): Define. * srec.c (srec_bfd_group_name): Define. * tekhex.c (tekhex_bfd_group_name): Define. * verilog.c (verilog_bfd_group_name): Define. * vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define. * xsym.c (bfd_sym_bfd_group_name): Define. * coff64-rs6000.c (rs6000_xcoff64_vec): Init new field. (rs6000_xcoff64_aix_vec): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate. ld/ * ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h. (vfinfo): Use bfd_group_name.
2019-09-11Automatic date update in version.inGDB Administrator1-1/+1
2019-09-10Enhance the disassembler so that it will reliably determine whether a reloc ↵Nick Clifton88-2537/+1194
applies to the middle of the next insn. PR 24907 binutils* objdump.c (null_print): New function. (disassemble_bytes): Delete previous_octets local and replace with a test of the max_reloc_offset_into_insn field of the bfd_arch_info structure. If a reloc is a potential match for the next insn, then perform a dummy disassembly in order to calculate its real length. bfd * archures.c (bfd_arch_info_type): Add max_reloc_offset_into_insn field. (bfd_default_arch_struct): Initialise the new field. * bfd-in2.h: Regenerate. * cpu-aarch64.c: Initialise the new field. * cpu-alpha.c: Likewise. * cpu-arc.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-bpf.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-cris.c: Likewise. * cpu-crx.c: Likewise. * cpu-csky.c: Likewise. * cpu-d10v.c: Likewise. * cpu-d30v.c: Likewise. * cpu-dlx.c: Likewise. * cpu-epiphany.c: Likewise. * cpu-fr30.c: Likewise. * cpu-frv.c: Likewise. * cpu-ft32.c: Likewise. * cpu-h8300.c: Likewise. * cpu-hppa.c: Likewise. * cpu-i386.c: Likewise. * cpu-ia64.c: Likewise. * cpu-iamcu.c: Likewise. * cpu-ip2k.c: Likewise. * cpu-iq2000.c: Likewise. * cpu-k1om.c: Likewise. * cpu-l1om.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m10200.c: Likewise. * cpu-m10300.c: Likewise. * cpu-m32c.c: Likewise. * cpu-m32r.c: Likewise. * cpu-m68hc11.c: Likewise. * cpu-m68hc12.c: Likewise. * cpu-m68k.c: Likewise. * cpu-m9s12x.c: Likewise. * cpu-m9s12xg.c: Likewise. * cpu-mcore.c: Likewise. * cpu-mep.c: Likewise. * cpu-metag.c: Likewise. * cpu-microblaze.c: Likewise. * cpu-mips.c: Likewise. * cpu-mmix.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-mt.c: Likewise. * cpu-nds32.c: Likewise. * cpu-nfp.c: Likewise. * cpu-nios2.c: Likewise. * cpu-ns32k.c: Likewise. * cpu-or1k.c: Likewise. * cpu-pdp11.c: Likewise. * cpu-pj.c: Likewise. * cpu-plugin.c: Likewise. * cpu-powerpc.c: Likewise. * cpu-pru.c: Likewise. * cpu-riscv.c: Likewise. * cpu-rl78.c: Likewise. * cpu-rs6000.c: Likewise. * cpu-rx.c: Likewise. * cpu-s12z.c: Likewise. * cpu-s390.c: Likewise. * cpu-score.c: Likewise. * cpu-sh.c: Likewise. * cpu-sparc.c: Likewise. * cpu-spu.c: Likewise. * cpu-tic30.c: Likewise. * cpu-tic4x.c: Likewise. * cpu-tic54x.c: Likewise. * cpu-tic6x.c: Likewise. * cpu-tic80.c: Likewise. * cpu-tilegx.c: Likewise. * cpu-tilepro.c: Likewise. * cpu-v850.c: Likewise. * cpu-v850_rh850.c: Likewise. * cpu-vax.c: Likewise. * cpu-visium.c: Likewise. * cpu-wasm32.c: Likewise. * cpu-xc16x.c: Likewise. * cpu-xgate.c: Likewise. * cpu-xstormy16.c: Likewise. * cpu-xtensa.c: Likewise. * cpu-z80.c: Likewise. * cpu-z8k.c: Likewise. gas * testsuite/gas/arm/pr24907.s: New test. * testsuite/gas/arm/pr24907.d: Expected disassembly.
2019-09-10Automatic date update in version.inGDB Administrator1-1/+1
2019-09-09Add markers for 2.33 branch to NEWS and ChangeLog files.Phil Blundell1-0/+4
2019-09-09Automatic date update in version.inGDB Administrator1-1/+1
2019-09-08Automatic date update in version.inGDB Administrator1-1/+1
2019-09-07Automatic date update in version.inGDB Administrator1-1/+1
2019-09-06bfd_get_filenameAlan Modra5-11/+15
This macro says: /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ I reckon that isn't such a good idea since it can result in char* variables where const char* is appropriate. Not very many places need the char* cast. bfd/ * aout-target.h (object_p): Formatting. * bfd-in.h (bfd_get_filename): Don't cast to char*. * corefile.c (generic_core_file_matches_executable_p): Constify variables and remove cast. * bfd-in2.h: Regenerate. binutils/ * nm.c (print_object_filename_bsd, print_object_filename_sysv), (print_object_filename_posix, print_archive_filename_bsd), (print_archive_filename_sysv, print_archive_filename_posix), (print_archive_member_bsd, print_archive_member_sysv), (print_archive_member_posix): Constify parameter. (struct output_fns <print_object_filename, print_archive_filename>), (<print_archive_member>): Likewise. * objcopy.c (copy_archive): Add cast for make_tempdir. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify variable. * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise. gdb/ * coffread.c (coff_symfile_read): Constify filename variable. * dbxread.c (dbx_symfile_init, coffstab_build_psymtabs), (elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise. * gdb_bfd.c (gdb_bfd_close_or_warn): Likewise. * solib.c (reload_shared_libraries_1): Likewise. * symfile.c (reread_symbols): Likewise. * solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename. * solib-darwin.c (darwin_bfd_open): Likewise. * symfile-mem.c (symbol_file_add_from_memory): Likewise. sim/cris/ * sim-if.c (sim_open): Constify filename variable.
2019-09-06Automatic date update in version.inGDB Administrator1-1/+1
2019-09-05PowerPC64 GOT_PCREL relocsAlan Modra2-53/+31
PC-relative relocs typically use the addend in adjusting what they are relative to. For example: bcl 20,31,1f 1: mflr 12 addi 12,12,xxx-1b generates "R_PPC64_REL16 xxx+0x4" for the addi (when little-endian). The addend reflects the fact that you want the offset relative to the previous insn not the current one in this case. So the question is, will we ever want to do something like that for an instruction using R_PPC64_GOT_PCREL34? I thought so at the time I first implemented support in ld but at the time I think the hardware was possibly going to support pcrel+offset+reg addressing. In which case you might want something like: load_big_offset_into_r2 pld 3,sym-big_offset@got@pcrel(2) which would be a way of supporting more than 8G offsets from code to the GOT. We could do the same with load_big_offset_into_r2 pla 9,sym-big_offset@got@pcrel ldx 3,9,2 However, this is really a poor version of TOC-pointer relative code. So let's go with an addend on R_PPC64_GOT_PCREL34 meaning that sym+addend should be put in a GOT entry, and the relocation calculate the pc-relative offset to that GOT entry. Note that this is an extension to the ABI, which says (by the expression given for GOT relocs) that non-zero addends on GOT and PLT relocs are ignored. This is true for all GOT/PLT relocs, not just the pcrel ones. * elf64-ppc.c (ppc64_elf_check_relocs): Interpret an addend in GOT_PCREL and PLT_PCREL relocs as affecting the value stored in the GOT/PLT entry rather than affecting the offset to that GOI/PLT entry. (ppc64_elf_edit_toc, ppc64_elf_relocate_section): Likewise.
2019-09-05R_PPC64_PCREL_OPTAlan Modra2-12/+45
The loads and stores handled in the second instruction of a sequence marked by R_PPC64_PCREL_OPT may be a prefix instruction. For example: pld ra,symbol@got@pcrel 0: pld rt,off(ra) .reloc 0b-8,R_PPC64_PCREL_OPT,(.-8)-(0b-8) can be optimised to pld rt,symbol+off@pcrel pnop * elf64-ppc.c (xlate_pcrel_opt): Handle prefix loads and stores in second instruction. (ppc64_elf_relocate_section): Likewise.
2019-09-05PR24955, libbfd terminating program on out of memoryAlan Modra7-9/+85
This patch fixes the worst of the cases where libbfd might terminate a program due to calling xstrdup or xmalloc. I've also fixed some error paths that didn't clean up properly. PR 24955 * libbfd-in.h (bfd_strdup): New inline function. * archive.c (_bfd_get_elt_at_filepos): Use bfd_strdup. Close bfd on error. * elfcode.h (_bfd_elf_bfd_from_remote_memory): Use bfd_strdup. * opncls.c (bfd_fopen): Use bfd_strdup. Close fd and stream on error. (bfd_openstreamr): Use bfd_strdup. (bfd_openr_iovec, bfd_openw, bfd_create): Likewise. * plugin.c (try_load_plugin): Use bfd_malloc. * libbfd.h: Regenerate.
2019-09-05Automatic date update in version.inGDB Administrator1-1/+1
2019-09-04Automatic date update in version.inGDB Administrator1-1/+1
2019-09-03Automatic date update in version.inGDB Administrator1-1/+1
2019-09-02Re: Memory leak in dwarf2.cAlan Modra2-18/+22
PR 11983 * dwarf2.c (read_alt_indirect_string): Free debug_filename on success. Tidy. (read_alt_indirect_ref): Likewise.
2019-09-02Memory leak in dwarf2.cAlan Modra2-7/+15
This fixes a small leak of debug_filename. bfd_openr copies the file name since git commit 1be5090bca. PR 11983 * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename on success. Tidy.
2019-09-02Automatic date update in version.inGDB Administrator1-1/+1
2019-08-31RISC-V: Fix linker problems with tls copy relocs.Jim Wilson2-0/+20
The linker doesn't allocate memory space for sections that are only SEC_ALLOC and SEC_THREAD_LOCAL. See the IS_TBSS test in ld/ldlang.c. So we need to pretend that .tdata.dyn sections have contents to get the right result. It will be marked this way anyways if there is a .tdata section to merge with. bfd/ PR 23825 * elfnn-riscv.c (riscv_elf_create_dynamic_sections): Add SEC_LOAD, SEC_DATA, and SEC_HAS_CONTENTS to .tdata.dyn section.
2019-09-01Automatic date update in version.inGDB Administrator1-1/+1
2019-08-31Automatic date update in version.inGDB Administrator1-1/+1
2019-08-30RISC-V: Force linker error exit after unresolvable reloc.Jim Wilson2-1/+9
This was noticed while trying to test the compiler -msave-restore support. Putting non-pic code in a shared library gives a linker error, but doesn't stop the build. rohan:2030$ cat libtmp.c extern int sub2 (int); int sub (int i) { return sub2 (i + 10); } rohan:2031$ cat libtmp2.c extern int sub (int); int sub2 (int i) { return sub (i + 10); } rohan:2032$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp.so libtmp.c rohan:2033$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp2.so libtmp2.c libtmp.so /home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-linux-gnu/8.3.0/../../../../riscv64-unknown-linux-gnu/bin/ld: /tmp/cctrsIBe.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub' rohan:2034$ echo $? 0 rohan:2035$ ls -lt libtmp2.so -rwxr-xr-x 1 jimw jimw 6912 Aug 30 14:32 libtmp2.so rohan:2036$ The patch fixes this by forcing a linker error. I now get this. ohan:2059$ sh tmp.script /home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: libtmp2.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub' /home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: final link failed: bad value rohan:2060$ echo $? 1 rohan:2061$ ls -lt libtmp2.so ls: cannot access 'libtmp2.so': No such file or directory bfd/ * elfnn-riscv.c (riscv_elf_relocate_section): For unresolvable reloc error, call bfd_set_error, set ret to FALSE, and goto out label.
2019-08-30Copy BFD_COMPRESS/BFD_DECOMPRESS/BFD_COMPRESS_GABI for thin archiveH.J. Lu2-0/+13
We need to copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive. PR ld/24951 * archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive.
2019-08-30Automatic date update in version.inGDB Administrator1-1/+1
2019-08-29PR24697, R_PPC_EMB_SDA21 cannot be used when making a shared objectAlan Modra2-17/+10
This removes a restriction on various R_PPC_EMB relocations that has been present for ppc32 since 1996-04-26 git commit e25a798839. As far as I know, only those relocs that would require addressing via r2 for .sdata2/.sbss2 access are disallowed in shared libraries. PR 24697 * elf32-ppc.c (ppc_elf_check_relocs): Call bad_shared_reloc when !bfd_link_executable for R_PPC_EMB_SDA2I16 and R_PPC_EMB_SDA2REL. Don't call bad_shared_reloc for any other reloc.
2019-08-29PowerPC64 xlate_pcrel_optAlan Modra2-19/+29
We can easily support an offset on the second instruction of a sequence marked with R_PPC64_PCREL_OPT. For example, pla ra,symbol@pcrel ld rt,off(ra) can be optimised to pld rt,symbol+off@pcrel nop * elf64-ppc.c (xlate_pcrel_opt): Add poff parameter. Allow offset on second insn, return it in poff. (ppc64_elf_relocate_section): Add offset to paddi addend for PCREL_OPT.
2019-08-28RISC-V: Fix a gp relaxation reloc overflow error.Jim Wilson2-7/+16
This was broken when I changed how we compute the value for the gp register. It used to be computed inside the sdata section. Now it is computed at the end which makes it an abs section symbol. There is code that tries to use the alignment of the section that the gp value is in, but this does not work if it is in the abs section, as the abs section has alignment of 1 byte. There are people using alternative linker scripts that still define it in the sdata section, so the code is still useful. Thus adding a check to disable this when gp is in the abs section. bfd/ * elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs section when setting max_alignment. Update comment. (_bfd_riscv_relax_pc): Likewise.
2019-08-29Automatic date update in version.inGDB Administrator1-1/+1
2019-08-29PR24891, objdump memory leaks when parsing malformed archiveAlan Modra4-3/+24
BFD was leaking memory in bfd_check_format_matches. As part of deciding the proper format of an archive, BFD looks at the format of the first file stored. That file's bfd was left open for reasons given in a comment removed in git commit 0e71e4955cd1 that said: /* We ought to close `first' here, but we can't, because we have no way to remove it from the archive cache. It's close to impossible to figure out when we can release bfd_ardata. FIXME. */ Well, things have changed since that comment was true and we now can remove files from the archive cache. Closing the first file is good and cures some of the leaks. Other leaks are caused by bfd_check_format_matches throwing away bfd tdata before trying a new match. That lost the element cache set up when format checking the first element in the archive. The easiest and cleanest fix is to simply disable the caching when checking the first element. PR 24891 * bfd.c (struct bfd): Add no_element_cache. * archive.c (_bfd_get_elt_at_filepos): Don't add element to archive cache when no_element_cache. (bfd_generic_archive_p): Set no_element_cache when opening first element to check format. Close first element too. (do_slurp_bsd_armap): Don't zero ardata->cache here. * bfd-in2.h: Regenerate.
2019-08-28Automatic date update in version.inGDB Administrator1-1/+1
2019-08-27Automatic date update in version.inGDB Administrator1-1/+1
2019-08-26Automatic date update in version.inGDB Administrator1-1/+1
2019-08-25Automatic date update in version.inGDB Administrator1-1/+1
2019-08-24PowerPC64 segfault in ppc64_elf_edit_tocAlan Modra2-0/+10
Found on a GOT reference to __ehdr_start, which is tweaked to be undefined weak at some stages of linking. SYMBOL_REFERENCES_LOCAL isn't a sufficient test. * elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak symbols from GOT optimisation.
2019-08-24Automatic date update in version.inGDB Administrator1-1/+1
2019-08-23or1k: Fix incorrect value in PLT GOT entries, causing infinite loopStafford Horne2-2/+10
The PLT GOT entry should point to the first PLT entry which contains the runtime linker function. It was pointing back to the symbol PLT entry causing an infinite loop. I found this when testing the OpenRISC glibc port which uses the runtime dynamic linker. It seems other libc's we use so far have not been making use of the initial PLT GOT entries. bfd/ChangeLog: * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for PLT GOT entries.
2019-08-23Stop the BFD library from failing when encountering a second set of relocs ↵Nick Clifton2-2/+19
for the same section. PR 24456 * elf.c (bfd_section_from_shdr): Issue an informative warning message and continue processing other sections after encountering a reloc section for a section which already has other relocs associated with it.
2019-08-23PR24933, Memory leak in elf_x86_64_get_synthetic_symtabAlan Modra2-3/+10
PR 24933 * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit on error without freeing plts[] contents.
2019-08-23Automatic date update in version.inGDB Administrator1-1/+1
2019-08-22Arm: Add support for missing CPUsDennis Zhang2-0/+7
This patch adds support for following CPUs: Cortex-M35P, Cortex-A77, Cortex-A76AE. Related specifications can be found at https://developer.arm.com/ip-products/processors. gas/ChangeLog: * config/tc-arm.c: New entries for Cortex-M35P, Cortex-A77, and Cortex-A76AE. * doc/c-arm.texi: Document new processors. * testsuite/gas/arm/cpu-cortex-a76ae.d: New test. * testsuite/gas/arm/cpu-cortex-a77.d: New test. * testsuite/gas/arm/cpu-cortex-m35p.d: New test. bfd/ChangeLog: * cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.
2019-08-22Fix an illegal memory access when dumping corrupt x86_64 PE unwind data.Nick Clifton2-9/+68
PR 24922 * pei-x86_64.c (pex64_xdata_print_uwd_codes): Add checks before reading data from extra records.
2019-08-22AArch64: Fix LD crash on weak and undefined TLS symbols. (PR/24602).Tamar Christina4-23/+88
This patch fixes a few linker crashes due to TLS code reaching an assert when it shouldn't. The first scenario is with weak TLS symbols that remain weak during linking. In this case the mid-end would not have seen a TLS symbol and so wouldn't have allocated the TLS section. We currently assert here and the linker crashes with a not very useful message. This patch changes this to return the value 0 for the TLS symbol in question emulating what lld and gold and other BFD targets do. However because weak TLS is implementation defined and we don't define any behavior for it I also emit a warning to the user to inform them of such. Secondly when a strong TLS reference is undefined. The linker crashes even after it correctly reported that there is an undefined reference. This changes it so that it gracefully exits and reports a useful error. bfd/ChangeLog: PR ld/24601 * elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined TLS. Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation. * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it. * elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning for weak TLS. ld/ChangeLog: PR ld/24601 * testsuite/ld-aarch64/aarch64-elf.exp (undef-tls, weak-tls): New. * testsuite/ld-aarch64/undef-tls.d: New test. * testsuite/ld-aarch64/undef-tls.s: New test. * testsuite/ld-aarch64/weak-tls.d: New test. * testsuite/ld-aarch64/weak-tls.s: New test.
2019-08-22ARM CMSE symbolsAlan Modra2-20/+14
This patch removes use of st_target_internal to cache the result of comparing symbol names against CMSE_PREFIX. The problem with setting a bit in st_target_internal in swap_symbol_in is that calling bfd_elf_sym_name from swap_symbol_in requires symtab_hdr, and you don't know for sure whether swap_symbol_in is operating on dynsyms (and thus elf_tdata (abfd)->dynsymtab_hdr should be used) or on the normal symtab (thus elf_tdata (abfd)->symtab_hdr). You can make an educated guess based on abfd->flags & DYNAMIC but that relies on knowing a lot about calls to bfd_elf_get_elf_syms, and is fragile in the face of possible future changes. include/ * elf/arm.h (ARM_GET_SYM_CMSE_SPCL, ARM_SET_SYM_CMSE_SPCL): Delete. bfd/ * elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL, instead recognize CMSE_PREFIX in symbol name. (elf32_arm_gc_mark_extra_sections): Likewise. (elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL. (elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.