mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Anthony G. Basile" <basile@opensource.dyc.edu>
To: musl@lists.openwall.com
Subject: i686 with -fPIE and -fstack-protector-all
Date: Sat, 22 Mar 2014 08:53:07 -0400	[thread overview]
Message-ID: <532D87B3.8050001@opensource.dyc.edu> (raw)

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


             reply	other threads:[~2014-03-22 12:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-22 12:53 Anthony G. Basile [this message]
2014-03-22 13:06 ` Szabolcs Nagy
2014-03-22 13:33   ` Anthony G. Basile
2014-03-22 17:42     ` Rich Felker
2014-03-22 20:44       ` Anthony G. Basile

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=532D87B3.8050001@opensource.dyc.edu \
    --to=basile@opensource.dyc.edu \
    --cc=musl@lists.openwall.com \
    /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).