This allows us to drop in a C version without getting filename conflicts.

Signed-off-by: Mike Frysinger <vap...@gentoo.org>
---
 .gitignore       |    1 +
 Makefile.in      |   13 ++--
 configure        |    5 +-
 configure.in     |    3 +-
 ld-elf2flt.in    |  239 ------------------------------------------------------
 ld-elf2flt.sh.in |  239 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 250 insertions(+), 250 deletions(-)
 delete mode 100644 ld-elf2flt.in
 create mode 100644 ld-elf2flt.sh.in

diff --git a/.gitignore b/.gitignore
index 92ff5f6..f318c6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ elf2flt
 elf2flt.ld
 flthdr
 ld-elf2flt
+ld-elf2flt.sh
diff --git a/Makefile.in b/Makefile.in
index 8b82809..dbe9110 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -44,9 +44,10 @@ target_libdir = $(prefix)/$(TARGET)/lib
 
 PROG_ELF2FLT = elf2flt$(EXEEXT)
 PROG_FLTHDR = flthdr$(EXEEXT)
-PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR)
+PROG_LD_ELF2FLT = ld-elf2flt.sh
+PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR) $(PROG_LD_ELF2FLT)
 
-all: $(PROGS) ld-elf2flt
+all: $(PROGS)
 
 # We need to declare the link explicitly because make only provides
 # implicit rules when EXEEXT is set to nothing
@@ -58,7 +59,7 @@ $(PROG_ELF2FLT): elf2flt.o compress.o stubs.o
 $(PROG_FLTHDR): flthdr.o compress.o
        $(link)
 
-ld-elf2flt: $(srcdir)/ld-elf2flt.in
+ld-elf2flt.sh: $(srcdir)/ld-elf2flt.sh.in
        ./config.status $@
 
 Makefile: $(srcdir)/Makefile.in
@@ -68,7 +69,7 @@ clean:
        -rm -f $(PROGS) *.$(OBJEXT) .deps
 
 distclean: clean
-       -rm -f Makefile config.log config.status config.cache ld-elf2flt
+       -rm -f Makefile config.log config.status config.cache
 
 install:
        $(INSTALL) -d $(bindir)
@@ -82,8 +83,8 @@ install:
                mv $(bindir)/$(TARGET)-ld$(EXEEXT) 
$(bindir)/$(TARGET)-ld.real$(EXEEXT)
        [ -f $(target_bindir)/ld.real$(EXEEXT) ] || \
                mv $(target_bindir)/ld$(EXEEXT) 
$(target_bindir)/ld.real$(EXEEXT)
-       $(INSTALL) -m 755 ld-elf2flt $(bindir)/$(TARGET)-ld
-       $(INSTALL) -m 755 ld-elf2flt $(target_bindir)/ld
+       $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(bindir)/$(TARGET)-ld
+       $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(target_bindir)/ld
        $(INSTALL) -m 644 $(SRC_LDFILE) $(target_libdir)/$(LDFILE)
 
 sinclude .deps
diff --git a/configure b/configure
index bcd26ae..9f80e47 100755
--- a/configure
+++ b/configure
@@ -4687,7 +4687,7 @@ done
 
 
 
-ac_config_files="$ac_config_files Makefile ld-elf2flt elf2flt.ld"
+ac_config_files="$ac_config_files Makefile ld-elf2flt.sh elf2flt.ld"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -5299,7 +5299,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "ld-elf2flt") CONFIG_FILES="$CONFIG_FILES ld-elf2flt" ;;
+    "ld-elf2flt.sh") CONFIG_FILES="$CONFIG_FILES ld-elf2flt.sh" ;;
     "elf2flt.ld") CONFIG_FILES="$CONFIG_FILES elf2flt.ld" ;;
 
   *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" 
>&5
@@ -5807,4 +5807,3 @@ if test -n "$ac_unrecognized_opts" && test 
"$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
diff --git a/configure.in b/configure.in
index eb9733f..199280b 100644
--- a/configure.in
+++ b/configure.in
@@ -182,5 +182,4 @@ AC_SUBST(emit_relocs)
 AC_SUBST(emit_ctor_dtor)
 AC_SUBST(SYMBOL_PREFIX)
 
-AC_OUTPUT(Makefile ld-elf2flt elf2flt.ld)
-
+AC_OUTPUT(Makefile ld-elf2flt.sh elf2flt.ld)
diff --git a/ld-elf2flt.in b/ld-elf2flt.in
deleted file mode 100644
index 91e1ccb..0000000
--- a/ld-elf2flt.in
+++ /dev/null
@@ -1,239 +0,0 @@
-#!/bin/sh
-#
-# allow us to do flat processing if the flag -Wl,-elf2flt or -elf2flt to
-# the 'C' compiler or linker respectively
-#
-# uses the env. var FLTFLAGS as extra parameters to pass to elf2flt
-# arguments given like -Wl,-elf2flt="-b 10000 -v" are given before FLTFLAGS
-#
-# Copyright (C) 2002,2003 David McCullough <dav...@snapgear.com>
-# Copyright (C) 2000, Lineo. dav...@lineo.com
-#
-# This is Free Software, under the GNU Public Licence v2 or greater.
-#
-
-LINKER="$0.real"            # the original renamed-linker
-ELF2FLT="`expr $0 : '\(.*\)ld'`elf2flt"
-NM="`expr $0 : '\(.*\)ld'`nm"
-TOOLDIR="`dirname $0`"      # let gcc find the tools for us
-OBJCOPY="`expr $0 : '\(.*\)ld'`objcopy"
-[ -f "$OBJCOPY" ] || OBJCOPY="$TOOLDIR/../../bin/@target_al...@-objcopy"
-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"
-
-#
-# if we have the elf2flt options, run it
-#
-
-if expr "$*" : ".*-elf2flt.*" > /dev/null
-then
-       ARG1=
-       ARG2=
-       OFILE="a.out"
-       PIC=
-       SDIRS=
-       LDSCRIPT=
-       FINAL="yes"
-       FINAL_ONLY=
-       MOVDAT=
-       VERBOSE=
-
-       while [ $# -ne 0 ]
-       do
-               case "$1" in
-
-               -elf2flt) ;;                           # we already know this
-               -elf2flt*)FLTFLAGS="`expr \"$1\" : '-elf2flt=\(.*\)'` 
$FLTFLAGS";; 
-
-               -move-rodata)
-                         MOVDAT="y";;                 # Put rodata in ROM if 
possible
-               -s)       ;;                           # Ignore -s (strip)
-
-               -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\(.*\)'`";;
-
-               -T)       shift; LDSCRIPT="$1";;       # they have a linker 
script
-               -c)       shift; LDSCRIPT="$1";;
-
-               -L)       ARG1="$ARG1 $1"              # remember search dirs
-                         shift;
-                                 ARG1="$ARG1 $1"
-                                 SDIRS="$SDIRS -L$1"
-                                 ;;
-               -L*)      ARG1="$ARG1 $1"; SDIRS="$SDIRS $1";;
-
-               -EB)      ARG1="$ARG1 $1"; SDIRS="$SDIRS $1";; # arm big endian
-
-               -relax)   ;;                           # eat this for microblaze
-
-               -r|-Ur)   FINAL=""                     # this is not a final 
link
-                         ARG1="$ARG1 $1"
-                                 ;;
-
-               -v)       ARG1="$ARG1 $1"
-                                 VERBOSE="y"
-                                 ;;
-
-               -m)       shift; EMUL="-m $1";;        # ld emulations for h8300
-               -m*)      EMUL=$1;;
- 
-               *)        ARG1="$ARG1 $1"
-                                 ;;
-               esac
-               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
-               ARG1="$ARG1 $FINAL_ONLY"
-               NEWLDSCRIPT=`mktemp /tmp/flt-XXXXXX`
-               trap 'rm -f "$NEWLDSCRIPT"' EXIT
-               SEDOP=" -e s/^R_RODAT// -e /^W_RODAT/d"
-               OBJCOPYOP=""
-               if [ "$MOVDAT" ]
-               then
-                       $LINKER -r -d -o "$OFILE.elf2flt" $ARG1  || exit $?
-                       if [ "`$OBJDUMP -h "$OFILE.elf2flt" | \
-                                       egrep -A1 '[.]rodata' | grep RELOC`" ]
-                       then
-                               echo "warning: .rodata section contains 
relocations"
-                       else
-                               SEDOP="-e /^R_RODAT/d -e s/^W_RODAT//"
-                       fi
-               fi
-               if [ "$SHARED_ID" ]
-               then
-                       # Massage the linker script into something useful.  
These
-                       # regexps are ugly due to some bizzare shell quoting 
rules.
-                       #    SEDOP="$SEDOP -e \"s/ORIGIN = 0x0,/ORIGIN = 
0x${SHARED_ID}000000,/\""
-                       #    SEDOP="$SEDOP -e \"s/.text 0x0 :/.text 
0x${SHARED_ID}000000 :/\""                  
-                       SEDOP="$SEDOP -e 
s/\\(ORIGIN.=.0\\)x0,/\\1x${SHARED_ID}000000,/"
-                       SEDOP="$SEDOP -e 
s/\\([.]text.0\\)x0[^0-9]:/\\1x${SHARED_ID}000000:/"
-                       
-                       if [ "$SHARED_ID" -gt 0 ]
-                       then
-                               # Non application modules enter via main not 
_start
-                               #    SEDOP="$SEDOP -e 's/ENTRY (_start)/ENTRY 
(main)/'"
-                               SEDOP="$SEDOP -e 
s/\\(ENTRY.\\)(@symbol_pre...@_start)/\1(lib_main)/"
-                               OBJCOPYOP="--localize-hidden --weaken"
-                       fi
-
-                       # Provide the magic parameter that defines the library 
data segment pointer offset
-                       GOT_ADJ=4
-                       case "@target_cpu@" in
-                           bfin)  
GOT_OFFSET="_current_shared_library_p5_offset_" GOT_ADJ=1;;
-                           h8300) 
GOT_OFFSET="__current_shared_library_er5_offset_";;
-                           *)     
GOT_OFFSET="_current_shared_library_a5_offset_";;
-                       esac
-                       ARG1="$ARG1 -defsym $GOT_OFFSET=`expr ${SHARED_ID} '*' 
-${GOT_ADJ} - ${GOT_ADJ}`"
-               fi
-               if [ "@emit_relocs@" = "yes" ]
-               then
-                       SEDOP="$SEDOP -e s/^SINGLE_LINK://"
-               else
-                       SEDOP="$SEDOP -e /^SINGLE_LINK:/d"
-               fi
-               if [ "@emit_ctor_dtor@" = "yes" ]
-               then
-                       SEDOP="$SEDOP -e s/^TOR://"
-               else
-                       SEDOP="$SEDOP -e /^TOR:/d"
-               fi
-               
-               # provide a default linker script, we usually need one
-               [ -z "$LDSCRIPT" ] && LDSCRIPT="${LDSCRIPTPATH}/elf2flt.ld"
-
-               # if we can find the linker script we preprocess it,  otherwise
-               # we assume the user knows what they are doing
-               if [ -f "$LDSCRIPT" ]; then
-                       sed $SEDOP < "$LDSCRIPT" > "$NEWLDSCRIPT"
-                       LDSCRIPT="$NEWLDSCRIPT"
-               elif [ -f "${LDSCRIPTPATH}/$LDSCRIPT" ]; then
-                       sed $SEDOP < "${LDSCRIPTPATH}/$LDSCRIPT" > 
"$NEWLDSCRIPT"
-                       LDSCRIPT="$NEWLDSCRIPT"
-               elif [ -f "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" ]; then
-                       sed $SEDOP < "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" > 
"$NEWLDSCRIPT"
-                       LDSCRIPT="$NEWLDSCRIPT"
-               fi
-
-               if [ "@emit_relocs@" = "yes" ]
-               then
-                $LINKER $EMUL $SDIRS -T $LDSCRIPT -q -o "$OFILE.gdb" $ARG1     
        ||exit $?
-                RFILE="$OFILE.gdb"
-                FLTFLAGS="$FLTFLAGS -a"
-               else
-                if [ "@got_check@" = "no" ]
-                then
-                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" 
$ARG1         ||exit $?
-                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" $ARG1       
         ||exit $?
-                else
-                 $LINKER $EMUL -r -d -o "$OFILE.elf2flt" $ARG1                 
         ||exit $?
-                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" 
"$OFILE.elf2flt" ||exit $?
-                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" 
"$OFILE.elf2flt"     ||exit $?
-                 rm -f "$OFILE.elf2flt"
-                fi
-                RFILE="$OFILE.elf"
-               fi
-               if $NM "$OFILE.gdb" | grep _GLOBAL_OFFSET_TABLE_ > /dev/null 
-               then
-                       $ELF2FLT $FLTFLAGS -o "$OFILE" -p "$OFILE.gdb" "$RFILE" 
|| exit $?
-               else
-                       $ELF2FLT $FLTFLAGS -o "$OFILE" -r "$RFILE" || exit $?
-               fi
-               if [ "$OBJCOPYOP" ]
-               then
-                if $OBJCOPY $OBJCOPYOP --help > /dev/null 2>&1
-                then
-                 $OBJCOPY $OBJCOPYOP "$OFILE.gdb" ||exit $?
-                else
-                 case " $OBJCOPYOP " in
-                 *" --localize-hidden "*)
-                   SYMS=`mktemp /tmp/flt-XXXXXX`
-                   $OBJDUMP --syms "$OFILE.gdb" > "$SYMS" ||exit $?
-                   sed -n 's/.*\(\.hidden\|\.internal\) \(.*\)/-L \2/p' < 
"$SYMS" > "$SYMS.hidden" ||exit $?
-                   if [ -s "$SYMS.hidden" ]
-                   then
-                    xargs ${VERBOSE:+-t} $OBJCOPY "$OFILE.gdb" < 
"$SYMS.hidden" ||exit $?
-                   fi
-                   rm -f "$SYMS" "$SYMS.hidden"
-                   ;;
-                 esac
-                 case " $OBJCOPYOP " in
-                 *" --weaken "*)
-                   $OBJCOPY --weaken "$OFILE.gdb" ||exit $?
-                   ;;
-                 esac
-                fi
-               fi
-               [ "$RFILE" = "$OFILE.gdb" ] || rm -f "$RFILE"  # not needed for 
any reason
-               exit 0
-       fi
-
-       exec $LINKER -o "$OFILE" $ARG1
-fi
-
-#
-# otherwise pretend we aren't here
-#
-
-exec $LINKER "$@"
diff --git a/ld-elf2flt.sh.in b/ld-elf2flt.sh.in
new file mode 100644
index 0000000..2b868cc
--- /dev/null
+++ b/ld-elf2flt.sh.in
@@ -0,0 +1,239 @@
+#!/bin/sh
+#
+# allow us to do flat processing if the flag -Wl,-elf2flt or -elf2flt to
+# the 'C' compiler or linker respectively
+#
+# uses the env. var FLTFLAGS as extra parameters to pass to elf2flt
+# arguments given like -Wl,-elf2flt="-b 10000 -v" are given before FLTFLAGS
+#
+# Copyright (C) 2002,2003 David McCullough <dav...@snapgear.com>
+# Copyright (C) 2000, Lineo. dav...@lineo.com
+#
+# This is Free Software, under the GNU Public Licence v2 or greater.
+#
+
+LINKER="$0.real"            # the original renamed-linker
+ELF2FLT="`expr $0 : '\(.*\)ld'`elf2flt"
+NM="`expr $0 : '\(.*\)ld'`nm"
+TOOLDIR="`dirname $0`"      # let gcc find the tools for us
+OBJCOPY="`expr $0 : '\(.*\)ld'`objcopy"
+[ -f "$OBJCOPY" ] || OBJCOPY="$TOOLDIR/../../bin/@target_al...@-objcopy"
+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"
+
+#
+# if we have the elf2flt options, run it
+#
+
+if expr "$*" : ".*-elf2flt.*" > /dev/null
+then
+       ARG1=
+       ARG2=
+       OFILE="a.out"
+       PIC=
+       SDIRS=
+       LDSCRIPT=
+       FINAL="yes"
+       FINAL_ONLY=
+       MOVDAT=
+       VERBOSE=
+
+       while [ $# -ne 0 ]
+       do
+               case "$1" in
+
+               -elf2flt) ;;                           # we already know this
+               -elf2flt*)FLTFLAGS="`expr \"$1\" : '-elf2flt=\(.*\)'` 
$FLTFLAGS";;
+
+               -move-rodata)
+                         MOVDAT="y";;                 # Put rodata in ROM if 
possible
+               -s)       ;;                           # Ignore -s (strip)
+
+               -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\(.*\)'`";;
+
+               -T)       shift; LDSCRIPT="$1";;       # they have a linker 
script
+               -c)       shift; LDSCRIPT="$1";;
+
+               -L)       ARG1="$ARG1 $1"              # remember search dirs
+                         shift;
+                                 ARG1="$ARG1 $1"
+                                 SDIRS="$SDIRS -L$1"
+                                 ;;
+               -L*)      ARG1="$ARG1 $1"; SDIRS="$SDIRS $1";;
+
+               -EB)      ARG1="$ARG1 $1"; SDIRS="$SDIRS $1";; # arm big endian
+
+               -relax)   ;;                           # eat this for microblaze
+
+               -r|-Ur)   FINAL=""                     # this is not a final 
link
+                         ARG1="$ARG1 $1"
+                                 ;;
+
+               -v)       ARG1="$ARG1 $1"
+                                 VERBOSE="y"
+                                 ;;
+
+               -m)       shift; EMUL="-m $1";;        # ld emulations for h8300
+               -m*)      EMUL=$1;;
+
+               *)        ARG1="$ARG1 $1"
+                                 ;;
+               esac
+               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
+               ARG1="$ARG1 $FINAL_ONLY"
+               NEWLDSCRIPT=`mktemp /tmp/flt-XXXXXX`
+               trap 'rm -f "$NEWLDSCRIPT"' EXIT
+               SEDOP=" -e s/^R_RODAT// -e /^W_RODAT/d"
+               OBJCOPYOP=""
+               if [ "$MOVDAT" ]
+               then
+                       $LINKER -r -d -o "$OFILE.elf2flt" $ARG1  || exit $?
+                       if [ "`$OBJDUMP -h "$OFILE.elf2flt" | \
+                                       egrep -A1 '[.]rodata' | grep RELOC`" ]
+                       then
+                               echo "warning: .rodata section contains 
relocations"
+                       else
+                               SEDOP="-e /^R_RODAT/d -e s/^W_RODAT//"
+                       fi
+               fi
+               if [ "$SHARED_ID" ]
+               then
+                       # Massage the linker script into something useful.  
These
+                       # regexps are ugly due to some bizzare shell quoting 
rules.
+                       #    SEDOP="$SEDOP -e \"s/ORIGIN = 0x0,/ORIGIN = 
0x${SHARED_ID}000000,/\""
+                       #    SEDOP="$SEDOP -e \"s/.text 0x0 :/.text 
0x${SHARED_ID}000000 :/\""
+                       SEDOP="$SEDOP -e 
s/\\(ORIGIN.=.0\\)x0,/\\1x${SHARED_ID}000000,/"
+                       SEDOP="$SEDOP -e 
s/\\([.]text.0\\)x0[^0-9]:/\\1x${SHARED_ID}000000:/"
+
+                       if [ "$SHARED_ID" -gt 0 ]
+                       then
+                               # Non application modules enter via main not 
_start
+                               #    SEDOP="$SEDOP -e 's/ENTRY (_start)/ENTRY 
(main)/'"
+                               SEDOP="$SEDOP -e 
s/\\(ENTRY.\\)(@symbol_pre...@_start)/\1(lib_main)/"
+                               OBJCOPYOP="--localize-hidden --weaken"
+                       fi
+
+                       # Provide the magic parameter that defines the library 
data segment pointer offset
+                       GOT_ADJ=4
+                       case "@target_cpu@" in
+                           bfin)  
GOT_OFFSET="_current_shared_library_p5_offset_" GOT_ADJ=1;;
+                           h8300) 
GOT_OFFSET="__current_shared_library_er5_offset_";;
+                           *)     
GOT_OFFSET="_current_shared_library_a5_offset_";;
+                       esac
+                       ARG1="$ARG1 -defsym $GOT_OFFSET=`expr ${SHARED_ID} '*' 
-${GOT_ADJ} - ${GOT_ADJ}`"
+               fi
+               if [ "@emit_relocs@" = "yes" ]
+               then
+                       SEDOP="$SEDOP -e s/^SINGLE_LINK://"
+               else
+                       SEDOP="$SEDOP -e /^SINGLE_LINK:/d"
+               fi
+               if [ "@emit_ctor_dtor@" = "yes" ]
+               then
+                       SEDOP="$SEDOP -e s/^TOR://"
+               else
+                       SEDOP="$SEDOP -e /^TOR:/d"
+               fi
+
+               # provide a default linker script, we usually need one
+               [ -z "$LDSCRIPT" ] && LDSCRIPT="${LDSCRIPTPATH}/elf2flt.ld"
+
+               # if we can find the linker script we preprocess it,  otherwise
+               # we assume the user knows what they are doing
+               if [ -f "$LDSCRIPT" ]; then
+                       sed $SEDOP < "$LDSCRIPT" > "$NEWLDSCRIPT"
+                       LDSCRIPT="$NEWLDSCRIPT"
+               elif [ -f "${LDSCRIPTPATH}/$LDSCRIPT" ]; then
+                       sed $SEDOP < "${LDSCRIPTPATH}/$LDSCRIPT" > 
"$NEWLDSCRIPT"
+                       LDSCRIPT="$NEWLDSCRIPT"
+               elif [ -f "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" ]; then
+                       sed $SEDOP < "${LDSCRIPTPATH}/ldscripts/$LDSCRIPT" > 
"$NEWLDSCRIPT"
+                       LDSCRIPT="$NEWLDSCRIPT"
+               fi
+
+               if [ "@emit_relocs@" = "yes" ]
+               then
+                $LINKER $EMUL $SDIRS -T $LDSCRIPT -q -o "$OFILE.gdb" $ARG1     
        ||exit $?
+                RFILE="$OFILE.gdb"
+                FLTFLAGS="$FLTFLAGS -a"
+               else
+                if [ "@got_check@" = "no" ]
+                then
+                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" 
$ARG1         ||exit $?
+                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" $ARG1       
         ||exit $?
+                else
+                 $LINKER $EMUL -r -d -o "$OFILE.elf2flt" $ARG1                 
         ||exit $?
+                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" 
"$OFILE.elf2flt" ||exit $?
+                 $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" 
"$OFILE.elf2flt"     ||exit $?
+                 rm -f "$OFILE.elf2flt"
+                fi
+                RFILE="$OFILE.elf"
+               fi
+               if $NM "$OFILE.gdb" | grep _GLOBAL_OFFSET_TABLE_ > /dev/null
+               then
+                       $ELF2FLT $FLTFLAGS -o "$OFILE" -p "$OFILE.gdb" "$RFILE" 
|| exit $?
+               else
+                       $ELF2FLT $FLTFLAGS -o "$OFILE" -r "$RFILE" || exit $?
+               fi
+               if [ "$OBJCOPYOP" ]
+               then
+                if $OBJCOPY $OBJCOPYOP --help > /dev/null 2>&1
+                then
+                 $OBJCOPY $OBJCOPYOP "$OFILE.gdb" ||exit $?
+                else
+                 case " $OBJCOPYOP " in
+                 *" --localize-hidden "*)
+                   SYMS=`mktemp /tmp/flt-XXXXXX`
+                   $OBJDUMP --syms "$OFILE.gdb" > "$SYMS" ||exit $?
+                   sed -n 's/.*\(\.hidden\|\.internal\) \(.*\)/-L \2/p' < 
"$SYMS" > "$SYMS.hidden" ||exit $?
+                   if [ -s "$SYMS.hidden" ]
+                   then
+                    xargs ${VERBOSE:+-t} $OBJCOPY "$OFILE.gdb" < 
"$SYMS.hidden" ||exit $?
+                   fi
+                   rm -f "$SYMS" "$SYMS.hidden"
+                   ;;
+                 esac
+                 case " $OBJCOPYOP " in
+                 *" --weaken "*)
+                   $OBJCOPY --weaken "$OFILE.gdb" ||exit $?
+                   ;;
+                 esac
+                fi
+               fi
+               [ "$RFILE" = "$OFILE.gdb" ] || rm -f "$RFILE"  # not needed for 
any reason
+               exit 0
+       fi
+
+       exec $LINKER -o "$OFILE" $ARG1
+fi
+
+#
+# otherwise pretend we aren't here
+#
+
+exec $LINKER "$@"
-- 
1.6.3.3

_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to