This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Disallow -F (or -f) without -shared in ld
- To: binutils at sources dot redhat dot com
- Subject: [PATCH] Disallow -F (or -f) without -shared in ld
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 27 Jun 2001 16:26:17 +0200
- Cc: drepper at redhat dot com
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
Solaris ld disallows using -F or -f without -G:
gcc -o a a.c -Wl,-f,./b.so
ld: fatal: option -f and building a dynamic executable are incompatible
ld: fatal: Flags processing errors
In the standard ELF DT_FILTER resp. DT_AUXILIARY handling it has indeed no
sense to use them for anything but ET_DYN (and the documentation mentions
only shared libraries (.*ilter for shared object symbol table).
In the glibc DT_FILTER/DT_AUXILIARY handling I don't think it makes sense
either, plus the dynamic linker segfaults on it badly.
I think the best solution is just to disallow this:
2001-06-27 Jakub Jelinek <jakub@redhat.com>
* ldmain.c (main): Disallow -F and -f without -shared.
--- ld/ldmain.c.jj Fri May 11 12:26:01 2001
+++ ld/ldmain.c Wed Jun 27 16:20:17 2001
@@ -272,6 +272,14 @@ main (argc, argv)
einfo (_("%P%F: -r and -shared may not be used together\n"));
}
+ if (! link_info.shared)
+ {
+ if (command_line.filter_shlib)
+ einfo ("%P%F: -F may not be used without -shared\n"));
+ if (command_line.auxiliary_filters)
+ einfo ("%P%F: -f may not be used without -shared\n"));
+ }
+
/* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
don't see how else this can be handled, since in this case we
must preserve all externally visible symbols. */
Jakub