This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Disallow -F (or -f) without -shared in ld


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]