Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 29 Jan 2021 12:53:49 -0800
From: Fangrui Song <>
To: Jiahao XU <>
Cc: "" <>, Szabolcs Nagy <>
Subject: Re: Can’t build musl with lto=thin

On Fri, Jan 29, 2021 at 12:04 PM Szabolcs Nagy <> wrote:
> * Jiahao XU <> [2021-01-29 12:19:42 +0000]:
> > musl-1.2.2 compilation with clang-11 failed to build 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?

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<>

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.