View | Details | Raw Unified | Return to bug 244768
Collapse All | Expand All

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

Return to bug 244768