[tyndur-devel] [PATCH 7/7] libc: Mit -fPIC kompilieren
Kevin Wolf ·
* libc: Wenn man mit -fPIC kompiliert, sind statt über 3300 Relokationen nur noch knapp 650 übrig. Und für echte Shared Libraries will man das früher oder später sowieso, weil damit dann alle Relokationen direkt nebeneinander liegen und man nicht überall COW machen muss. Signed-off-by: Kevin Wolf <kevin at tyndur.org> --- buildmk.sh | 1 - src/modules/lib/Makefile.conf | 1 + src/modules/lib/syscalls/lostio.c | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 src/modules/lib/Makefile.conf diff --git a/buildmk.sh b/buildmk.sh index ea0b22f..432e27e 100644 --- a/buildmk.sh +++ b/buildmk.sh @@ -81,7 +81,6 @@ if [ -f "user-$LOST_ARCH.ld" ]; then fi CC_FLAGS= -CC_FLAGS_APPEND= if [ -f Makefile.conf ]; then source Makefile.conf fi diff --git a/src/modules/lib/Makefile.conf b/src/modules/lib/Makefile.conf new file mode 100644 index 0000000..7141c4b --- /dev/null +++ b/src/modules/lib/Makefile.conf @@ -0,0 +1 @@ +export CC_FLAGS_APPEND="-fPIC" diff --git a/src/modules/lib/syscalls/lostio.c b/src/modules/lib/syscalls/lostio.c index 888b76d..a4f63cc 100644 --- a/src/modules/lib/syscalls/lostio.c +++ b/src/modules/lib/syscalls/lostio.c @@ -280,7 +280,7 @@ ssize_t lio_readf(lio_stream_t s, uint64_t offset, size_t bytes, "int $0x30;" "add $0x18, %%esp;" : : "i" (SYSCALL_LIO_READ), "r" (&s), "r" (&offset), "r" (bytes), - "r" (buf), "r" (flags), "r" (&result) : "memory"); + "r" (buf), "r" (flags), "g" (&result) : "memory"); return result; } @@ -333,7 +333,7 @@ static ssize_t write_syscall(lio_stream_t s, uint64_t offset, size_t bytes, "int $0x30;" "add $0x18, %%esp;" : : "i" (SYSCALL_LIO_WRITE), "r" (&s), "r" (&offset), "r" (bytes), - "r" (buf), "r" (updatepos), "r" (&result) : "memory"); + "r" (buf), "r" (updatepos), "g" (&result) : "memory"); return result; } @@ -570,7 +570,7 @@ lio_resource_t lio_mksymlink(lio_resource_t parent, "int $0x30;" "add $0x18, %%esp;" : : "i" (SYSCALL_LIO_MKSYMLINK), "r" (&parent), "r" (name), "r" (name_len), - "r" (target), "r" (target_len), "r" (&result) : "memory"); + "r" (target), "r" (target_len), "g" (&result) : "memory"); return result; } -- 2.1.4