commit 144970cd9ff14d5287bb15132caac91db50cf9fa parent f7bdb10cfc2b035793b190e4824d084187815015 Author: Roberto Vargas <roberto.vargas@arm.com> Date: Thu, 1 Nov 2018 11:10:38 +0000 [libc] Create new configurations for bsd systems We were having problems with small differences between the different bsd systems, so the best approach is to use totally different configurations for everyone of them. Diffstat:
38 files changed, 63 insertions(+), 67 deletions(-)
diff --git a/arch/amd64/crt-bsd.s b/arch/amd64/crt-bsd.s @@ -1,29 +0,0 @@ - .file "crt-bsd.s" - - .bss - .globl _environ -_environ: - .quad 0 - - .text - .global _start, -_start: - movq %rsp,%rbp - - /* load argc, argv, envp from stack */ - movq (%rbp),%rdi /* argc */ - leaq 8(%rbp),%rsi /* argv */ - leaq 16(%rbp,%rax,8),%rcx /* envp = argv + 8*argc + 8 */ - movq %rdx,_environ - - movq $stackend,%rsp /* setup fake stack */ - - call main - movl %eax,%edi - jmp exit - - .data - .align 4096 -stack: .space 3072 -stackend: -bss: .space 4096 - (stackend - stack) diff --git a/arch/amd64/crt-dragonfly.s b/arch/amd64/crt-dragonfly.s @@ -0,0 +1,2 @@ + .file "crt-dragonfly.s" + .include "crt-posix.s" diff --git a/arch/amd64/crt-linux.s b/arch/amd64/crt-linux.s @@ -1,29 +1,2 @@ .file "crt-linux.s" - - .bss - .globl _environ -_environ: - .quad 0 - - .text - .global _start, -_start: - movq %rsp,%rbp - - /* load argc, argv, envp from stack */ - movq (%rbp),%rdi /* argc */ - leaq 8(%rbp),%rsi /* argv */ - leaq 16(%rbp,%rax,8),%rcx /* envp = argv + 8*argc + 8 */ - movq %rdx,_environ - - movq $stackend,%rsp /* setup fake stack */ - - call main - movl %eax,%edi - jmp exit - - .data - .align 4096 -stack: .space 3072 -stackend: -bss: .space 4096 - (stackend - stack) + .include "crt-posix.s" diff --git a/arch/amd64/crt-netbsd.s b/arch/amd64/crt-netbsd.s @@ -0,0 +1,2 @@ + .file "crt-netbsd.s" + .include "crt-posix.s" diff --git a/arch/amd64/crt-openbsd.s b/arch/amd64/crt-openbsd.s @@ -0,0 +1,2 @@ + .file "crt-openbsd.s" + .include "crt-posix.s" diff --git a/arch/amd64/crt-posix.s b/arch/amd64/crt-posix.s @@ -0,0 +1,27 @@ + .bss + .globl _environ +_environ: + .quad 0 + + .text + .global _start, +_start: + movq %rsp,%rbp + + /* load argc, argv, envp from stack */ + movq (%rbp),%rdi /* argc */ + leaq 8(%rbp),%rsi /* argv */ + leaq 16(%rbp,%rax,8),%rcx /* envp = argv + 8*argc + 8 */ + movq %rdx,_environ + + movq $stackend,%rsp /* setup fake stack */ + + call main + movl %eax,%edi + jmp exit + + .data + .align 4096 +stack: .space 3072 +stackend: +bss: .space 4096 - (stackend - stack) diff --git a/config/amd64-bsd.mk b/config/amd64-bsd.mk @@ -1,8 +0,0 @@ -ARCH = amd64 -SYSCFLAGS = -g -static -nostdinc -ffreestanding -std=c99 -fno-stack-protector -MD -Wall -SYSLDFLAGS = -static -z nodefaultlib -COMP = gcc -ASM = as -LINKER = ld -SYS = bsd -CROSS_COMPILE = diff --git a/config/amd64-dragonfly.mk b/config/amd64-dragonfly.mk @@ -0,0 +1,8 @@ +ARCH = amd64 +SYSCFLAGS = -g -static -nostdinc -ffreestanding -std=c99 -fno-stack-protector -MD -Wall +SYSLDFLAGS = -static -z nodefaultlib +COMP = gcc +ASM = as +LINKER = ld +SYS = dragonfly +CROSS_COMPILE = diff --git a/config/amd64-netbsd.mk b/config/amd64-netbsd.mk @@ -0,0 +1,8 @@ +ARCH = amd64 +SYSCFLAGS = -g -static -nostdinc -ffreestanding -std=c99 -fno-stack-protector -MD -Wall +SYSLDFLAGS = -static -z nodefaultlib +COMP = gcc +ASM = as +LINKER = ld +SYS = netbsd +CROSS_COMPILE = diff --git a/config/amd64-openbsd.mk b/config/amd64-openbsd.mk @@ -0,0 +1,8 @@ +ARCH = amd64 +SYSCFLAGS = -g -static -nostdinc -ffreestanding -std=c99 -fno-stack-protector -MD -Wall +SYSLDFLAGS = -static -z nodefaultlib +COMP = gcc +ASM = as +LINKER = ld +SYS = openbsd +CROSS_COMPILE = diff --git a/include/bits/bsd/sys.h b/include/bits/dragonfly/sys.h diff --git a/include/bits/bsd/sys/errno.h b/include/bits/dragonfly/sys/errno.h diff --git a/include/bits/bsd/sys/signal.h b/include/bits/dragonfly/sys/signal.h diff --git a/include/bits/bsd/sys.h b/include/bits/netbsd/sys.h diff --git a/include/bits/bsd/sys/errno.h b/include/bits/netbsd/sys/errno.h diff --git a/include/bits/bsd/sys/signal.h b/include/bits/netbsd/sys/signal.h diff --git a/include/bits/bsd/sys.h b/include/bits/openbsd/sys.h diff --git a/include/bits/bsd/sys/errno.h b/include/bits/openbsd/sys/errno.h diff --git a/include/bits/bsd/sys/signal.h b/include/bits/openbsd/sys/signal.h diff --git a/src/libc/arch/amd64/Makefile b/src/libc/arch/amd64/Makefile @@ -2,7 +2,7 @@ PROJECTDIR =../../../.. include $(PROJECTDIR)/scripts/rules.mk OBJS = longjmp.o setjmp.o -DIRS = bsd linux +DIRS = netbsd openbsd dragonfly linux all: $(OBJS) $(SYS) diff --git a/src/libc/arch/amd64/bsd/.gitignore b/src/libc/arch/amd64/dragonfly/.gitignore diff --git a/src/libc/arch/amd64/bsd/Makefile b/src/libc/arch/amd64/dragonfly/Makefile diff --git a/src/libc/arch/amd64/bsd/_getheap.s b/src/libc/arch/amd64/dragonfly/_getheap.s diff --git a/src/libc/arch/amd64/bsd/gensys.sh b/src/libc/arch/amd64/dragonfly/gensys.sh diff --git a/src/libc/arch/amd64/bsd/syscall.lst b/src/libc/arch/amd64/dragonfly/syscall.lst diff --git a/src/libc/arch/amd64/linux/.gitignore b/src/libc/arch/amd64/linux/.gitignore @@ -7,3 +7,4 @@ _open.s _read.s _write.s _brk.s +_sigaction.s diff --git a/src/libc/arch/amd64/linux/Makefile b/src/libc/arch/amd64/linux/Makefile @@ -7,6 +7,7 @@ SRC = _Exit.s \ _kill.s \ _lseek.s \ _open.s \ + _sigaction.s \ _read.s \ _write.s \ _brk.s \ diff --git a/src/libc/arch/amd64/linux/syscall.lst b/src/libc/arch/amd64/linux/syscall.lst @@ -3,8 +3,9 @@ 1 _write 2 _open 3 _close -3 _lseek +8 _lseek 12 _brk +13 _sigaction 39 _getpid 60 _Exit 62 _kill diff --git a/src/libc/arch/amd64/bsd/.gitignore b/src/libc/arch/amd64/netbsd/.gitignore diff --git a/src/libc/arch/amd64/bsd/Makefile b/src/libc/arch/amd64/netbsd/Makefile diff --git a/src/libc/arch/amd64/bsd/_getheap.s b/src/libc/arch/amd64/netbsd/_getheap.s diff --git a/src/libc/arch/amd64/bsd/gensys.sh b/src/libc/arch/amd64/netbsd/gensys.sh diff --git a/src/libc/arch/amd64/bsd/syscall.lst b/src/libc/arch/amd64/netbsd/syscall.lst diff --git a/src/libc/arch/amd64/bsd/.gitignore b/src/libc/arch/amd64/openbsd/.gitignore diff --git a/src/libc/arch/amd64/bsd/Makefile b/src/libc/arch/amd64/openbsd/Makefile diff --git a/src/libc/arch/amd64/bsd/_getheap.s b/src/libc/arch/amd64/openbsd/_getheap.s diff --git a/src/libc/arch/amd64/bsd/gensys.sh b/src/libc/arch/amd64/openbsd/gensys.sh diff --git a/src/libc/arch/amd64/bsd/syscall.lst b/src/libc/arch/amd64/openbsd/syscall.lst