]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Stop the linker from accepting executable ELF files as inputs to other links.
authorNick Clifton <nickc@redhat.com>
Thu, 28 May 2020 15:43:01 +0000 (16:43 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 28 May 2020 15:43:01 +0000 (16:43 +0100)
PR 26047
* ldelf.c (ldelf_after_open): Fail if attempting to link one
executable into another.

ld/ChangeLog
ld/ldelf.c

index c4d9f89cd1fcca02b240113393f060c027de6f08..096b9a5398c4ec0b601fd857bc4ded573f3df995 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-28  Nick Clifton  <nickc@redhat.com>
+
+       PR 26047
+       * ldelf.c (ldelf_after_open): Fail if attempting to link one
+       executable into another.
+
 2020-05-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        * NEWS: Mention --enable-textrel-check=yes is default for
index efb4b77382e483cb19d1d6a03074698a32615cd4..475fd000e6bcae9b1e9aad87439e6068a069a01d 100644 (file)
@@ -1065,6 +1065,13 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
        {
          int type = 0;
 
+         if (bfd_link_executable (& link_info)
+             && elf_tdata (abfd)->elf_header->e_type == ET_EXEC)
+           {
+             einfo (_("%F%P: cannot use executable file '%pB' as input to a link\n"),
+                    abfd);
+           }
+
          if (bfd_input_just_syms (abfd))
            continue;