From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4706 Path: news.gmane.org!not-for-mail From: "Anthony G. Basile" Newsgroups: gmane.linux.lib.musl.general Subject: i686 with -fPIE and -fstack-protector-all Date: Sat, 22 Mar 2014 08:53:07 -0400 Message-ID: <532D87B3.8050001@opensource.dyc.edu> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1395492774 2762 80.91.229.3 (22 Mar 2014 12:52:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Mar 2014 12:52:54 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4710-gllmg-musl=m.gmane.org@lists.openwall.com Sat Mar 22 13:53:04 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WRLQ5-0000ex-Nx for gllmg-musl@plane.gmane.org; Sat, 22 Mar 2014 13:53:01 +0100 Original-Received: (qmail 24098 invoked by uid 550); 22 Mar 2014 12:53:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 24086 invoked from network); 22 Mar 2014 12:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 Xref: news.gmane.org gmane.linux.lib.musl.general:4706 Archived-At: Hi, I've hit a bug with 1.0.0 on i686. When building with -fstack-protector-all and -fPIE, I get an undefined reference to `__stack_chk_fail_local'. I do not get this on x86_64: i686: i686-musl-vanilla ~ # gcc -fstack-protector-all -fPIE -o test test.c /tmp/ccmdheAK.o: In function `main': test.c:(.text+0x28): undefined reference to `__stack_chk_fail_local' /usr/lib/gcc/i686-gentoo-linux-musl/4.7.3/../../../../i686-gentoo-linux-musl/bin/ld: test: hidden symbol `__stack_chk_fail_local' isn't defined /usr/lib/gcc/i686-gentoo-linux-musl/4.7.3/../../../../i686-gentoo-linux-musl/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status i686-musl-vanilla ~ # gcc -fstack-protector-all -o test test.c i686-musl-vanilla ~ # gcc -fPIE -o test test.c By contrast for amd64: amd64-musl-vanilla ~ # echo "int main() { ; return 0 ; }" > test.c amd64-musl-vanilla ~ # gcc -fstack-protector-all -fPIE -o test test.c amd64-musl-vanilla ~ # gcc -fstack-protector-all -o test test.c amd64-musl-vanilla ~ # gcc -fPIE -o test test.c Doing a compile without link and checking the symbols confirms the problem: i686-musl-vanilla ~ # gcc -fstack-protector-all -fPIE -c test.c i686-musl-vanilla ~ # readelf -sW test.o | grep stack 9: 00000000 0 NOTYPE GLOBAL HIDDEN UND __stack_chk_fail_local amd64-musl-vanilla ~ # gcc -fstack-protector-all -fPIE -c test.c amd64-musl-vanilla ~ # readelf -sW test.o | grep stack 10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __stack_chk_fail This is obviously how the compiler spits things out and we have the exact same symbols (__stack_chk_fail on amd64 and __stack_chk_fail_local on i686) irrespective of the c library. Where is __stack_chk_fail_local resolved? -- Anthony G. Basile, Ph. D. Chair of Information Technology D'Youville College Buffalo, NY 14201 (716) 829-8197