diff options
author | Jon Gjengset | 2015-10-16 17:02:59 -0400 |
---|---|---|
committer | Jon Gjengset | 2015-10-16 17:02:59 -0400 |
commit | 3b2bf8329a347a81140a813da5529ec0b4c695a4 (patch) | |
tree | e1d28df4c2720a47bde1bd1115e3cc38d2c4b88b | |
parent | 95b03a01b7bd71810e105b78beb7a88e7e5d3168 (diff) | |
download | aur-3b2bf8329a347a81140a813da5529ec0b4c695a4.tar.gz |
Fix relative paths in sgx.lds
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rwxr-xr-x | sgx-compile | 50 |
3 files changed, 54 insertions, 8 deletions
@@ -1,7 +1,7 @@ pkgbase = opensgx-git pkgdesc = an open platform for Intel SGX - pkgver = r27.d9d2d68 - pkgrel = 2 + pkgver = r28.1b40acd + pkgrel = 1 url = https://github.com/sslab-gatech/opensgx/ arch = x86_64 license = MIT @@ -21,7 +21,7 @@ pkgbase = opensgx-git md5sums = 9ac0fa0ddae6d0e70f18992894bd1205 md5sums = e65b4d1335c29babacaa0d5dbcbffe3a md5sums = 26415403a05ac7da09e5fc4408328c5b - md5sums = 35670fc0b02b2aa3773470587b0d65f4 + md5sums = d2e79e8bd225da3b50beab7f53f84b7f pkgname = opensgx-git @@ -1,7 +1,7 @@ # Maintainer: Jon Gjengset <jon@thesquareplanet.com> pkgname=opensgx-git -pkgver=r27.d9d2d68 -pkgrel=2 +pkgver=r28.1b40acd +pkgrel=1 pkgdesc="an open platform for Intel SGX" arch=('x86_64') url="https://github.com/sslab-gatech/opensgx/" @@ -27,7 +27,7 @@ md5sums=('SKIP' '9ac0fa0ddae6d0e70f18992894bd1205' 'e65b4d1335c29babacaa0d5dbcbffe3a' '26415403a05ac7da09e5fc4408328c5b' - '35670fc0b02b2aa3773470587b0d65f4') + 'd2e79e8bd225da3b50beab7f53f84b7f') pkgver() { cd "$srcdir/$pkgname" diff --git a/sgx-compile b/sgx-compile index 302e6130e9bd..77e69987d33f 100755 --- a/sgx-compile +++ b/sgx-compile @@ -1,2 +1,48 @@ -#!/bin/sh -cc -g -Wall -pedantic -Wno-unused-function -std=gnu1x -fno-stack-protector -fvisibility=hidden -Wl,-T,/usr/lib/sgx/sgx.lds $(find /usr/lib/sgx/ -type f -iname '*.o') $@ +#!/bin/bash +loader=$(mktemp -p /tmp sgx-XXXXXXXX.lds) +sed \ +-e "/ENCT_START/,/ENCT_END/{ /ENCT_START/{p; i \\ + O_TEXT_SEGMENTS \\ + /usr/lib/sgx/polarssl_sgx/*.o(.text) \\ + /usr/lib/sgx/lib/*.o(.text) \\ + /usr/lib/sgx/*(.enc_text) \\ + /usr/lib/sgx/*Lib.o(.text) +}; /ENCT_END/p; d }" \ +-e "/ENCD_START/,/ENCD_END/{ /ENCD_START/{p; i \\ + O_DATA_SEGMENTS \\ + /usr/lib/sgx/polarssl_sgx/*.o(.data .data.rel.local .bss .rodata COMMON) \\ + /usr/lib/sgx/lib/*.o(.data .data.rel.local .bss .rodata COMMON) \\ + /usr/lib/sgx/*(.enc_data) \\ + /usr/lib/sgx/*Lib.o(.data .data.rel.local .bss .rodata COMMON) +}; /ENCD_END/p; d }" /usr/lib/sgx/sgx.lds > "$loader" + +args=() +for a in "$@"; do + if [ ! -e "$a" ]; then + args=("${args[@]}" "$a") + continue + fi + if [ "${a%.c}" = "$a" ]; then + args=("${args[@]}" "$a") + continue + fi + + # Compile all .cs into .os so they can be included in .enc_data/.enc_text + cc -c -g -Wall -pedantic -Wno-unused-function -std=gnu1x -fno-stack-protector -fvisibility=hidden -o "${a%.c}.o" "$a" + end=$? + if [ $end -ne 0 ]; then + exit $end + fi + + sed -i \ + -e "/O_TEXT_SEGMENTS/i \\ + ${a%.c}.o(.text)" \ + -e "/O_DATA_SEGMENTS/i \\ + ${a%.c}.o(.data .data.rel.local .bss .rodata COMMON)" "$loader" + args=("${args[@]}" "${a%.c}.o") +done + +sed -i -e '/O_TEXT_SEGMENTS/d' -e '/O_DATA_SEGMENTS/d' "$loader" + +cc -g -Wall -pedantic -Wno-unused-function -std=gnu1x -fno-stack-protector -fvisibility=hidden "-Wl,-T,$loader" $(find /usr/lib/sgx/ -type f -iname '*.o') "${args[@]}" +rm "$loader" |