mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Fangrui Song <i@maskray.me>
To: Jiahao XU <Jiahao_XU@outlook.com>
Cc: "musl@lists.openwall.com" <musl@lists.openwall.com>,
	Szabolcs Nagy <nsz@port70.net>
Subject: Re: [musl] Can’t build musl with lto=thin
Date: Fri, 29 Jan 2021 12:53:49 -0800	[thread overview]
Message-ID: <MWHPR1201MB0110E08D50EBE88731F6641ACBB99@MWHPR1201MB0110.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20210129200416.GA2447252@port70.net>

On Fri, Jan 29, 2021 at 12:04 PM Szabolcs Nagy <nsz@port70.net> wrote:
>
> * Jiahao XU <Jiahao_XU@outlook.com> [2021-01-29 12:19:42 +0000]:
> > musl-1.2.2 compilation with clang-11 failed to build libc.so at the final linking stage:
> >     ld.lld: error: undefined hidden symbol: __dls2
> >     >>> referenced by ld-temp.o
> >     >>>                          lto.tmp:(_dlstart_c)
> >     >>> did you mean: __dls3
> >     >>> defined in: lto.tmp
>
>
> looks like a clang bug if -flto changes behaviour, doesn't it?

https://www.openwall.com/lists/musl/2020/12/27/25

Clang tracks undefined symbols in module-level inline asm but does not
know undefined symbols in function-scope inline asm.
I don't know whether it makes sense to track function-scope inline asm
- it requires to scan every instruction in the bitcode file which is a
heavy operation and it is only relevant in this narrow usage.

If you build this file with LTO, the LTO backend will internalize
__dls2 and cause a subsequent "undefined reference" error unless you
specify -u __dls2
to mark __dls2 as "visibible to a regular object file" (a workaround)


>
> >
> > I am using CFLAGS=‘-march=native -mtune=native -Oz -flto -fmerge-all-constants -fomit-frame-pointer’ and LDFLAGS=‘-flto -fuse-ld=lld -Wl,—plugin-opt=O3,-O3,—icf=safe’.
> > No configure option is supplied.
> >
> > Get Outlook for iOS<https://aka.ms/o0ukef>

  reply	other threads:[~2021-01-29 21:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 12:19 Jiahao XU
2021-01-29 20:04 ` Szabolcs Nagy
2021-01-29 20:53   ` Fangrui Song [this message]
2021-01-30 20:12 ` Rich Felker
2021-01-30 20:59   ` Леонид Юрьев (Leonid Yuriev)
     [not found]   ` <SYBP282MB020277E08EB49C9AC9BF90888AB89@SYBP282MB0202.AUSP282.PROD.OUTLOOK.COM>
2021-01-30 23:30     ` Rich Felker
     [not found]       ` <SYBP282MB0202BF16DD08A2F1537FD5428AB89@SYBP282MB0202.AUSP282.PROD.OUTLOOK.COM>
2021-01-31  5:01         ` Rich Felker
2021-01-31  5:32           ` Jiahao XU
2021-01-31 21:01             ` Rich Felker
2021-01-31 22:29               ` Jiahao XU
2021-02-01  0:22               ` Jiahao XU
2021-02-01  0:31                 ` Jiahao XU
2021-02-01  0:44                   ` Jiahao XU
2021-02-01  0:50                     ` Jiahao XU
2021-02-01 13:20                       ` Jiahao XU
2021-02-01 16:55                         ` Nick Bray
2021-02-01 17:53                   ` Rich Felker
2021-02-01 18:06                     ` Fangrui Song
2021-02-01 21:20                       ` Jiahao XU
2021-02-13 17:54                         ` Tim Tassonis
2021-02-14  5:59                           ` Markus Wichmann

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=MWHPR1201MB0110E08D50EBE88731F6641ACBB99@MWHPR1201MB0110.namprd12.prod.outlook.com \
    --to=i@maskray.me \
    --cc=Jiahao_XU@outlook.com \
    --cc=musl@lists.openwall.com \
    --cc=nsz@port70.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).