scc-patches

scc patches
Log | Files | Refs | README

commit aec30bdddcb8bc5b2e80165037ff964e9e6b2204
parent f74cdc9726690776c156db8680cfef0f1dd4d2cc
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Sun,  3 Nov 2019 15:16:57 +0100

Update existing set

Diffstat:
M0001-include-Add-setjmp.h-for-i386.patch | 4++--
M0002-lib-c-Update-Linux-write-syscall-for-i386.patch | 4++--
A0003-lib-c-Update-setjmp.s-and-longjmp.s-for-i386-linux.patch | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A0004-lib-c-Add-umoddi3.s-and-udivdi3.s-for-i386-linux.patch | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A0005-lib-c-Add-_cerrno.s-_getheap.c-and-raise.c-for-i386-.patch | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A0006-lib-c-Update-gensys.sh-for-i386-linux.patch | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A0007-Remove-_write.s-as-it-is-generated-by-gensys.sh.patch | 32++++++++++++++++++++++++++++++++
A0008-Set-up-toolchain-and-scripts-for-i386.patch | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A0009-lib-c-Update-crt-posix.s-for-i386-linux.patch | 42++++++++++++++++++++++++++++++++++++++++++
A0010-tests-Temp-fix.patch | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 files changed, 563 insertions(+), 4 deletions(-)

diff --git a/0001-include-Add-setjmp.h-for-i386.patch b/0001-include-Add-setjmp.h-for-i386.patch @@ -1,7 +1,7 @@ -From e2ffaf8138b59ac4943d38383af79e88b1a752be Mon Sep 17 00:00:00 2001 +From bf637289850918533fcc74e75a10b45bc494882e Mon Sep 17 00:00:00 2001 From: zerous Naveen Narayanan <zerous@nocebo.space> Date: Thu, 31 Oct 2019 09:05:03 +0100 -Subject: [PATCH 01/11] [include] Add setjmp.h for i386 +Subject: [PATCH 01/10] [include] Add setjmp.h for i386 --- include/bits/i386/arch/setjmp.h | 1 + diff --git a/0002-lib-c-Update-Linux-write-syscall-for-i386.patch b/0002-lib-c-Update-Linux-write-syscall-for-i386.patch @@ -1,7 +1,7 @@ -From be8d9439485a8d774bd9b5cafc7a81ff482e163e Mon Sep 17 00:00:00 2001 +From d6f8975e63efd811c6da1aa22015120bb0eed132 Mon Sep 17 00:00:00 2001 From: zerous Naveen Narayanan <zerous@nocebo.space> Date: Thu, 31 Oct 2019 13:59:21 +0100 -Subject: [PATCH 02/11] [lib/c] Update Linux write syscall for i386 +Subject: [PATCH 02/10] [lib/c] Update Linux write syscall for i386 Pass args using appropriate registers for _write syscall Remove _write from syscall.lst as it doesn't conform to the generic template diff --git a/0003-lib-c-Update-setjmp.s-and-longjmp.s-for-i386-linux.patch b/0003-lib-c-Update-setjmp.s-and-longjmp.s-for-i386-linux.patch @@ -0,0 +1,82 @@ +From 84656ce00b82d4256d7d6f354eca64977023073e Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 15:21:34 +0100 +Subject: [PATCH 03/10] [lib/c] Update setjmp.s and longjmp.s for i386/linux + +This version respects %ecx unlike the last one. +--- + src/libc/arch/i386/longjmp.s | 20 +++++++++++--------- + src/libc/arch/i386/setjmp.s | 23 ++++++++++++----------- + 2 files changed, 23 insertions(+), 20 deletions(-) + +diff --git a/src/libc/arch/i386/longjmp.s b/src/libc/arch/i386/longjmp.s +index 7dd062c5..77c7f412 100644 +--- a/src/libc/arch/i386/longjmp.s ++++ b/src/libc/arch/i386/longjmp.s +@@ -1,19 +1,21 @@ + .file "longjmp.s" + + .text +- .globl _longjmp ++ .globl longjmp,_longjmp + _longjmp: ++longjmp: + mov 4(%esp),%edx + mov 8(%esp),%eax + test %eax,%eax + jnz 1f + inc %eax + 1: +- mov (%edx),%ebx +- mov 4(%edx),%esi +- mov 8(%edx),%edi +- mov 12(%edx),%ebp +- mov 16(%edx),%ecx +- mov %ecx,%esp +- mov 20(%edx),%ecx +- jmp *%ecx ++ movl (%edx),%ebx ++ movl 4(%edx),%ecx ++ movl 8(%edx),%esi ++ movl 12(%edx),%edi ++ movl 16(%edx),%ebp ++ movl 20(%edx),%esp ++ pushl 24(%edx) ++ popl %edx ++ jmp *%edx +diff --git a/src/libc/arch/i386/setjmp.s b/src/libc/arch/i386/setjmp.s +index 008f2fa9..39397d1d 100644 +--- a/src/libc/arch/i386/setjmp.s ++++ b/src/libc/arch/i386/setjmp.s +@@ -1,16 +1,17 @@ + .file "setjmp.s" + + .text +- .globl _setjmp ++ .globl setjmp,_setjmp + _setjmp: +- mov 4(%esp),%eax +- mov %ebx,(%eax) +- mov %esi,4(%eax) +- mov %edi,8(%eax) +- mov %ebp,12(%eax) +- lea 4(%esp),%ecx +- mov %ecx,16(%eax) +- mov (%esp),%ecx +- mov %ecx,20(%eax) +- xor %eax,%eax ++setjmp: ++ movl 4(%esp),%eax ++ movl %ebx,(%eax) ++ movl %ecx,4(%eax) ++ movl %esi,8(%eax) ++ movl %edi,12(%eax) ++ movl %ebp,16(%eax) ++ movl %esp,20(%eax) ++ pushl (%esp) ++ popl 24(%eax) ++ xor %eax,%eax + ret +-- +2.23.0 + diff --git a/0004-lib-c-Add-umoddi3.s-and-udivdi3.s-for-i386-linux.patch b/0004-lib-c-Add-umoddi3.s-and-udivdi3.s-for-i386-linux.patch @@ -0,0 +1,82 @@ +From 851950841c51b9378980e17f9f179ecfb82279ea Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 15:23:20 +0100 +Subject: [PATCH 04/10] [lib/c] Add umoddi3.s and udivdi3.s for i386/linux + +--- + src/libc/arch/i386/linux/Makefile | 2 ++ + src/libc/arch/i386/linux/udivdi3.s | 20 ++++++++++++++++++++ + src/libc/arch/i386/linux/umoddi3.s | 21 +++++++++++++++++++++ + 3 files changed, 43 insertions(+) + create mode 100644 src/libc/arch/i386/linux/udivdi3.s + create mode 100644 src/libc/arch/i386/linux/umoddi3.s + +diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile +index 03ab52ec..d264ea56 100644 +--- a/src/libc/arch/i386/linux/Makefile ++++ b/src/libc/arch/i386/linux/Makefile +@@ -16,6 +16,8 @@ OBJS =\ + _Exit.o\ + _kill.o\ + crt.o\ ++ umoddi3.o\ ++ udivdi3.o\ + + all: syscall + $(MAKE) objs +diff --git a/src/libc/arch/i386/linux/udivdi3.s b/src/libc/arch/i386/linux/udivdi3.s +new file mode 100644 +index 00000000..0fa2ace0 +--- /dev/null ++++ b/src/libc/arch/i386/linux/udivdi3.s +@@ -0,0 +1,20 @@ ++ .file "udivdi3.s" ++ ++ .text ++ .globl __udivdi3 ++ .type __udivdi3,@function ++__udivdi3: ++ pushl %ebp ++ movl %esp,%ebp ++ addl $-16,%esp ++ ++ movl 8(%ebp),%ecx ++ movl %ecx,-16(%ebp) ++ movl 16(%ebp),%ecx ++ movl %ecx,-8(%ebp) ++ movl -16(%ebp),%eax ++ xor %edx,%edx ++ divl -8(%ebp) ++ movl %ebp,%esp ++ popl %ebp ++ ret +diff --git a/src/libc/arch/i386/linux/umoddi3.s b/src/libc/arch/i386/linux/umoddi3.s +new file mode 100644 +index 00000000..3cfc5615 +--- /dev/null ++++ b/src/libc/arch/i386/linux/umoddi3.s +@@ -0,0 +1,21 @@ ++ .file "umoddi3.s" ++ ++ .text ++ .globl __umoddi3 ++ .type __umoddi3,@function ++__umoddi3: ++ pushl %ebp ++ movl %esp,%ebp ++ addl $-16,%esp ++ ++ movl 8(%ebp),%ecx ++ movl %ecx,-16(%ebp) ++ movl 16(%ebp),%ecx ++ movl %ecx,-8(%ebp) ++ movl -16(%ebp),%eax ++ xor %edx,%edx ++ divl -8(%ebp) ++ movl %edx,%eax ++ movl %ebp,%esp ++ popl %ebp ++ ret +-- +2.23.0 + diff --git a/0005-lib-c-Add-_cerrno.s-_getheap.c-and-raise.c-for-i386-.patch b/0005-lib-c-Add-_cerrno.s-_getheap.c-and-raise.c-for-i386-.patch @@ -0,0 +1,80 @@ +From 85cd1a9da3643401773ca3eaead99654b6ccd742 Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 15:24:43 +0100 +Subject: [PATCH 05/10] [lib/c] Add _cerrno.s, _getheap.c and raise.c for + i386/linux + +Update Makefile +--- + src/libc/arch/i386/linux/Makefile | 7 +++++++ + src/libc/arch/i386/linux/_cerrno.s | 12 ++++++++++++ + src/libc/arch/i386/linux/_getheap.c | 1 + + src/libc/arch/i386/linux/raise.c | 1 + + 4 files changed, 21 insertions(+) + create mode 100644 src/libc/arch/i386/linux/_cerrno.s + create mode 100644 src/libc/arch/i386/linux/_getheap.c + create mode 100644 src/libc/arch/i386/linux/raise.c + +diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile +index d264ea56..73415c86 100644 +--- a/src/libc/arch/i386/linux/Makefile ++++ b/src/libc/arch/i386/linux/Makefile +@@ -15,9 +15,12 @@ OBJS =\ + _getpid.o\ + _Exit.o\ + _kill.o\ ++ _getheap.o\ + crt.o\ + umoddi3.o\ + udivdi3.o\ ++ raise.o\ ++ _cerrno.o\ + + all: syscall + $(MAKE) objs +@@ -26,6 +29,10 @@ objs: $(OBJS) + + crt.o: ../crt-posix.s + ++_getheap.o: ../../posix/_getheap.c ++ ++raise.o: ../../posix/raise.c ++ + syscall: syscall.lst + gensys.sh syscall.lst + touch syscall +diff --git a/src/libc/arch/i386/linux/_cerrno.s b/src/libc/arch/i386/linux/_cerrno.s +new file mode 100644 +index 00000000..a14ec579 +--- /dev/null ++++ b/src/libc/arch/i386/linux/_cerrno.s +@@ -0,0 +1,12 @@ ++ .file "_cerrno.s" ++ .globl _cerrno ++ ++_cerrno: ++ cmpl $0,%eax ++ js 1f ++ ret ++ ++1: neg %eax ++ mov %eax,(errno) ++ mov $-1,%eax ++ ret +diff --git a/src/libc/arch/i386/linux/_getheap.c b/src/libc/arch/i386/linux/_getheap.c +new file mode 100644 +index 00000000..dc1a07bd +--- /dev/null ++++ b/src/libc/arch/i386/linux/_getheap.c +@@ -0,0 +1 @@ ++#include "../../posix/_getheap.c" +diff --git a/src/libc/arch/i386/linux/raise.c b/src/libc/arch/i386/linux/raise.c +new file mode 100644 +index 00000000..138f6d88 +--- /dev/null ++++ b/src/libc/arch/i386/linux/raise.c +@@ -0,0 +1 @@ ++#include "../../posix/raise.c" +-- +2.23.0 + diff --git a/0006-lib-c-Update-gensys.sh-for-i386-linux.patch b/0006-lib-c-Update-gensys.sh-for-i386-linux.patch @@ -0,0 +1,83 @@ +From b63172114813e193f5e8c037ae1a5b3c0fa564b5 Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 17:50:14 +0100 +Subject: [PATCH 06/10] [lib/c] Update gensys.sh for i386/linux + +awk script generates code that sets the respective registers with +parameters for i386 syscalls. +--- + src/libc/arch/i386/linux/gensys.sh | 35 ++++++++++++++-------------- + src/libc/arch/i386/linux/syscall.lst | 21 +++++++++-------- + 2 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/src/libc/arch/i386/linux/gensys.sh b/src/libc/arch/i386/linux/gensys.sh +index 35ab4752..d2ca7b48 100755 +--- a/src/libc/arch/i386/linux/gensys.sh ++++ b/src/libc/arch/i386/linux/gensys.sh +@@ -1,20 +1,19 @@ + #!/bin/sh +-# +-# This job is very easy because app and kernel ABI are identical +-# until the 4th parameter, so we only have to set the syscall +-# number in eax + +-sed 's/[ ]*#.*// +- /^$/d' syscall.lst | +-while read num name +-do +-cat <<EOF > $name.s +- .file "$name.s" +- +- .globl $name +-$name: +- movl \$$num,%eax +- syscall +- jmp _cerrno +-EOF +-done ++awk ' { syscall=$2 ++ fname=$2".s" ++ noper=$3 ++ if (NR > 1) { ++ printf "\t.file\t\"fname\"\n\t.globl\t%s\n%s:\n", syscall, syscall > fname ++ printf "\tpushl\t%%ebp\n\tmovl\t%%esp,%%ebp\n" >> fname ++ if (noper > 0) ++ printf "\tmovl\t8(%%ebp),%%ebx\n" >> fname ++ if (noper > 1) ++ printf "\tmovl\t12(%%ebp),%%ecx\n" >> fname ++ if (noper > 2) ++ printf "\tmovl\t16(%%ebp),%%edx\n" >> fname ++ printf "\tmovl\t%d,%%eax\n\tint\t$0x80\n", noper >> fname ++ printf "\tpopl\t%%ebp\n" >> fname ++ printf "\tjmp\t_cerrno\n" >> fname ++ } ++ } ' syscall.lst +diff --git a/src/libc/arch/i386/linux/syscall.lst b/src/libc/arch/i386/linux/syscall.lst +index 743bf682..b3152e1e 100644 +--- a/src/libc/arch/i386/linux/syscall.lst ++++ b/src/libc/arch/i386/linux/syscall.lst +@@ -1,10 +1,11 @@ +-#number name +-3 _read +-5 _open +-6 _close +-19 _lseek +-45 _brk +-67 _sigaction +-20 _getpid +-1 _Exit +-37 _kill ++#number name num_of_op ++4 _write 3 ++3 _read 3 ++5 _open 2 ++6 _close 1 ++19 _lseek 3 ++45 _brk 1 ++67 _sigaction 3 ++20 _getpid 0 ++1 _Exit 1 ++37 _kill 2 +-- +2.23.0 + diff --git a/0007-Remove-_write.s-as-it-is-generated-by-gensys.sh.patch b/0007-Remove-_write.s-as-it-is-generated-by-gensys.sh.patch @@ -0,0 +1,32 @@ +From 485aec66e8c50dce037cc0daf5d582ddccad1312 Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Sun, 3 Nov 2019 14:37:44 +0100 +Subject: [PATCH 07/10] Remove _write.s as it is generated by gensys.sh + +--- + src/libc/arch/i386/linux/_write.s | 13 ------------- + 1 file changed, 13 deletions(-) + delete mode 100644 src/libc/arch/i386/linux/_write.s + +diff --git a/src/libc/arch/i386/linux/_write.s b/src/libc/arch/i386/linux/_write.s +deleted file mode 100644 +index 2c30050f..00000000 +--- a/src/libc/arch/i386/linux/_write.s ++++ /dev/null +@@ -1,13 +0,0 @@ +- .file "_write.s" +- +- .globl _write +-_write: +- pushl %ebp +- movl %esp,%ebp +- movl 8(%ebp),%ebx +- movl 12(%ebp),%ecx +- movl 16(%ebp),%edx +- movl $4,%eax +- int $0x80 +- popl %ebp +- jmp _cerrno +-- +2.23.0 + diff --git a/0008-Set-up-toolchain-and-scripts-for-i386.patch b/0008-Set-up-toolchain-and-scripts-for-i386.patch @@ -0,0 +1,63 @@ +From 3d1618594905c5b996a24607b9799a84a7a6a6b3 Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 20:43:25 +0100 +Subject: [PATCH 08/10] Set up toolchain and scripts for i386 + +--- + config/toolchain/gnu.mk | 9 ++++----- + scripts/rules.mk | 7 ++++--- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/config/toolchain/gnu.mk b/config/toolchain/gnu.mk +index 8f193c6e..6d157df0 100644 +--- a/config/toolchain/gnu.mk ++++ b/config/toolchain/gnu.mk +@@ -1,5 +1,3 @@ +-TOOLCFLAGS = -std=c99 +- + COMP = gcc + ASM = as + LINKER = ld +@@ -7,6 +5,7 @@ RANLIB = ranlib + ARCHIVE = ar + + ARCHIVEFLAGS = -U +-NOPIE_CFLAGS = -nopie +-NOPIE_LDFLAGS = -nopie +-TOOLCFLAGS = -std=c99 ++NOPIE_CFLAGS = -no-pie ++NOPIE_LDFLAGS = -no-pie ++TOOLCFLAGS = -std=c99 -fno-stack-protector -no-pie ++ +diff --git a/scripts/rules.mk b/scripts/rules.mk +index 29c71446..99cef334 100644 +--- a/scripts/rules.mk ++++ b/scripts/rules.mk +@@ -1,5 +1,5 @@ +-CONF=amd64-linux +-TOOL=unix ++CONF=i386-linux ++TOOL=gnu + HOST=unix + include $(PROJECTDIR)/config/config/$(CONF).mk + include $(PROJECTDIR)/config/toolchain/$(TOOL).mk +@@ -31,6 +31,7 @@ SCC_CFLAGS =\ + $(SYSCFLAGS)\ + $(INCLUDE)\ + -g\ ++ -O0\ + $(CFLAGS) + + SCC_LDFLAGS =\ +@@ -64,7 +65,7 @@ FORALL = +@set -e ;\ + $(CC) $(SCC_LDFLAGS) -o $@ $< $(LIBS) + + .s.o: +- $(AS) $(SCC_ASFLAGS) $< -o $@ ++ $(AS) $(SCC_ASFLAGS) -g $< -o $@ + + .c.o: + $(CC) $(SCC_CFLAGS) -o $@ -c $< +-- +2.23.0 + diff --git a/0009-lib-c-Update-crt-posix.s-for-i386-linux.patch b/0009-lib-c-Update-crt-posix.s-for-i386-linux.patch @@ -0,0 +1,42 @@ +From 74c77c18854c2008b93e39cef1d6198a1f56a35e Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 20:46:51 +0100 +Subject: [PATCH 09/10] [lib/c] Update crt-posix.s for i386/linux + +According to i386 ABI, function parameters should be passed over the +stack. +--- + src/libc/arch/i386/crt-posix.s | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/src/libc/arch/i386/crt-posix.s b/src/libc/arch/i386/crt-posix.s +index 88013697..ca0c7f1e 100644 +--- a/src/libc/arch/i386/crt-posix.s ++++ b/src/libc/arch/i386/crt-posix.s +@@ -2,16 +2,19 @@ + .globl _environ + _environ: + .long 0 +- ++ + .text +- .global start ++ .globl _start + _start: + movl %esp,%ebp + +- movl (%ebp),%edi +- leal 8(%ebp),%esi + leal 16(%ebp,%edi,8),%edx + movl %edx,_environ ++ pushl %edx ++ leal 8(%ebp),%esi ++ pushl %esi ++ movl (%ebp),%edi ++ pushl %edi + + call main + movl %eax,%edi +-- +2.23.0 + diff --git a/0010-tests-Temp-fix.patch b/0010-tests-Temp-fix.patch @@ -0,0 +1,95 @@ +From 5513bba7cddf3de7fc31259bdd965d108d6eb54f Mon Sep 17 00:00:00 2001 +From: zerous Naveen Narayanan <zerous@nocebo.space> +Date: Fri, 1 Nov 2019 20:50:33 +0100 +Subject: [PATCH 10/10] [tests] Temp fix + +--- + tests/libc/execute/Makefile | 4 ++-- + tests/libc/execute/cc.sh | 18 ++++++++++-------- + tests/libc/execute/chktest.sh | 4 ++-- + 3 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/tests/libc/execute/Makefile b/tests/libc/execute/Makefile +index 00595eaa..8f81322c 100644 +--- a/tests/libc/execute/Makefile ++++ b/tests/libc/execute/Makefile +@@ -1,6 +1,6 @@ + .POSIX: + +-ROOT = ../../../root ++ROOT = ../../.. + CFLAGS = + CC = SCCPREFIX=$(ROOT) ./cc.sh + +@@ -10,7 +10,7 @@ CC = SCCPREFIX=$(ROOT) ./cc.sh + all: tests + + tests: +- @CFLAGS='' SCCPREFIX=$(ROOT) chktest.sh libc-tests.lst ++ @CFLAGS='' SCCPREFIX=$(ROOT) ./chktest.sh libc-tests.lst + + clean: + rm -f *.o *core a.out test.log +diff --git a/tests/libc/execute/cc.sh b/tests/libc/execute/cc.sh +index 1b2460c3..cfa1a264 100755 +--- a/tests/libc/execute/cc.sh ++++ b/tests/libc/execute/cc.sh +@@ -1,6 +1,7 @@ + #!/bin/sh + + set -e ++set -x + + for i + do +@@ -29,22 +30,23 @@ do + done + + sys=${sys:-`uname | tr 'A-Z' 'a-z'`} +-abi=${abi:-amd64-sysv} ++abi=${abi:-i386} + out=${out:-a.out} + root=${root:-$SCCPREFIX} +-inc=$root/include/scc +-arch_inc=$root/include/scc/bits/$abi +-sys_inc=$root/include/scc/bits/$sys ++inc=$root/include ++arch_inc=$inc/bits/$abi ++sys_inc=$inc/bits/$sys + lib=$root/lib/scc/${abi}-${sys} + obj=${1%.c}.o + + includes="-nostdinc -I$inc -I$arch_inc -I$sys_inc" + flags="-std=c99 -g -w -fno-stack-protector --freestanding -static" + +-if ! gcc -nopie 2>&1 | grep unrecogn >/dev/null ++# TODO: find a better way to handle CROSS_COMPILE ++if ! i686-pc-linux-gnu-gcc -nopie 2>&1 | grep unrecogn >/dev/null + then +- pie=-nopie ++ pie=-no-pie + fi + +-gcc $flags $pie $includes -c $1 +-ld -g $pie -z nodefaultlib -static -L$lib $lib/crt.o $obj -lc -o $out ++i686-pc-linux-gnu-gcc $flags $pie $includes -c $1 ++i686-pc-linux-gnu-ld -g -z nodefaultlib -static -L$lib $lib/crt.o $obj -lc -o $out +diff --git a/tests/libc/execute/chktest.sh b/tests/libc/execute/chktest.sh +index ffafe66d..cbbf8d10 100755 +--- a/tests/libc/execute/chktest.sh ++++ b/tests/libc/execute/chktest.sh +@@ -13,9 +13,9 @@ do + rm -f a.out *.o $tmp1 $tmp2 + + (echo $i +- ./cc.sh $CFLAGS $i.c ++ ./cc.sh $CFLAGS -o $i $i.c + echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c +- ./a.out > $tmp2 ++ ./$i > $tmp2 + diff -u $tmp1 $tmp2) >> test.log 2>&1 && + printf '[PASS]' || printf '[FAIL]' + printf "$state\t%s\n" $i +-- +2.23.0 +