diff options
Diffstat (limited to 'libexec/ld.so/powerpc')
-rw-r--r-- | libexec/ld.so/powerpc/SYS.h | 29 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/ld.script | 6 |
2 files changed, 24 insertions, 11 deletions
diff --git a/libexec/ld.so/powerpc/SYS.h b/libexec/ld.so/powerpc/SYS.h index 7e1a7962e63..9da670134f3 100644 --- a/libexec/ld.so/powerpc/SYS.h +++ b/libexec/ld.so/powerpc/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.4 2020/11/28 19:49:30 gkoehler Exp $ */ +/* $OpenBSD: SYS.h,v 1.5 2023/12/10 16:45:50 deraadt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -29,14 +29,21 @@ #include <sys/syscall.h> #include <machine/asm.h> -#define DL_SYSCALL(n) \ -ENTRY(_dl_##n) \ - RETGUARD_SETUP(_dl_##n, %r11, %r12) ;\ - li 0, SYS_##n ;\ - sc ;\ - cmpwi 0, 0 ;\ - beq+ .L_end##n ;\ - neg 3, 3 ;\ -.L_end##n: ;\ - RETGUARD_CHECK(_dl_##n, %r11, %r12) ;\ +#define PINSYSCALL(sysno, label) \ + .pushsection .openbsd.syscalls,"",@progbits ;\ + .long label ;\ + .long sysno ;\ + .popsection + +#define DL_SYSCALL(n) \ +ENTRY(_dl_##n) \ + RETGUARD_SETUP(_dl_##n, %r11, %r12) ;\ + li 0, SYS_##n ;\ +99: sc ;\ + PINSYSCALL(SYS_##n, 99b) ;\ + cmpwi 0, 0 ;\ + beq+ .L_end##n ;\ + neg 3, 3 ;\ +.L_end##n: ;\ + RETGUARD_CHECK(_dl_##n, %r11, %r12) ;\ blr diff --git a/libexec/ld.so/powerpc/ld.script b/libexec/ld.so/powerpc/ld.script index c445283a0c5..afd66c5afd1 100644 --- a/libexec/ld.so/powerpc/ld.script +++ b/libexec/ld.so/powerpc/ld.script @@ -5,6 +5,7 @@ PHDRS btext PT_LOAD FLAGS (0x08000005); data PT_LOAD; random PT_OPENBSD_RANDOMIZE; + syscalls PT_OPENBSD_SYSCALLS; relro PT_GNU_RELRO; dynamic PT_DYNAMIC; note PT_NOTE; @@ -39,6 +40,11 @@ SECTIONS { *(.openbsd.randomdata .openbsd.randomdata.*) } :data :relro :random + .openbsd.syscalls : + { + *(.openbsd.syscalls .openbsd.syscalls.*) + } :syscalls + .data.rel.ro : { *(.data.rel.ro.local*) *(.data.rel.ro*) } :data :relro .dynamic : { *(.dynamic) } :data :relro :dynamic .got : { *(.got.plt) *(.got) } :data :relro |