Skip to content

Commit

Permalink
glibc: Patch to work around missing features in LLVM's s390x assembler.
Browse files Browse the repository at this point in the history
Revert this with LLVM 20.
  • Loading branch information
alexrp committed Sep 5, 2024
1 parent f87dd43 commit 71d4ba9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/libc/glibc/sysdeps/s390/s390-32/start-2.33.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
_start:
cfi_startproc
/* Mark r14 as undefined in order to stop unwinding here! */
cfi_undefined (r14)
/* zig patch: r14 -> %r15. revert with llvm 20. */
cfi_undefined (%r14)

/* Check if the kernel provides highgprs facility if needed by
the binary. */
Expand Down
3 changes: 2 additions & 1 deletion lib/libc/glibc/sysdeps/s390/s390-32/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
_start:
cfi_startproc
/* Mark r14 as undefined in order to stop unwinding here! */
cfi_undefined (r14)
/* zig patch: r14 -> %r14. revert with llvm 20. */
cfi_undefined (%r14)

/* Check if the kernel provides highgprs facility if needed by
the binary. */
Expand Down
3 changes: 2 additions & 1 deletion lib/libc/glibc/sysdeps/s390/s390-64/crti.S
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ _init:
stg %r1,0(%r15)
larl %r12,_GLOBAL_OFFSET_TABLE_
#if PREINIT_FUNCTION_WEAK
larl %r1,PREINIT_FUNCTION@GOTENT
/* zig patch: GOTENT -> GOT. revert with llvm 20. */
larl %r1,PREINIT_FUNCTION@GOT
lg %r1,0(%r1)
ltgr %r1,%r1
je 1f
Expand Down
6 changes: 4 additions & 2 deletions lib/libc/glibc/sysdeps/s390/s390-64/start-2.33.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
_start:
cfi_startproc
/* Mark r14 as undefined in order to stop unwinding here! */
cfi_undefined (r14)
/* zig patch: r14 -> %r14. revert with llvm 20. */
cfi_undefined (%r14)
/* Load argc and argv from stack. */
la %r4,8(%r15) # get argv
lg %r3,0(%r15) # get argc
Expand All @@ -85,7 +86,8 @@ _start:

/* Ok, now branch to the libc main routine. */
#ifdef PIC
larl %r2,main@GOTENT # load pointer to main
/* zig patch: GOTENT -> GOT. revert with llvm 20. */
larl %r2,main@GOT # load pointer to main
lg %r2,0(%r2)
brasl %r14,__libc_start_main@plt
#else
Expand Down
9 changes: 6 additions & 3 deletions lib/libc/glibc/sysdeps/s390/s390-64/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
_start:
cfi_startproc
/* Mark r14 as undefined in order to stop unwinding here! */
cfi_undefined (r14)
/* zig patch: r14 -> %r14. revert with llvm 20. */
cfi_undefined (%r14)
/* Load argc and argv from stack. */
la %r4,8(%r15) # get argv
lg %r3,0(%r15) # get argc
Expand All @@ -87,7 +88,8 @@ _start:
# ifdef SHARED
/* Used for dynamic linked position independent executable.
=> Scrt1.o */
larl %r2,main@GOTENT # load pointer to main
/* zig patch: GOTENT -> GOT. revert with llvm 20. */
larl %r2,main@GOT # load pointer to main
lg %r2,0(%r2)
# else
/* Used for dynamic linked position dependent executable.
Expand Down Expand Up @@ -119,7 +121,8 @@ _start:
use of GOT relocations before __libc_start_main is called. */
__wrap_main:
cfi_startproc
larl %r1,main@GOTENT # load pointer to main
/* zig patch: GOTENT -> GOT. revert with llvm 20. */
larl %r1,main@GOT # load pointer to main
lg %r1,0(%r1)
br %r1
cfi_endproc
Expand Down

0 comments on commit 71d4ba9

Please sign in to comment.