From: David McCullough Date: Wed, 16 Apr 2003 06:16:00 +0000 (+0000) Subject: Added a --disable-got-check for platforms that can't do PIC/GOT yet, and X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=d9116452da9c8e00d67e8d87a55c00d96260037b;p=elf2flt.git Added a --disable-got-check for platforms that can't do PIC/GOT yet, and more so for h8300 binutils that cannot do the double link stage normally used by ld-elf2flt. This should be it for h8300 support in elf2flt. --- diff --git a/configure b/configure index d5587e9..c3d2348 100755 --- a/configure +++ b/configure @@ -19,6 +19,8 @@ ac_help="$ac_help --with-bfd-include-dir= include path for correct bfd.h " ac_help="$ac_help --with-binutils-include-dir= include path for binutils headers " +ac_help="$ac_help + --disable-got-check - disable check for GOT (needed on H8) " # Initialize some variables set by options. # The variables have the same names as the options, with @@ -570,6 +572,16 @@ else fi +# Check whether --enable-got-check or --disable-got-check was given. +if test "${enable_got_check+set}" = set; then + enableval="$enable_got_check" + got_check=$enableval +else + got_check=yes + +fi + + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -596,7 +608,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:600: checking host system type" >&5 +echo "configure:612: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -617,7 +629,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:621: checking target system type" >&5 +echo "configure:633: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -638,7 +650,7 @@ echo "$ac_t""$target" 1>&6 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:642: checking for $ac_word" >&5 +echo "configure:654: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -668,7 +680,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:672: checking for $ac_word" >&5 +echo "configure:684: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -719,7 +731,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:723: checking for $ac_word" >&5 +echo "configure:735: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -751,7 +763,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:755: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:767: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -762,12 +774,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 766 "configure" +#line 778 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -793,12 +805,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:809: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:802: checking whether we are using GNU C" >&5 +echo "configure:814: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -807,7 +819,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -826,7 +838,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:830: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:842: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -869,7 +881,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:873: checking for a BSD compatible install" >&5 +echo "configure:885: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -924,7 +936,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test "$ac_libiberty" = "NONE"; then echo $ac_n "checking for objalloc_create in -liberty""... $ac_c" 1>&6 -echo "configure:928: checking for objalloc_create in -liberty" >&5 +echo "configure:940: checking for objalloc_create in -liberty" >&5 ac_lib_var=`echo iberty'_'objalloc_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -932,7 +944,7 @@ else ac_save_LIBS="$LIBS" LIBS="-liberty $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -976,7 +988,7 @@ else fi if test "$ac_libbfd" = "NONE"; then echo $ac_n "checking for bfd_openr in -lbfd""... $ac_c" 1>&6 -echo "configure:980: checking for bfd_openr in -lbfd" >&5 +echo "configure:992: checking for bfd_openr in -lbfd" >&5 ac_lib_var=`echo bfd'_'bfd_openr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -984,7 +996,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbfd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1064,7 +1076,7 @@ if test "$ac_bfd_include_dir" = "NONE" ; then fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1068: checking how to run the C preprocessor" >&5 +echo "configure:1080: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1079,13 +1091,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1101: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1096,13 +1108,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1113,13 +1125,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1144,12 +1156,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1148: checking for ANSI C header files" >&5 +echo "configure:1160: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1157,7 +1169,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1174,7 +1186,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1192,7 +1204,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1213,7 +1225,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1224,7 +1236,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1251,17 +1263,17 @@ for ac_hdr in fcntl.h unistd.h bfd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1255: checking for $ac_hdr" >&5 +echo "configure:1267: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1277: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1289,12 +1301,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1293: checking for working const" >&5 +echo "configure:1305: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1359: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1365,12 +1377,12 @@ fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1369: checking for vprintf" >&5 +echo "configure:1381: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1417,12 +1429,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1421: checking for _doprnt" >&5 +echo "configure:1433: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1478,6 +1490,7 @@ fi + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -1640,6 +1653,7 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CPP@%$CPP%g s%@bfd_include_dir@%$bfd_include_dir%g s%@binutils_include_dir@%$binutils_include_dir%g +s%@got_check@%$got_check%g CEOF EOF diff --git a/configure.in b/configure.in index 06c7ffd..a090be7 100644 --- a/configure.in +++ b/configure.in @@ -25,6 +25,12 @@ AC_ARG_WITH(binutils-include-dir, [ ac_binutils_include_dir=NONE ] ) +AC_ARG_ENABLE(got-check, + [ --disable-got-check - disable check for GOT (needed on H8) ], + [ got_check=$enableval ], + [ got_check=yes ] +) + AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -100,6 +106,7 @@ AC_SUBST(target_os) AC_SUBST(target_vendor) AC_SUBST(bfd_include_dir) AC_SUBST(binutils_include_dir) +AC_SUBST(got_check) AC_OUTPUT(Makefile ld-elf2flt) diff --git a/ld-elf2flt.in b/ld-elf2flt.in index 2c91ec7..e4fd02e 100644 --- a/ld-elf2flt.in +++ b/ld-elf2flt.in @@ -120,10 +120,16 @@ then LDSCRIPT="$NEWLDSCRIPT" fi - $LINKER -r -d -o $OFILE.elf2flt $ARG1 || exit $? - $LINKER $SDIRS -T $LDSCRIPT -Ur -o $OFILE.elf $OFILE.elf2flt || exit $? - $LINKER $SDIRS -T $LDSCRIPT -o $OFILE.gdb $OFILE.elf2flt || exit $? - rm -f $OFILE.elf2flt + if [ "@got_check@" = "no" ] + then + $LINKER $SDIRS -T $LDSCRIPT -Ur -d -o $OFILE.elf $ARG1 ||exit $? + $LINKER $SDIRS -T $LDSCRIPT -o $OFILE.gdb $ARG1 ||exit $? + else + $LINKER -r -d -o $OFILE.elf2flt $ARG1 ||exit $? + $LINKER $SDIRS -T $LDSCRIPT -Ur -o $OFILE.elf $OFILE.elf2flt ||exit $? + $LINKER $SDIRS -T $LDSCRIPT -o $OFILE.gdb $OFILE.elf2flt ||exit $? + rm -f $OFILE.elf2flt + fi if grep _GLOBAL_OFFSET_TABLE_ $OFILE.gdb > /dev/null then $ELF2FLT $FLTFLAGS -o $OFILE -p $OFILE.gdb $OFILE.elf || exit $?