From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14055 invoked from network); 31 Jan 2021 13:51:49 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 31 Jan 2021 13:51:49 -0000 Received: (qmail 17694 invoked by uid 550); 31 Jan 2021 13:51:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 5902 invoked from network); 31 Jan 2021 05:33:02 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L057qu1xK3Ql78nie/3g+HhD+oHBAwIa/idhP00nRW7JacslyG1Sfg/xtx4RXIwUi/CWaHmu1vmn5lBxRY9itT0lODTMDmc6V4XqGCON/yhB+xXpgFn1d0mIh9KzFAAwiryH9/aNLOFiBE+KmIvhN5lTZDSQ3v0KDOwnfIsmY+wRCm9W+6fgPddlkhji/SF/Jwh6c91XYOjDnuFabNgR5h1yaa/3OEwHPc1AQzzTu9V4k1ZouwxLs8VwFE/Q/vYob46LMIj6j7g5Y5/A+pYcXrkZMAw5wO9trh1olDeRq5lOuOciLl5axt1rvW1WwketbU7qPs2qJPLAY6Q7TnamKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G6sfaHIqu3twI2YVaXa8856rmPqCda/qEUDUSuiX+XI=; b=Jsn3M6WYAJRZ6vkEmeWtkrLrncQ/SL9Jt1DVBxx2BzjeSQPFh7SkZ09ek5xMusEOIHZ+xhs4nhV+6dHVNziFgPAHwEhqkUtuE7LtVKu68YEvfTGyvxUC921Hz0GD147QmaVEsfkPhygZFD67MWev+5lK61cRkAWjTFg0Ux7sPpd/EJv2hs5a6699i4VadDZ2MLCg102q9umECjRDAchYEeFln0kvuj7dOEiAsigqdjxTn3iYxRqvGdIHQKdGpZs+X/MDvZAhZOvQcPEfB5Ko6lVbdHZtbq3CnM57HzvmzsoYYRfYbXuux8C7hhXqDfBO/GYwXiVe1SvYq7XED0RGKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G6sfaHIqu3twI2YVaXa8856rmPqCda/qEUDUSuiX+XI=; b=ko0CYeDb/7MFaEokymCXl1ju9SLj3b8UnMFVux1vwTx+/0ouTUrHEMT6GDRKKElCLHi4cRlr4RlJ+XkUE40zX2cuGZToGIXffkDbufQaN9BqjFAOjLVwXql4FHaZVIoxDIaljMjEBuR1BKSB5vGP3D1cfaNk5lpYuvT3z857xP1/fcj/h7lDoZZRVGaBNmOfznPWdiftQ5xeWM3rja9euqwF7nmIeCNBphSyC0n2bIGC9pfQ4x0Hjv3szAX4hAIEdDIRdImNi/lj0XDigeommBrQVkfS3Es0qFzKW/308rAu0dRR/3DGARu4LCxNFw8m+zK1x6xDWe5R3JfvAOcwQQ== From: Jiahao XU To: Rich Felker CC: "musl@lists.openwall.com" Thread-Topic: =?Windows-1252?Q?[musl]_Can=92t_build_musl_with_lto=3Dthin?= Thread-Index: AQHW9jgSvzPebfQPWE+aIHYKw/I+pqpAnAqAgAAvdNWAAAfHAIAAA9LIgABYtQCAAAdvOA== Date: Sun, 31 Jan 2021 05:32:45 +0000 Message-ID: References: <20210130201227.GP23432@brightrain.aerifal.cx> <20210130233012.GR23432@brightrain.aerifal.cx> ,<20210131050121.GS23432@brightrain.aerifal.cx> In-Reply-To: <20210131050121.GS23432@brightrain.aerifal.cx> Accept-Language: en-US Content-Language: en-AU X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:26BA64EBEFB9F653752EBAA93704659713689AC6D84BA2C3D49280E3804436C1;UpperCasedChecksum:FB453AA449357511263BF9E1A226394867D85BA0E3E387916AB95CEC4C0AB007;SizeAsReceived:7231;Count:44 x-tmn: [LshtTFR2EwlpcsCHS+kT11L/2ybcSCrn] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 005a11cb-cc81-40aa-5baf-08d8c5a9a3c7 x-ms-traffictypediagnostic: HK2APC01HT171: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QhzS2z+DAwBjBO6F/ZdsMjxt2cxCOT31V/D0zKGYrl+fsrpRTI9qXonP8eswxltfPHiOnZT3icFlo3GTZ0r7GOKbDkKdMdPm/GTqAofLPRiJsdAmn2Is2Ui7YpgN5Jh6I9UsOEWr4mEL31xpk3SPAgDPukdmHRK25MrH/1y/NEvZSc31gTRS4Rap0mfHjFmL+2ZzYleiX24zJ9tIT1LLq9CjCSbXxpzVodqxFENZXq4ze/BGYrHmDehnviIdYowS73M+j669muSoJ0KXYzrzVdr9ppFgoy9naIpuRgVDfB3+gNj1UfWHMwzQYJp2rTD1/H5g4WyPYPtmWH/VHGo2LXK/OqHe6nuPDqUGh/rYQqHJw8wFcEcs/Tcy3OFdnvaevdtPYezBkNORmTf/nzJefRgJJW1/kq4XoXaZ8U+zlW3WlAMoLsNkqPyak20S4gXL x-ms-exchange-antispam-messagedata: Ut/MOVVuEEQ6v3hJL7lgypYF72FhIMrf9WKu67bjvtaCaZF0R/yILkjURhZuC49sxhDtSLpNL1kZ6JLYrh2fZScXAuK5Y+jttE2Q78gCaiowkmkzzLbNFtHqeXP8suql5xXE8+vDkwrJ0NmLgoLFFA== x-ms-exchange-transport-forked: True Content-Type: multipart/alternative; boundary="_000_SYBP282MB02026BB49DD8C867CB787E8A8AB79SYBP282MB0202AUSP_" MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: HK2APC01FT054.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 005a11cb-cc81-40aa-5baf-08d8c5a9a3c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2021 05:32:45.9931 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT171 Subject: =?Windows-1252?Q?Re:_[musl]_Can=92t_build_musl_with_lto=3Dthin?= --_000_SYBP282MB02026BB49DD8C867CB787E8A8AB79SYBP282MB0202AUSP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I used `musl-clang -Oz -flto -s -fuse-ld=3Dmusl-clang-lld-static -Wl,=97plu= gin-opt=3DO3,-O3 hello.c` to produce the executable. Content of `/usr/local/musl/bin/ld.musl-clang-lld-static` is same as the ge= nerated `ld.musl-clang`, except for the last line, which I modified it to: exec $($cc -print-prog-name=3Dld.lld) -nostdlib =93$@=93 -static -lc -d= ynamic-linker =93$ldso=94 Get Outlook for iOS ________________________________ From: Rich Felker Sent: Sunday, January 31, 2021 4:01:22 PM To: Jiahao XU Cc: musl@lists.openwall.com Subject: Re: [musl] Can=92t build musl with lto=3Dthin On Sat, Jan 30, 2021 at 11:44:48PM +0000, Jiahao XU wrote: > (gdb) bt > > #0 0x00007ffff7ff5498 in decode_vec () from /lib/ld-musl-x86_64.so.1 > > #1 0x00007ffff7ff58cb in decode_dyn () from /lib/ld-musl-x86_64.so.1 > > #2 0x0000000000000000 in ?? () This is not a static-linked program. decode_dyn is part of the dynamic linker. It looks to me like you've created some sort of weird hybrid executable that's not valid. Can you show the command lines you used to produce it? Also please keep list on CC when replying. Rich > (gdb) info r > > rax 0x1 1 > > rbx 0x7ffff7ffe2d8 140737354130136 > > rcx 0x5000 20480 > > rdx 0x200238 2097720 > > rsi 0x7fffffffd8d0 140737488345296 > > rdi 0x0 0 > > rbp 0x7ffff7ffe2d8 0x7ffff7ffe2d8 <__dls3.app> > > rsp 0x7fffffffd8c8 0x7fffffffd8c8 > > r8 0x0 0 > > r9 0xfffffffffffff000 -4096 > > r10 0x800000 8388608 > > r11 0x200000 2097152 > > r12 0x7fffffffdcb8 140737488346296 > > r13 0x0 0 > > r14 0x7fffffffd8d0 140737488345296 > > r15 0x7fffffffdcb8 140737488346296 > > rip 0x7ffff7ff5498 0x7ffff7ff5498 > > eflags 0x10246 [ PF ZF IF RF ] > > cs 0x33 51 > > ss 0x2b 43 > > ds 0x0 0 > > es 0x0 0 > > fs 0x0 0 > > gs 0x0 0 > > > Disassembly of decode_dyn: > > > 0x00007ffff7ff58af <+0>: push %r14 > > 0x00007ffff7ff58b1 <+2>: push %rbx > > 0x00007ffff7ff58b2 <+3>: sub $0x108,%rsp > > 0x00007ffff7ff58b9 <+10>: mov %rdi,%rbx > > 0x00007ffff7ff58bc <+13>: mov 0x10(%rdi),%rdi > > 0x00007ffff7ff58c0 <+17>: mov %rsp,%r14 > > 0x00007ffff7ff58c3 <+20>: mov %r14,%rsi > > 0x00007ffff7ff58c6 <+23>: call 0x7ffff7ff5483 > > 0x00007ffff7ff58cb <+28>: mov (%rbx),%rax > > > Disassembly of decode_vec: > > > 0x00007ffff7ff5483 <+0>: xor %eax,%eax > > 0x00007ffff7ff5485 <+2>: cmp $0x20,%rax > > 0x00007ffff7ff5489 <+6>: je 0x7ffff7ff5495 > > 0x00007ffff7ff548b <+8>: andq $0x0,(%rsi,%rax,8) > > 0x00007ffff7ff5490 <+13>: inc %rax > > 0x00007ffff7ff5493 <+16>: jmp 0x7ffff7ff5485 > > 0x00007ffff7ff5495 <+18>: push $0x1 > > 0x00007ffff7ff5497 <+20>: pop %rax > > =3D> 0x00007ffff7ff5498 <+21>: mov (%rdi),%rcx > > 0x00007ffff7ff549b <+24>: test %rcx,%rcx > > 0x00007ffff7ff549e <+27>: je 0x7ffff7ff54c3 > > 0x00007ffff7ff54a0 <+29>: lea -0x1(%rcx),%rdx > > 0x00007ffff7ff54a4 <+33>: cmp $0x1e,%rdx > > 0x00007ffff7ff54a8 <+37>: ja 0x7ffff7ff54bd > > 0x00007ffff7ff54aa <+39>: shlx %rcx,%rax,%rcx > > 0x00007ffff7ff54af <+44>: or %rcx,(%rsi) > > 0x00007ffff7ff54b2 <+47>: mov (%rdi),%rcx > > 0x00007ffff7ff54b5 <+50>: mov 0x8(%rdi),%rdx > > 0x00007ffff7ff54b9 <+54>: mov %rdx,(%rsi,%rcx,8) > > 0x00007ffff7ff54bd <+58>: add $0x10,%rdi > > 0x00007ffff7ff54c1 <+62>: jmp 0x7ffff7ff5498 > > 0x00007ffff7ff54c3 <+64>: ret > > > Jiahao XU > > Get Outlook for iOS > ________________________________ > From: Rich Felker > Sent: Sunday, January 31, 2021 10:30:12 AM > To: Jiahao XU > Cc: musl@lists.openwall.com > Subject: Re: [musl] Can=92t build musl with lto=3Dthin > > On Sat, Jan 30, 2021 at 11:04:32PM +0000, Jiahao XU wrote: > > > So something like (in config.mak): > > > > > > obj/ldso/dlstart.lo: CFLAGS_ALL +=3D -fno-lto > > > > Thanks, with this I was able to build libc.so successfully with clang a= nd created a 3.5 KB hello world program using clang and lld. > > > > However, I still wasn=92t able to statically linked with libc. > > > > Once I added =91-static=92 to the compiler flags, the executable failed= with =91Segmentation fault (core dumped)=92. > > It's libc.a, not libc.so, that will be involved in making a > static-linked binary. It's hard to know what's going wrong without > more information. Can you run under a debugger and provide a > backtrace, disassembly, and register dump for where the crash occurs? > > Rich > > > > ________________________________ > > From: Rich Felker > > Sent: Sunday, January 31, 2021 7:12:31 AM > > To: Jiahao XU > > Cc: musl@lists.openwall.com > > Subject: Re: [musl] Can=92t build musl with lto=3Dthin > > > > On Fri, Jan 29, 2021 at 12:19:42PM +0000, Jiahao XU wrote: > > > musl-1.2.2 compilation with clang-11 failed to build libc.so at the f= inal 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 > > > > > > I am using CFLAGS=3D=91-march=3Dnative -mtune=3Dnative -Oz -flto > > > -fmerge-all-constants -fomit-frame-pointer=92 and LDFLAGS=3D=91-flto > > ^^^^^^^^^^^^^^^^^^^^^ > > > > The -fmerge-all-constants option gives non-conforming language > > semantics and should not be used, but that's a separate issue. > > > > > -fuse-ld=3Dlld -Wl,=97plugin-opt=3DO3,-O3,=97icf=3Dsafe=92. > > > > > No configure option is supplied. > > > > Otherwise, it's a known issue that LTO misses references from asm > > (both top-level and in functions). I think dlstart.lo and a few other > > files should just be built with LTO disabled; any LTO-type > > optimization in code that runs at this stage is inherently invalid, > > anyway. So something like (in config.mak): > > > > obj/ldso/dlstart.lo: CFLAGS_ALL +=3D -fno-lto > > > > Rich --_000_SYBP282MB02026BB49DD8C867CB787E8A8AB79SYBP282MB0202AUSP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
I used `musl-clang -Oz -flto -s -fuse-ld=3Dmusl-clang-lld-static -Wl,=97plu= gin-opt=3DO3,-O3 hello.c` to produce the executable.

Content of `/usr/local/musl/bin/ld.musl-clang-lld-static` is same as the ge= nerated `ld.musl-clang`, except for the last line, which I modified it to:<= /div>

    exec $($cc -print-prog-name=3Dld.lld) -nostdlib =93$@=93 -sta= tic -lc -dynamic-linker =93$ldso=94


From: Rich Felker <dalia= s@libc.org>
Sent: Sunday, January 31, 2021 4:01:22 PM
To: Jiahao XU <Jiahao_XU@outlook.com>
Cc: musl@lists.openwall.com <musl@lists.openwall.com>
Subject: Re: [musl] Can=92t build musl with lto=3Dthin
 
On Sat, Jan 30, 2021 at 11:44:48PM +0000, Jiahao X= U wrote:
> (gdb) bt
>
> #0  0x00007ffff7ff5498 in decode_vec () from /lib/ld-musl-x86_64.= so.1
>
> #1  0x00007ffff7ff58cb in decode_dyn () from /lib/ld-musl-x86_64.= so.1
>
> #2  0x0000000000000000 in ?? ()

This is not a static-linked program. decode_dyn is part of the dynamic
linker. It looks to me like you've created some sort of weird hybrid
executable that's not valid. Can you show the command lines you used
to produce it?

Also please keep list on CC when replying.

Rich


> (gdb) info r
>
> rax            = 0x1            =      1
>
> rbx            = 0x7ffff7ffe2d8      140737354130136
>
> rcx            = 0x5000           &nb= sp;  20480
>
> rdx            = 0x200238            = 2097720
>
> rsi            = 0x7fffffffd8d0      140737488345296
>
> rdi            = 0x0            =      0
>
> rbp            = 0x7ffff7ffe2d8      0x7ffff7ffe2d8 <__dls3.app&= gt;
>
> rsp            = 0x7fffffffd8c8      0x7fffffffd8c8
>
> r8           &n= bsp; 0x0           &= nbsp;     0
>
> r9           &n= bsp; 0xfffffffffffff000  -4096
>
> r10            = 0x800000            = 8388608
>
> r11            = 0x200000            = 2097152
>
> r12            = 0x7fffffffdcb8      140737488346296
>
> r13            = 0x0            =      0
>
> r14            = 0x7fffffffd8d0      140737488345296
>
> r15            = 0x7fffffffdcb8      140737488346296
>
> rip            = 0x7ffff7ff5498      0x7ffff7ff5498 <decode_vec+= 21>
>
> eflags         0x10246 &n= bsp;           [ PF ZF IF= RF ]
>
> cs           &n= bsp; 0x33           =      51
>
> ss           &n= bsp; 0x2b           =      43
>
> ds           &n= bsp; 0x0           &= nbsp;     0
>
> es           &n= bsp; 0x0           &= nbsp;     0
>
> fs           &n= bsp; 0x0           &= nbsp;     0
>
> gs           &n= bsp; 0x0           &= nbsp;     0
>
>
> Disassembly of decode_dyn:
>
>
>    0x00007ffff7ff58af <+0>:   &nbs= p; push   %r14
>
>    0x00007ffff7ff58b1 <+2>:   &nbs= p; push   %rbx
>
>    0x00007ffff7ff58b2 <+3>:   &nbs= p; sub    $0x108,%rsp
>
>    0x00007ffff7ff58b9 <+10>:    mo= v    %rdi,%rbx
>
>    0x00007ffff7ff58bc <+13>:    mo= v    0x10(%rdi),%rdi
>
>    0x00007ffff7ff58c0 <+17>:    mo= v    %rsp,%r14
>
>    0x00007ffff7ff58c3 <+20>:    mo= v    %r14,%rsi
>
>    0x00007ffff7ff58c6 <+23>:    ca= ll   0x7ffff7ff5483 <decode_vec>
>
>    0x00007ffff7ff58cb <+28>:    mo= v    (%rbx),%rax
>
>
> Disassembly of decode_vec:
>
>
>    0x00007ffff7ff5483 <+0>:   &nbs= p; xor    %eax,%eax
>
>    0x00007ffff7ff5485 <+2>:   &nbs= p; cmp    $0x20,%rax
>
>    0x00007ffff7ff5489 <+6>:   &nbs= p; je     0x7ffff7ff5495 <decode_vec+18>
>
>    0x00007ffff7ff548b <+8>:   &nbs= p; andq   $0x0,(%rsi,%rax,8)
>
>    0x00007ffff7ff5490 <+13>:    in= c    %rax
>
>    0x00007ffff7ff5493 <+16>:    jm= p    0x7ffff7ff5485 <decode_vec+2>
>
>    0x00007ffff7ff5495 <+18>:    pu= sh   $0x1
>
>    0x00007ffff7ff5497 <+20>:    po= p    %rax
>
> =3D> 0x00007ffff7ff5498 <+21>:    mov &nb= sp;  (%rdi),%rcx
>
>    0x00007ffff7ff549b <+24>:    te= st   %rcx,%rcx
>
>    0x00007ffff7ff549e <+27>:    je=      0x7ffff7ff54c3 <decode_vec+64>
>
>    0x00007ffff7ff54a0 <+29>:    le= a    -0x1(%rcx),%rdx
>
>    0x00007ffff7ff54a4 <+33>:    cm= p    $0x1e,%rdx
>
>    0x00007ffff7ff54a8 <+37>:    ja=      0x7ffff7ff54bd <decode_vec+58>
>
>    0x00007ffff7ff54aa <+39>:    sh= lx   %rcx,%rax,%rcx
>
>    0x00007ffff7ff54af <+44>:    or=      %rcx,(%rsi)
>
>    0x00007ffff7ff54b2 <+47>:    mo= v    (%rdi),%rcx
>
>    0x00007ffff7ff54b5 <+50>:    mo= v    0x8(%rdi),%rdx
>
>    0x00007ffff7ff54b9 <+54>:    mo= v    %rdx,(%rsi,%rcx,8)
>
>    0x00007ffff7ff54bd <+58>:    ad= d    $0x10,%rdi
>
>    0x00007ffff7ff54c1 <+62>:    jm= p    0x7ffff7ff5498 <decode_vec+21>
>
>    0x00007ffff7ff54c3 <+64>:    re= t
>
>
> Jiahao XU
>
> Get Outlook for iOS<https://aka.m= s/o0ukef>
> ________________________________
> From: Rich Felker <dalias@libc.org>
> Sent: Sunday, January 31, 2021 10:30:12 AM
> To: Jiahao XU <Jiahao_XU@outlook.com>
> Cc: musl@lists.openwall.com <musl@lists.openwall.com>
> Subject: Re: [musl] Can=92t build musl with lto=3Dthin
>
> On Sat, Jan 30, 2021 at 11:04:32PM +0000, Jiahao XU wrote:
> > > So something like (in config.mak):
> > >
> > > obj/ldso/dlstart.lo: CFLAGS_ALL +=3D -fno-lto
> >
> > Thanks, with this I was able to build libc.so successfully with c= lang and created a 3.5 KB hello world program using clang and lld.
> >
> > However, I still wasn=92t able to statically linked with libc. > >
> > Once I added =91-static=92 to the compiler flags, the executable = failed with =91Segmentation fault (core dumped)=92.
>
> It's libc.a, not libc.so, that will be involved in making a
> static-linked binary. It's hard to know what's going wrong without
> more information. Can you run under a debugger and provide a
> backtrace, disassembly, and register dump for where the crash occurs?<= br> >
> Rich
>
>
> > ________________________________
> > From: Rich Felker <dalias@libc.org>
> > Sent: Sunday, January 31, 2021 7:12:31 AM
> > To: Jiahao XU <Jiahao_XU@outlook.com>
> > Cc: musl@lists.openwall.com <musl@lists.openwall.com>
> > Subject: Re: [musl] Can=92t build musl with lto=3Dthin
> >
> > On Fri, Jan 29, 2021 at 12:19:42PM +0000, Jiahao XU wrote:
> > > musl-1.2.2 compilation with clang-11 failed to build libc.so= at the final linking stage:
> > >
> > >     ld.lld: error: undefined hidden symb= ol: __dls2
> > >     >>> referenced by ld-temp.o=
> > >     >>>    =             &nb= sp;         lto.tmp:(_dlstart_c) > > >     >>> did you mean: __dls3 > > >     >>> defined in: lto.tmp
> > >
> > > I am using CFLAGS=3D=91-march=3Dnative -mtune=3Dnative -Oz -= flto
> > > -fmerge-all-constants -fomit-frame-pointer=92 and LDFLAGS=3D= =91-flto
> >   ^^^^^^^^^^^^^^^^^^^^^
> >
> > The -fmerge-all-constants option gives non-conforming language > > semantics and should not be used, but that's a separate issue. > >
> > > -fuse-ld=3Dlld -Wl,=97plugin-opt=3DO3,-O3,=97icf=3Dsafe=92.<= br> > >
> > > No configure option is supplied.
> >
> > Otherwise, it's a known issue that LTO misses references from asm=
> > (both top-level and in functions). I think dlstart.lo and a few o= ther
> > files should just be built with LTO disabled; any LTO-type
> > optimization in code that runs at this stage is inherently invali= d,
> > anyway. So something like (in config.mak):
> >
> > obj/ldso/dlstart.lo: CFLAGS_ALL +=3D -fno-lto
> >
> > Rich
--_000_SYBP282MB02026BB49DD8C867CB787E8A8AB79SYBP282MB0202AUSP_--