diff --git a/configure b/configure
index 9d46354..b3025df 100755
--- a/configure
+++ b/configure
@@ -4438,17 +4438,18 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   textseg_addr=
   case "$ARCH" in
   arm | hppa | i386 | ia64 | m68k | ppc | ppc64 | s390 | sparc | sparc64 | x86_64)
-    default_textseg_addr=0x400000
     textseg_addr=0x60000000
     ;;
   mips)
-    default_textseg_addr=0x120000000
     textseg_addr=0x400000
     ;;
   esac
   if [ -n "$textseg_addr" ]; then
+cat > $TMPC <<EOF
+int main(void) { return 0; }
+EOF
     try_ldflags="-Ttext-segment=$textseg_addr"
-    if $ld $try_ldflags /dev/null >/dev/null 2>&1; then
+    if compile_prog "" "$try_ldflags"; then
       ldflags="$ldflags $try_ldflags"
     else
       # In case ld does not support -Ttext-segment, edit the default linker
@@ -4457,7 +4458,8 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
       $ld --verbose | sed \
         -e '1,/==================================================/d' \
         -e '/==================================================/,$d' \
-        -e "s/$default_textseg_addr/$textseg_addr/g" > config-host.ld
+        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
+        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
       ldflags="$ldflags -Wl,-T../config-host.ld"
     fi
   fi
