From: David McCullough Date: Mon, 10 Jul 2006 22:23:46 +0000 (+0000) Subject: Use the emit-relocs options by default unless the user has configured X-Git-Url: http://git.osdn.net/view?p=uclinux-h8%2Felf2flt.git;a=commitdiff_plain;h=af32d98dcd32c01ba8bdf76ff4266f510f53fb32 Use the emit-relocs options by default unless the user has configured it to do otherwise. Signed-off-by: Richard Sandiford --- diff --git a/configure b/configure index c0f861b..8b816be 100755 --- a/configure +++ b/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP bfd_include_dir binutils_include_dir binutils_ldscript_dir got_check LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP bfd_include_dir binutils_include_dir binutils_ldscript_dir got_check emit_relocs LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -846,6 +846,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-got-check - disable check for GOT (needed on H8) + --disable-emit-relocs - don't use the --emit-relocs (-q) linker option Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1363,6 +1364,15 @@ else fi; +# Check whether --enable-emit_relocs or --disable-emit_relocs was given. +if test "${enable_emit_relocs+set}" = set; then + enableval="$enable_emit_relocs" + emit_relocs=$enableval +else + emit_relocs=yes + +fi; + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -3747,6 +3757,7 @@ done + ac_config_files="$ac_config_files Makefile ld-elf2flt" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4412,6 +4423,7 @@ s,@bfd_include_dir@,$bfd_include_dir,;t t s,@binutils_include_dir@,$binutils_include_dir,;t t s,@binutils_ldscript_dir@,$binutils_ldscript_dir,;t t s,@got_check@,$got_check,;t t +s,@emit_relocs@,$emit_relocs,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/configure.in b/configure.in index ae5dd27..2e2eb7a 100644 --- a/configure.in +++ b/configure.in @@ -37,6 +37,12 @@ AC_ARG_ENABLE(got-check, [ got_check=yes ] ) +AC_ARG_ENABLE(emit_relocs, + [ --disable-emit-relocs - don't use the --emit-relocs (-q) linker option ], + [ emit_relocs=$enableval ], + [ emit_relocs=yes ] +) + AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -122,6 +128,7 @@ AC_SUBST(bfd_include_dir) AC_SUBST(binutils_include_dir) AC_SUBST(binutils_ldscript_dir) AC_SUBST(got_check) +AC_SUBST(emit_relocs) AC_OUTPUT(Makefile ld-elf2flt) diff --git a/ld-elf2flt.in b/ld-elf2flt.in index 778ea0d..134ea45 100644 --- a/ld-elf2flt.in +++ b/ld-elf2flt.in @@ -144,23 +144,31 @@ then LDSCRIPT="$NEWLDSCRIPT" fi - if [ "@got_check@" = "no" ] + if [ "@emit_relocs@" = "yes" ] then - $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -d -o "$OFILE.elf" $ARG1 ||exit $? - $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" $ARG1 ||exit $? + $LINKER $EMUL $SDIRS -T $LDSCRIPT -q -o "$OFILE.gdb" $ARG1 ||exit $? + RFILE="$OFILE.gdb" + FLTFLAGS="$FLTFLAGS -a" 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" + 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" "$OFILE.elf" || exit $? + $ELF2FLT $FLTFLAGS -o "$OFILE" -p "$OFILE.gdb" "$RFILE" || exit $? else - $ELF2FLT $FLTFLAGS -o "$OFILE" -r "$OFILE.elf" || exit $? + $ELF2FLT $FLTFLAGS -o "$OFILE" -r "$RFILE" || exit $? fi - rm -f "$OFILE.elf" # not needed for any reason + [ "$RFILE" = "$OFILE.gdb" ] || rm -f "$RFILE" # not needed for any reason rm -f "$NEWLDSCRIPT" exit 0 fi