From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101408 invoked by alias); 7 Jul 2015 00:48:34 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 101354 invoked by uid 48); 7 Jul 2015 00:48:29 -0000 From: "guido.hatzsis at yandex dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/66784] New: no symbol emitted for builtin with lto Date: Tue, 07 Jul 2015 00:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: lto X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: guido.hatzsis at yandex dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg00502.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D66784 Bug ID: 66784 Summary: no symbol emitted for builtin with lto Product: gcc Version: lto Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: guido.hatzsis at yandex dot com Target Milestone: --- No symbols are emitted when compiling a built-in with -flto. eg: # cat << __EOF > bar.i _Complex float __mulsc3(float x, float y, float z, float a) { return -1.0; } __EOF=20 # rm bar.o ; gcc -c bar.i ; gcc-nm bar.o=20 0000000000000000 T __mulsc3 # rm bar.o ; gcc -flto -c bar.i ; gcc-nm bar.o /usr/lib/gcc/x86_64-pc-linux-gnu/5.1.0/../../../../x86_64-pc-linux-gnu/bin/= nm: bar.o: no symbols # cat << __EOF > bar.i void __mulsc3(float x, float y, float z, float a) { } __EOF # rm bar.o ; gcc -flto -c bar.i ; gcc-nm bar.o bar.i:1:6: warning: conflicting types for built-in function =E2=80=98__muls= c3=E2=80=99 void __mulsc3(float x, float y, float z, float a) { } ^ 00000000 T __mulsc3 >>From gcc-bugs-return-491613-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 07 01:22:37 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 105225 invoked by alias); 7 Jul 2015 01:22:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 105068 invoked by uid 48); 7 Jul 2015 01:22:29 -0000 From: "kkojima at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/66780] [4.9 Regression] Compiling with -fstack-protector-strong causes binary to segfault Date: Tue, 07 Jul 2015 01:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kkojima at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg00503.txt.bz2 Content-length: 982 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66780 --- Comment #1 from Kazumoto Kojima --- I can reproduce the issue with the trunk cross compiler. It seems that openproc function in proc/readproc.c is miscompiled with -fstack-protector-strong. Here is a reduced test case: -- int t; struct s {}; int bar (void); int baz (int, struct s *); int foo (int x) { struct s sbuf; static int d; int val = bar (); if (d) { t = baz (x, &sbuf); d = 1; } return val; } -- It turned out that the fix for PR65249 causes this problem. The codes for stack protect can be inserted after some function call returning a value. That return value in R0 register could be clobbered with the fix for PR65249. I thought that stack_chk_guard thingy is inserted at the head of the function. It's not the case, unfortunately. I think that the wrong code is worse than the ICE. I'd like to revert the patches of PR65249 and reopen that PR.