From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15053 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Youren Shen Newsgroups: gmane.linux.lib.musl.general Subject: [BUG] Force to use a dynamic linker in musl-clang wapper cause a crash for static-pie c++ programs. Date: Tue, 24 Dec 2019 22:38:49 +0800 Message-ID: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000dfa38d059a741a30" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="270317"; mail-complaints-to="usenet@blaine.gmane.org" To: musl@lists.openwall.com Original-X-From: musl-return-15069-gllmg-musl=m.gmane.org@lists.openwall.com Tue Dec 24 16:01:54 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1ijlh3-0018Cp-T5 for gllmg-musl@m.gmane.org; Tue, 24 Dec 2019 16:01:53 +0100 Original-Received: (qmail 7576 invoked by uid 550); 24 Dec 2019 15:01:50 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3262 invoked from network); 24 Dec 2019 14:39:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=C4xDrj2y8lBJAyXAcjNdMwD3D7ioaFaxWSTD1qPSA24=; b=CxFfY/RvonjCx2ndeEnTVV2HTb31e+7xU7JNNh69X6fYeW26sTTv+fMuwCqpS7b+Xk zzxA+FToCo24hIgawiGhHYH/3Rm39PMTb55GcDyrl7g9y2Nvp+fwZkEeDiTDDmpV70CC sq2O3v+fxzLZowj+KdtEdb+E8A6Iy0XNsmD28pXtn1Uhaq+dC39nud+yI2jyV7WjS39H PBWH1Hw2GnYa5MuyCdTJCaXZOzxAPVY6ipFl3DTjMp49j8sGI4ewYN7qq8yHtmFjPzgy Zq8FHScNa9gJUwe0ajR+Fkbz/npM5YvTFWCzH8/dneXBURtr1JLcKdMOxyZY87f4UVz2 K1RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=C4xDrj2y8lBJAyXAcjNdMwD3D7ioaFaxWSTD1qPSA24=; b=frtbl8FKLpOBKpb9+SQuaz55GIvJgGyfBrY4X/0VawQ6x82f+5oqgkWwYtP3+qHU+o ZhHAySHqcGuGKQL41D2hKHRCjlrI9Yov+ZTtiQJs6b0lQW2dmPiP+EKtDfsIFSBQ4B4w pYTe1G+W/iJS7Z6HKXWxI+az0aRl12iUNrbUL0a1u1qDu35YRPdU4CWpgfhmOqgiW+II v9aLsi+VTx6ZHqahe2EQDKfOSljPEWdfa2zc3aqXZxlmoe9ezb/edhJUEsbAdgenSMY+ +EbAK4+KHZJuH7aTy2kq2YakGBXR6HLWnTMv2PIJi/3uLUriVqGmk4WIByklsQpRVFEo kxng== X-Gm-Message-State: APjAAAW63OIBbWBxMTmo93Tl+6Xvd1u5qwpOGv8AEvF/vkC5Dl/GRqK9 +J8pesf3lztTFOyfsUfI6DSFuuZe8q9jG3Egjst+WK5hoWI= X-Google-Smtp-Source: APXvYqwH0g9GUtXCKIP2Xlpt60kwzfKrJxzIQJbKHPnearFjWCOL09NxAK7z1U9ZWdw3pJhX0C9lMFe9/k9a+LFjL1I= X-Received: by 2002:a05:600c:22d1:: with SMTP id 17mr4857247wmg.23.1577198341299; Tue, 24 Dec 2019 06:39:01 -0800 (PST) Xref: news.gmane.org gmane.linux.lib.musl.general:15053 Archived-At: --000000000000dfa38d059a741a30 Content-Type: text/plain; charset="UTF-8" Hey, there, Recently I'm trying to build a non-gnu toolchain with musl, clang, llvm, libc++, compiler-rt. While static-pie feature is very useful in our project, musl-clang force to link a dynamic linker into the binary. This behavior will cause a crash in c++ programs with compiler-rt and libc++. For more details and reproduction of this bug, you can read my previous email to llvm-dev mail lists.[1] I spend a few days to find the reason -- in function _dlstart_c, the program will get a "base" of relocation in /lib/ld-musl-x86_64.so.1, which is not right when it tries to relocate .rel.dyn section in the binary. Overall, the static-pie program does not need a dynamic linker at all. So maybe we should remove this argument in wrapper when static-pie is enabled. Thank you very much. [1]. https://groups.google.com/forum/#!msg/llvm-dev/XPrSPqD2zjM/YtH6Fi2YAgAJ -- Best Regards. Youren Shen. --000000000000dfa38d059a741a30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey, there,
Recently I'm trying to build a non-gnu= toolchain with musl, clang, llvm, libc++, compiler-rt. While static-pie fe= ature is very useful in our project, musl-clang force to link a dynamic lin= ker into the binary. This behavior will cause a crash in c++ programs with = compiler-rt and libc++. For more details and reproduction of this bug, you = can read my previous email to llvm-dev mail lists.[1]
I spend a few days= to find the reason -- in function _dlstart_c, the program will get a "= ;base" of relocation in /lib/ld-musl-x86_64.so.1, which is not right w= hen it tries to relocate .rel.dyn section in the binary.
Overall, the st= atic-pie program does not need a dynamic linker at all. So maybe we should = remove this argument in wrapper when static-pie is enabled.
<= br>
Thank you very much.
--000000000000dfa38d059a741a30--