mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
PR27952, Disallow ET_DYN DF_1_PIE linker input
This patch adds a new elf_tdata flag, is_pie, set during the linker's open_input_bfds processing. The flag is then used to reject attempts to link a PIE as if it were a shared library. bfd/ PR 27952 * elf-bfd.h (struct elf_obj_tdata): Add is_pie. * elflink.c (elf_link_add_object_symbols): Set is_pie. ld/ PR 27952 * ldelf.c (ldelf_after_open): Error on input PIEs too.
This commit is contained in:
@@ -1048,7 +1048,9 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
|
||||
&& elf_tdata (abfd) != NULL
|
||||
&& elf_tdata (abfd)->elf_header != NULL
|
||||
/* FIXME: Maybe check for other non-supportable types as well ? */
|
||||
&& elf_tdata (abfd)->elf_header->e_type == ET_EXEC)
|
||||
&& (elf_tdata (abfd)->elf_header->e_type == ET_EXEC
|
||||
|| (elf_tdata (abfd)->elf_header->e_type == ET_DYN
|
||||
&& elf_tdata (abfd)->is_pie)))
|
||||
einfo (_("%F%P: cannot use executable file '%pB' as input to a link\n"),
|
||||
abfd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user