]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/ldelf.c
Stop the linker from accepting executable ELF files as inputs to other links.
[thirdparty/binutils-gdb.git] / ld / ldelf.c
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;