summaryrefslogtreecommitdiff
path: root/emulators/qemu-user-static-devel/files/patch-configure
blob: 683beb48437ea16d163b77824ebd30da3d022892 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--- configure.orig	2019-12-12 02:59:17 UTC
+++ configure
@@ -5954,27 +5954,30 @@ if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] 
     cat > $TMPC <<EOF
     int main(void) { return 0; }
 EOF
-    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
+    textseg_ldflags="-Wl,--image-base=$textseg_addr"
     if ! compile_prog "" "$textseg_ldflags"; then
-      # In case ld does not support -Ttext-segment, edit the default linker
-      # script via sed to set the .text start addr.  This is needed on FreeBSD
-      # at least.
-      if ! $ld --verbose >/dev/null 2>&1; then
-        error_exit \
-            "We need to link the QEMU user mode binaries at a" \
-            "specific text address. Unfortunately your linker" \
-            "doesn't support either the -Ttext-segment option or" \
-            "printing the default linker script with --verbose." \
-            "If you don't want the user mode binaries, pass the" \
-            "--disable-user option to configure."
-      fi
+      textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
+      if ! compile_prog "" "$textseg_ldflags"; then
+        # In case ld does not support -Ttext-segment, edit the default linker
+        # script via sed to set the .text start addr.  This is needed on FreeBSD
+        # at least.
+        if ! $ld --verbose >/dev/null 2>&1; then
+          error_exit \
+              "We need to link the QEMU user mode binaries at a" \
+              "specific text address. Unfortunately your linker" \
+              "doesn't support either the -Ttext-segment option or" \
+              "printing the default linker script with --verbose." \
+              "If you don't want the user mode binaries, pass the" \
+              "--disable-user option to configure."
+        fi
 
-      $ld --verbose | sed \
-        -e '1,/==================================================/d' \
-        -e '/==================================================/,$d' \
-        -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
-      textseg_ldflags="-Wl,-T../config-host.ld"
+        $ld --verbose | sed \
+          -e '1,/==================================================/d' \
+          -e '/==================================================/,$d' \
+          -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
+        textseg_ldflags="-Wl,-T../config-host.ld"
+      fi
     fi
   fi
 fi