On Mon, Oct 25 2021, Mark Kettenis <[email protected]> wrote: >> From: Jeremie Courreges-Anglas <[email protected]> >> Date: Mon, 25 Oct 2021 14:55:16 +0100 >> >> On Mon, Oct 25 2021, Mark Kettenis <[email protected]> wrote: >> >> Date: Mon, 25 Oct 2021 12:37:41 +0200 (CEST) >> >> From: Mark Kettenis <[email protected]> >> >> >> >> > Date: Mon, 25 Oct 2021 12:01:11 +0200 >> >> > From: Patrick Wildt <[email protected]> >> >> > >> >> > Hi, >> >> > >> >> > mortimer@ has this diff in his tree for LLVM 13. I actually haven't >> >> > tried to see if it works fine with LLVM 11, but I feel it needs to be >> >> > sent out and not just be blindly committed. >> >> > >> >> > If someone wants to take care of this, it would be nice, so I can take >> >> > care of the remaining parts of sending out the LLVM 13 diff. >> >> >> >> > diff --git a/lib/libc/arch/amd64/sys/brk.S >> >> > b/lib/libc/arch/amd64/sys/brk.S >> >> > index ce69679e389..ee1c11f7643 100644 >> >> > --- a/lib/libc/arch/amd64/sys/brk.S >> >> > +++ b/lib/libc/arch/amd64/sys/brk.S >> >> > @@ -48,7 +48,6 @@ __minbrk: >> >> > END(__minbrk) >> >> > .type __minbrk,@object >> >> > >> >> > - .weak brk >> >> > ENTRY(brk) >> >> > cmpq %rdi,__minbrk(%rip) >> >> > jb 1f >> >> > diff --git a/lib/libc/arch/amd64/sys/sbrk.S >> >> > b/lib/libc/arch/amd64/sys/sbrk.S >> >> > index 8d7d68909b2..db53a6bb643 100644 >> >> > --- a/lib/libc/arch/amd64/sys/sbrk.S >> >> > +++ b/lib/libc/arch/amd64/sys/sbrk.S >> >> > @@ -53,7 +53,6 @@ __curbrk: >> >> > END(__curbrk) >> >> > .type __curbrk,@object >> >> > >> >> > - .weak sbrk >> >> > ENTRY(sbrk) >> >> > movq __curbrk(%rip),%rax >> >> > movslq %edi,%rsi >> >> >> >> These functions are supposed to be weak, like they are on >> >> architectures that use a C implementation. I suppose the .weak >> >> directive needs to come *after* the .global emitted by ENTRY(). >> >> Putting it after the END() works. >> > >> > So I think the diff below is what we want here. >> >> There are others left: >> >> russell /usr/src/lib/libc$ grep -B 1 -R ^ENTRY | grep -A 1 weak >> arch/i386/sys/brk.S- .weak brk >> arch/i386/sys/brk.S:ENTRY(brk) >> arch/i386/sys/sbrk.S- .weak sbrk >> arch/i386/sys/sbrk.S:ENTRY(sbrk) >> arch/riscv64/sys/sbrk.S- .weak sbrk >> arch/riscv64/sys/sbrk.S:ENTRY(sbrk) >> arch/riscv64/sys/brk.S- .weak brk >> arch/riscv64/sys/brk.S:ENTRY(brk) >> >> (and a few others where grep -B 1 isn't enough) >> >> > ok? >> >> I checked that the resulting .*o files are the same on amd64, sparc64 >> and riscv64.
Actually I have messed up my tests on amd64 and riscv64, where these changes *do* fix a problem and re-add the weak attribute to the affected symbol in the object files. >> ok jca@ >> >> Here's the diff for the other architectures. I didn't touch m88k, which >> won't use clang anytime soon. Also ok? > > ok kettenis@ Committed, thanks. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
