OSDN Git Service

Often build systems will use -shared when creating shared libraries, so
authordavidm <davidm>
Thu, 7 May 2009 03:33:32 +0000 (03:33 +0000)
committerdavidm <davidm>
Thu, 7 May 2009 03:33:32 +0000 (03:33 +0000)
don't barf on the flag when we see it.  This makes porting efforts easier.
As a sanity check, make sure we see the -shared-lib-id flag when creating
a shared library.

Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
ld-elf2flt.in

index 3ca0c7b..f3ad80b 100644 (file)
@@ -22,6 +22,7 @@ OBJDUMP="`expr $OBJCOPY : '\(.*\)objcopy'`objdump"
 LDSCRIPTPATH="@binutils_ldscript_dir@" # and the scripts
 SHARED_ID=""
 NEWLDSCRIPT=""
+WANT_SHARED=""
 
 # check TOOLDIR from prefix/bin/ or prefix/target-alias/bin/
 [ -d "${LDSCRIPTPATH}" ] || LDSCRIPTPATH="${TOOLDIR}/../lib"
@@ -56,6 +57,8 @@ then
 
                -shared-lib-id)
                          shift; SHARED_ID="$1";;      # Shared library ID
+               -shared|-G)
+                         WANT_SHARED="y";;            # Shared library
 
                -o)       shift; OFILE="$1";;          # the final outfile
                -o*)      OFILE="`expr \"$1\" : '-o\(.*\)'`";;
@@ -91,6 +94,14 @@ then
                shift
        done
 
+       if [ "$WANT_SHARED" = "y" ]
+       then
+               if [ -z "$SHARED_ID" ]
+               then
+                       echo "-shared used without passing a shared library ID"
+                       exit 1
+               fi
+       fi
        if [ "$FINAL" = "yes" ]
        then
                [ "$VERBOSE" = "y" ] && set -x