aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2023-01-16Leftover hack from i960-coffAlan Modra1-6/+2
* reloc.c (bfd_perform_relocation, bfd_install_relocation): Remove i960-coff target hack.
2023-01-16COFF CALC_ADDEND commentAlan Modra1-0/+8
Old COFF (and AOUT) targets have unusual relocation addends. * coffcode.h (<Reading relocations>): Describe COFF addends.
2023-01-16Automatic date update in version.inGDB Administrator1-1/+1
2023-01-15Automatic date update in version.inGDB Administrator1-1/+1
2023-01-14Automatic date update in version.inGDB Administrator1-1/+1
2023-01-13Updated Romainian translation for the bfd sub-directoryNick Clifton2-2742/+2820
2023-01-13Automatic date update in version.inGDB Administrator1-1/+1
2023-01-12ARM: Fix ld bloat introduced between binutils-2.38 and 2.39Hans-Peter Nilsson1-4/+0
Since commit 9833b7757d24, "PR28824, relro security issues", ELF_MAXPAGESIZE matters much more, with regards to layout of the linked file. That commit fixed an actual bug, but also exposes a problem for targets were that value is too high. For example, for ARM(32, a.k.a. "Aarch32") specifically bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU) targets pay an extra amount of up to 60 KiB of bloat in DSO:s and executables. This matters when there are many such files, and where storage is expensive. It's *mostly* bloat when using a Linux kernel, as ARM(32) is a good example of an target where ELF_MAXPAGESIZE is set to an extreme value for an obscure corner-case. The ARM (32-bit) kernel has 4 KiB pages, has had that value forever, and can't be configured to any other value. The use-case is IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but not just that, but a setup where the Linux page-size is configured to something other than the *default* 4 KiB. Not sure there actually any such systems in use, again with both Aarch32 compatibility support and a non-4KiB pagesize, with all the warnings in the kernel config and requiring the "EXPERT" level set on. So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only one default max-page-size" and set ELF_MAXPAGESIZE to 4096. bfd: * elf32-arm.c (ELF_MAXPAGESIZE): Always set to 0x1000.
2023-01-12Use __func__ rather than __FUNCTION__Alan Modra5-8/+7
We already use C99's __func__ in places, use it more generally. This patch doesn't change uses in the testsuite. I've also left one in gold.h that is protected by GCC_VERSION < 4003. If any of the remaining uses bothers anyone I invite patches. bfd/ * bfd-in.h: Replace __FUNCTION__ with __func__. * elf32-bfin.c: Likewise. * elfnn-aarch64.c: Likewise. * elfxx-sparc.c: Likewise. * bfd-in2.h: Regenerate. gas/ * config/tc-cris.c: Replace __FUNCTION__ with __func__. * config/tc-m68hc11.c: Likewise. * config/tc-msp430.c: Likewise. gold/ * dwp.h: Replace __FUNCTION__ with __func__. * gold.h: Likewise, except for use inside GCC_VERSION < 4003. ld/ * emultempl/pe.em: Replace __FUNCTION__ with __func__. * emultempl/pep.em: Likewise. * pe-dll.c: Likewise.
2023-01-12Automatic date update in version.inGDB Administrator1-1/+1
2023-01-11Fix a potential illegal memory access in the BFD library when parsing a ↵Nick Clifton2-1/+7
corrupt DWARF file. PR 29988 * dwarf2.c (read_indexed_address): Fix check for an out of range offset.
2023-01-11Automatic date update in version.inGDB Administrator1-1/+1
2023-01-10Add aarch64-w64-mingw32 targetMark Harmstone2-3/+3
This adds a mingw target for aarch64, including windres and dlltool. Note that the old value of jmp_aarch64_bytes was wrong, and this does the same thing as MSVC does.
2023-01-10Add .secrel32 for pe-aarch64Mark Harmstone1-1/+46
Adds the .secrel32 pseudo-directive and its corresponding relocation.
2023-01-10Add pe-aarch64 relocationsMark Harmstone2-20/+660
This adds the remaining pe-aarch64 relocations, and gets them working. It also brings in the constant directives from ELF, as otherwise .word would be 2 rather than 4 bytes, and .xword and .dword wouldn't be defined.
2023-01-10Fix size of external_reloc for pe-aarch64Mark Harmstone1-4/+0
This patch series finishes off the work by Jedidiah Thompson, and adds support for creating aarch64 PE images. This should be essentially complete: I've used this to create a "hello world" Windows program in asm, and (with GCC patches) a UEFI program in C. I think the only things missing are the .secidx relocation, which is needed for PDBs, and the SEH pseudos used for C++ exceptions. This first patch fixes the size of RELSZ; I'm not sure why it was 14 in the first place. This is the size of the "Base Relocation Block" in https://learn.microsoft.com/en-us/windows/win32/debug/pe-format, and AFAIK should be 10 for everything.
2023-01-10IBM zSystems: Fix offset relative to static TLSStefan Schulze Frielinghaus2-4/+4
For local exec TLS relocations of the form foo@NTPOFF+x the addend was ignored. bfd/ChangeLog: * elf32-s390.c (elf_s390_relocate_section): Honor addend for R_390_TLS_LE32. * elf64-s390.c (elf_s390_relocate_section): Honor addend for R_390_TLS_LE64. ld/ChangeLog: * testsuite/ld-s390/reloctlsle-1.d: New test. * testsuite/ld-s390/reloctlsle-1.s: New test.
2023-01-10PR 29981 references to init.texiPekka Seppänen1-1/+0
2023-01-10Re: Move bfd_init to bfd.cAlan Modra3-44/+44
Commit b1c95bc4dd73 resulted in ...bfd.texi:246: @include: could not find init.texi which went unnoticed due to not building in a clean directory. This fixes the problem by moving bfd_init earlier, giving it a doc node, and stitching the nodes back together. * bfd.c (bfd_init): Move earlier. Give it a doc inode. Adjust other inodes to suit. * doc/bfd.texi: Don't include init.texi. Adjust nodes to suit.
2023-01-10Automatic date update in version.inGDB Administrator1-1/+1
2023-01-10Set dwarf2 stash pointer earlierAlan Modra1-2/+1
This fixes a memory leak in the vanishingly rare cases (found by fuzzers of course) when something goes wrong in the save_section_vma, htab_create_alloc or alloc_trie_leaf calls before *pinfo is written. If *pinfo is not written, _bfd_dwarf2_cleanup_debug_info won't be able to free that memory. * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Save stash pointer on setting up stash.
2023-01-10peXXigen.c sanity checksAlan Modra1-44/+52
Also fix a memory leak, and make some style changes. I tend to read (sizeof * x) as a multiplication of two variables, which I would not do if binutils followed the gcc coding conventions consistently (see https://gcc.gnu.org/codingconventions.html#Expressions). (sizeof *x) looks a lot better to me, or even (sizeof (*x)) which I've used here. * peXXigen.c (get_contents_sanity_check): New function. (pe_print_idata): Use it here.. (pe_print_edata): ..and here. Free data on error return. (rsrc_parse_entry): Check entry size read from file. (rsrc_parse_entries): Style fixes. (rsrc_process_section): Use bfd_malloc_and_get_section. (_bfd_XXi_final_link_postscript): Likewise.
2023-01-10Move mips_refhi_list to bfd tdataAlan Modra3-18/+31
Similar to commit c799eddb3512, but for mips-ecoff. mips-ecoff is marked obsolete, but we still allow reading of these object files in a number of mips targets. * coff-mips.c (struct mips_hi, mips_refhi_list): Delete. (mips_refhi_reloc, mips_reflo_reloc): Access mips_refhi_list in ecoff_data. * ecoff.c (_bfd_ecoff_close_and_cleanup): New function. * libecoff.h (struct mips_hi): Moved from coff-mips.c. (struct ecoff_tdata): Add mips_refhi_list. (_bfd_ecoff_close_and_cleanup): Declare.
2023-01-10Move bfd_init to bfd.cAlan Modra7-60/+56
init.c contains just one function that doesn't do much. Move it to bfd.c and give it something to do, initialising static state. So far the only initialisation is for bfd.c static variables. The idea behind reinitialising state is to see whether some set of flaky oss-fuzz crashes go away. oss-fuzz stresses binutils in ways that can't occur in reality, feeding multiple testcases into the internals of binutils. So one testcase may affect the result of the next testcase. * init.c: Delete file. Move bfd_init to.. * bfd.c (bfd_init): ..here. Init static variables. * Makefile.am (BFD32_LIBS): Remove init.lo. (BFD32_LIBS_CFILES, BFD_H_FILES): Remove init.c. * doc/local.mk: Remove mention of init.texi and init.c. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * po/SRC-POTFILES.in: Regenerate.
2023-01-09Fix PR18841 ifunc relocation orderingChristophe Lyon1-0/+29
In order to get the ifunc relocs properly sorted the correct class needs to be returned. The code mimics what has been done for AArch64. Fixes: FAIL: Run pr18841 with libpr18841b.so FAIL: Run pr18841 with libpr18841c.so FAIL: Run pr18841 with libpr18841bn.so (-z now) FAIL: Run pr18841 with libpr18841cn.so (-z now) bfd/ PR ld/18841 * elf32-arm.c (elf32_arm_reloc_type_class): Return reloc_class_ifunc for ifunc symbols. ld/testsuite/ * ld-arm/ifunc-12.rd: Update relocations order. * ld-arm/ifunc-3.rd: Likewise. * ld-arm/ifunc-4.rd: Likewise.
2023-01-09Automatic date update in version.inGDB Administrator1-1/+1
2023-01-08Automatic date update in version.inGDB Administrator1-1/+1
2023-01-07Automatic date update in version.inGDB Administrator1-1/+1
2023-01-06Updated Bulgarian and Russian translations for LD and BFD respectivelyNick Clifton2-1763/+2183
2023-01-06Fix an aout memory leakAlan Modra1-0/+1
* aoutx.h (aout_bfd_free_cached_info): Free line_buf.
2023-01-06Tidy pe flag in coff_dataAlan Modra8-12/+11
Make it a bool, use obj_pe accessor everywhere.
2023-01-06Make coff backend data read-onlyAlan Modra6-34/+56
The bfd_coff_backend_data struct should be read-only, the only thing preventing this is that objcopy writes to one of the fields, _bfd_coff_long_section_names. This patch creates a copy of the field in bfd coff_obj_tdata, which makes more sense anyway. When enabling long section names the intent is to do so for a particular bfd, not for all bfds that might happen to be using the target xvec. bfd/ * coffcode.h: Update coff long section name comment. (bfd_coff_set_long_section_names_allowed): Use macro accessor to set flag. (bfd_coff_set_long_section_names_disallowed): Tidy. (coff_backend_info): Return a const pointer. (bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table), (bigobj_swap_table): Make const. (bfd_coff_long_section_names): Use tdata copy. (coff_mkobject): Set long_section_names from coff_backend_info. * coff-go32.c (_bfd_go32_mkobject): Likewise. * peicode.h (pe_mkobject): Likewise. * coff-sh.c (bfd_coff_small_swap_table): Make const. * libcoff-in.h (struct coff_tdata): Add long_section_names, reorder fields. * libcoff.h: Regenerate. binutils/ * objcopy.c (set_long_section_mode): Move earlier in file. (copy_object): Call set_long_section_mode here, after setting output format. (copy_file): Don't call set_long_section_mode.
2023-01-06Automatic date update in version.inGDB Administrator1-1/+1
2023-01-05PR29963, PDP11 link produces spurious relocation truncated messagesPaul Koning1-3/+3
PDP11 is a 16-bit processor with 16-bit logical addresses. Therefore wrapping should be allowed on the 16-bit relocs, and may as well be allowed for the 32-bit reloc too. PR 29963 * pdp11.c (howto_table_pdp11): Use complain_overflow_dont.
2023-01-05Automatic date update in version.inGDB Administrator1-1/+1
2023-01-04x86: Remove duplicated I386_PCREL_TYPE_P/X86_64_PCREL_TYPE_PH.J. Lu1-7/+0
I386_PCREL_TYPE_P and X86_64_PCREL_TYPE_P are defined twice. Remove the duplications. * elfxx-x86.h (I386_PCREL_TYPE_P): Remove duplication. (X86_64_PCREL_TYPE_P): Likewise.
2023-01-04asan: segv in parse_moduleAlan Modra1-2/+5
* vms-alpha.c (parse_module): Ignore DST__K_SRC_SETFILE data if out of range.
2023-01-04addr2line out of memory on fuzzed fileAlan Modra1-0/+8
Another case of fuzzers finding the section size sanity checks are avoided with SHT_NOBITS sections. * dwarf2.c (read_section): Check that the DWARF section being read has contents.
2023-01-04Automatic date update in version.inGDB Administrator1-1/+1
2023-01-03Fix a potential problem in the BFD library when accessing the Windows' nul ↵Himal2-0/+11
device driver. PR 29947 * bfdio.c (_bfd_real_fopen): Do not add a prefix to the Windows' nul device filename.
2023-01-03Updated translations for various languages and sub-directoriesNick Clifton3-2805/+3034
2023-01-03Automatic date update in version.inGDB Administrator1-1/+1
2023-01-02obsolete target tidyAlan Modra17-939/+11
Delete a few files only used for obsolete targets, and tidy config, xfails and other pieces of support specific to those targets. And since I was editing target triplets in test files, fix the nm alpha-linuxecoff fails.
2023-01-02Automatic date update in version.inGDB Administrator1-1/+1
2023-01-01Update year range in copyright notice of binutils filesAlan Modra430-435/+435
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.
2023-01-01Automatic date update in version.inGDB Administrator1-1/+1
2022-12-31Update version number and regenerate filesNick Clifton3-1439/+1498
2022-12-31Add markers for 2.40 branchNick Clifton1-0/+4
2022-12-31Automatic date update in version.inGDB Administrator1-1/+1
2022-12-30Automatic date update in version.inGDB Administrator1-1/+1