public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Andrew Stubbs <ams@codesourcery.com>
Cc: Newlib <newlib@sourceware.org>
Subject: Re: amdgcn build failure
Date: Sat, 19 Mar 2022 21:20:04 -0400	[thread overview]
Message-ID: <YjaBRPk5f0DG3rFW@vapier> (raw)
In-Reply-To: <ac69917d-bac0-55b8-6708-5a2d267710b2@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 2137 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-03-20  1:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 11:43 Andrew Stubbs
2022-03-20  1:20 ` Mike Frysinger [this message]
2022-03-21 14:25   ` Andrew Stubbs
2022-03-23  1:45     ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YjaBRPk5f0DG3rFW@vapier \
    --to=vapier@gentoo.org \
    --cc=ams@codesourcery.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).