Re: amdgcn build failure

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <YjaBRPk5f0DG3rFW@vapier>
On 18 Mar 2022 11:43, Andrew Stubbs wrote:
> Following your commit 96bc16f, merged yesterday, my amdgcn toolchain 
> fails to build. The Newlib built itself completes successfully, but 
> subsequent use of the library is broken.
> 
> The problem seems to be related to the __malloc_lock function, but I 
> can't quite work out why. Here's the error message:
> 
> ld: error: duplicate symbol: __malloc_lock
>  >>> defined at mlock.c:42 (..../newlib/libc/stdlib/mlock.c:42)
>  >>>            libc_a-mlock.o:(__malloc_lock) in archive 
> ..../amdgcn-amdhsa/lib/libc.a
>  >>> defined at malloc_support.c:69 
> (..../newlib/libc/machine/amdgcn/malloc_support.c:69)
>  >>>            libc_a-malloc_support.o:(.text+0x1F8) in archive 
> ..../install/amdgcn-amdhsa/lib/libc.a
> 
> ld: error: duplicate symbol: __malloc_unlock
>  >>> defined at malloc.h:138 (..../newlib/libc/include/malloc.h:138)
>  >>>            libc_a-mlock.o:(__malloc_unlock) in archive 
> ..../amdgcn-amdhsa/lib/libc.a
>  >>> defined at malloc_support.c:96 
> (..../newlib/libc/machine/amdgcn/malloc_support.c:96)
>  >>>            libc_a-malloc_support.o:(.text+0x438) in archive 
> ..../install/amdgcn-amdhsa/lib/libc.a
> collect2: error: ld returned 1 exit status
> 
> (I should mention that the amdgcn port uses the LLVM binary utilities, 
> so the error messages look a little different to GNU ld. I've also 
> elided the long pathnames with "....".)

looks like amdgcn doesn't have a GNU port at all, so i can't really repro
this situation.  i can't explain why it changed.  it might be the overall
ordering changed because of assumptions in the build ...

> Previously only the machine-specific __malloc_lock was used, which is of 
> course the one I want.
> 
> Should those functions be added differently now?

i think you should always use the same name output if you want to override
regardless of my recent change.  the common code defines this in mlock.c,
so i would expect you to put your machine overrides in a mlock.c file in
your machine dir.

this is how all the setjmp, mem*, and str* funcs all work.
-mike
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmI2gUQACgkQQWM7n+g3
9YHeFQ//XLsMo4TfOYT97LXUpGgZ4LxLgSptrUNswMeKY8VAtM3VWYlhtKu2gv36
kDi7BQFxk44bCgLp1DDKLEUxXNdt47d/J/lCIc1ZricQsQs3n+tcMLbqwfYT11dg
OzHB4YBjJ9A9QSDNath5jca7I4FfA2buECrhHfN5BUy1ffANr7IqSP3SrXESrY/M
+zFWxCkxfWGwYS41JIa20NElWsKMXKBowKKlq3/+9ocTYHXte+vk6//TdMMy1Ywr
PHp9cRI2eNdTM736N4BjRq/aqAo04GtIE1/7UfHoe4kKKbn3gYKUjcTYFxvLAZPF
34yjqyUtsNZxT5z4rvMTkyfCajR74D6U2bd6skPep23mcQ/aW2n2bzVvA9PHtkKD
T02jEu6GPpS7X+T17w4YCJIqsppinNcFX90sPxXXRbePdmyJxgfpwIGDG27yXfLe
P+WuqfZZgxMhexv88bCvwGVgCkZHQj4zFyJsXUbj1ZGs6WHNXNaNd2/f0e2K4VF2
6RuDyDpCnfZNbPxhUFouJSstMkuVvTrNFaVIKSKUUOhRB3ULop74356yD36brFnp
V/fCuMsrvtBaKRMMw3xn1pJMfeyRxeV0KdZY5PmEIvApi8a7yuUNKd7GJ4atr7lM
Ggc6Ni4zgmvLwxLeFHmxqaXIjhYoIjKfB54GrC6eDGyICXwVNTg=
=G9iS
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.