public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/66784] New: no symbol emitted for builtin with lto
@ 2015-07-07  0:48 guido.hatzsis at yandex dot com
  2015-07-07  8:11 ` [Bug lto/66784] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: guido.hatzsis at yandex dot com @ 2015-07-07  0:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66784

            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 

# rm bar.o ; gcc  -c bar.i ; gcc-nm bar.o 
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 ‘__mulsc3’
 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: <gcc-bugs-return-491613-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
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: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
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" <gcc-bugzilla@gcc.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: <bug-66780-4-gARlUMFDbh@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66780-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66780-4@http.gcc.gnu.org/bugzilla/>
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?idf780

--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/66784] no symbol emitted for builtin with lto
  2015-07-07  0:48 [Bug c/66784] New: no symbol emitted for builtin with lto guido.hatzsis at yandex dot com
@ 2015-07-07  8:11 ` rguenth at gcc dot gnu.org
  2015-08-04  8:27 ` guido.hatzsis at yandex dot com
  2021-12-24  8:20 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-07  8:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66784

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-07
                 CC|                            |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I didn't know we detect these as "builtin".  But yes, confirmed.  There is LTO
bytecode for __mulsc3 but no entry in lto_.symtab

Same for regular builtins like abort ().

Honza - why is this so?  It surely looks like a bug to me.

With -ffreestanding we do get the symbols.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/66784] no symbol emitted for builtin with lto
  2015-07-07  0:48 [Bug c/66784] New: no symbol emitted for builtin with lto guido.hatzsis at yandex dot com
  2015-07-07  8:11 ` [Bug lto/66784] " rguenth at gcc dot gnu.org
@ 2015-08-04  8:27 ` guido.hatzsis at yandex dot com
  2021-12-24  8:20 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: guido.hatzsis at yandex dot com @ 2015-08-04  8:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66784

--- Comment #2 from Guido Haztsis <guido.hatzsis at yandex dot com> ---
Well I believe that the is_builtin_fn cometh from here:

+2488 gcc/lto-streamer-out.c 
   if (!TREE_PUBLIC (t)
       || is_builtin_fn (t)
       || DECL_ABSTRACT_P (t)
       || (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)))


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug lto/66784] no symbol emitted for builtin with lto
  2015-07-07  0:48 [Bug c/66784] New: no symbol emitted for builtin with lto guido.hatzsis at yandex dot com
  2015-07-07  8:11 ` [Bug lto/66784] " rguenth at gcc dot gnu.org
  2015-08-04  8:27 ` guido.hatzsis at yandex dot com
@ 2021-12-24  8:20 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-24  8:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66784

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Known to work|                            |10.1.0, 11.1.0, 9.3.0
   Target Milestone|---                         |9.3
             Status|NEW                         |RESOLVED
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=91287

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 9.3.0 by r9-7678 and in GCC 10+ by r10-2456.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-24  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07  0:48 [Bug c/66784] New: no symbol emitted for builtin with lto guido.hatzsis at yandex dot com
2015-07-07  8:11 ` [Bug lto/66784] " rguenth at gcc dot gnu.org
2015-08-04  8:27 ` guido.hatzsis at yandex dot com
2021-12-24  8:20 ` pinskia at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).