public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39013]  New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie
@ 2009-01-28 22:11 zorry at ume dot nu
  2009-01-28 22:17 ` [Bug target/39013] " zorry at ume dot nu
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: zorry at ume dot nu @ 2009-01-28 22:11 UTC (permalink / raw)
  To: gcc-bugs

http://bugs.gentoo.org/show_bug.cgi?id=254355
We are using patched gcc but it fail on gentoo's default compiler's to.
It works fine with GCC 4.2.4 and lower.
The fail file is part of libnet
the symbol that miss the @PLT is libnet_getgre_length
it sould have @PLT as the rest of the symbols
If i compile the fail file with -pic instead i compiles fine.
and have @PLT added 
gcc version 4.3.3
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.3.3-r1/work/gcc-4.3.3/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.3
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.3
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.3/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.3.3/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --enable-nls --without-included-gettext
--with-system-zlib --disable-checking --disable-werror --enable-secureplt
--enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp
--enable-cld --disable-libgcj --enable-languages=c,c++,treelang --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu 
Thread model: posix
glibc-2.8_p20080602-r1
Intel-R-_Xeon-R-_CPU_E5420_@_2.50GHz
binutils:  2.18  it add relro as default
The file is compile with CFLAGS -fPIE and LDFLAGS -pie -z now


-- 
           Summary: Compiler miss to add @PLT to symbols when object is
                    compile with -fPIE -pie
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zorry at ume dot nu
 GCC build triplet: x_86_64
  GCC host triplet: x86_64
GCC target triplet: x86_86


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
@ 2009-01-28 22:17 ` zorry at ume dot nu
  2009-01-29  0:47 ` [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used hjl dot tools at gmail dot com
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: zorry at ume dot nu @ 2009-01-28 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zorry at ume dot nu  2009-01-28 22:16 -------
Created an attachment (id=17205)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17205&action=view)
gre compile with gcc 4.3 and -fPIE  -save-temps  gre.i

The .i file of gre thats compile with gcc 4.3.2 and CFLAGS -fPIE  LDFLAGS -pie


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
  2009-01-28 22:17 ` [Bug target/39013] " zorry at ume dot nu
@ 2009-01-29  0:47 ` hjl dot tools at gmail dot com
  2009-01-29  0:48 ` hjl dot tools at gmail dot com
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29  0:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2009-01-29 00:47 -------
[hjl@gnu-6 gcc]$ cat /tmp/i.i
inline void foo ();

void
bar ()
{
  foo ();
}
[hjl@gnu-6 gcc]$ ./xgcc -B./  -S /tmp/i.i -m32 -fPIC 
[hjl@gnu-6 gcc]$ cat i.s
        .file   "i.i"
        .text
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        subl    $4, %esp
        call    __i686.get_pc_thunk.bx
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        call    foo@PLT
        addl    $4, %esp
        popl    %ebx
        popl    %ebp
        ret
        .size   bar, .-bar


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com
                URL|http://bugs.gentoo.org/show_|
                   |bug.cgi?id=254355           |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86_64                      |
   GCC host triplet|x86_64                      |
 GCC target triplet|x86_86                      |x86_64-linux-gnu
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-29 00:47:37
               date|                            |
            Summary|Compiler miss to add @PLT to|[4.3/4.4 regression] @PLT is
                   |symbols when object is      |missing on failed inline
                   |compile with -fPIE -pie     |function when -fpie is used
   Target Milestone|---                         |4.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
  2009-01-28 22:17 ` [Bug target/39013] " zorry at ume dot nu
  2009-01-29  0:47 ` [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used hjl dot tools at gmail dot com
@ 2009-01-29  0:48 ` hjl dot tools at gmail dot com
  2009-01-29  0:50 ` pinskia at gcc dot gnu dot org
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29  0:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl dot tools at gmail dot com  2009-01-29 00:48 -------
[hjl@gnu-6 gcc]$ ./xgcc -B./ -fpie  -S /tmp/i.i -m32 -fpie
[hjl@gnu-6 gcc]$ cat i.s
        .file   "i.i"
        .text
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        call    foo
        leave
        ret
        .size   bar, .-bar


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (2 preceding siblings ...)
  2009-01-29  0:48 ` hjl dot tools at gmail dot com
@ 2009-01-29  0:50 ` pinskia at gcc dot gnu dot org
  2009-01-29  0:52 ` pinskia at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-29  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-01-29 00:50 -------
I don't see the issue with using the non PLT with -fPIE.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (3 preceding siblings ...)
  2009-01-29  0:50 ` pinskia at gcc dot gnu dot org
@ 2009-01-29  0:52 ` pinskia at gcc dot gnu dot org
  2009-01-29  0:58 ` pinskia at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-29  0:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-01-29 00:52 -------
Why do you think this is a bug?

PowerPC32-linux-gnu produces:
        bl foo@local


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (4 preceding siblings ...)
  2009-01-29  0:52 ` pinskia at gcc dot gnu dot org
@ 2009-01-29  0:58 ` pinskia at gcc dot gnu dot org
  2009-01-29  1:13 ` hjl dot tools at gmail dot com
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-29  0:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2009-01-29 00:58 -------
Since default_binds_local_p_1 returns true as shlib is false for -fPIE, I still
don't see any issues here except for the fact the linker not doing the correct
thing.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (5 preceding siblings ...)
  2009-01-29  0:58 ` pinskia at gcc dot gnu dot org
@ 2009-01-29  1:13 ` hjl dot tools at gmail dot com
  2009-01-29  1:46 ` hjl dot tools at gmail dot com
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29  1:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl dot tools at gmail dot com  2009-01-29 01:13 -------
Linker does complain:

[hjl@gnu-6 gcc]$ cat /tmp/i.i
inline void foo ();

int
main ()
{
  foo ();
  return 0;
}
[hjl@gnu-6 gcc]$ gcc  /tmp/i.i  -fpie -pie 
/tmp/ccOgMGls.o: In function `main':
i.i:(.text+0xa): undefined reference to `foo'
/usr/local/bin/ld: /tmp/ccOgMGls.o: relocation R_X86_64_PC32 against undefined
symbol `foo' can not be used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
[hjl@gnu-6 gcc]$ 


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|ubizjak at gmail dot com    |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (6 preceding siblings ...)
  2009-01-29  1:13 ` hjl dot tools at gmail dot com
@ 2009-01-29  1:46 ` hjl dot tools at gmail dot com
  2009-01-29  4:04 ` [Bug target/39013] [4.3/4.4 regression] Missing @PLT " hjl dot tools at gmail dot com
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29  1:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl dot tools at gmail dot com  2009-01-29 01:46 -------
This patch:

---
Index: varasm.c
===================================================================
--- varasm.c    (revision 5094)
+++ varasm.c    (working copy)
@@ -6321,6 +6321,11 @@ default_binds_local_p_1 (const_tree exp,
           && (DECL_INITIAL (exp) == NULL
               || DECL_INITIAL (exp) == error_mark_node))
     local_p = false;
+  /* Functions marked inline without body are not local.  */
+  else if (TREE_CODE (exp) == FUNCTION_DECL
+          && DECL_DECLARED_INLINE_P (exp)
+          && DECL_INITIAL (exp) == NULL)
+    local_p = false;
   /* Otherwise we're left with initialized (or non-common) global data
      which is of necessity defined locally.  */
   else
---

works for me


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (7 preceding siblings ...)
  2009-01-29  1:46 ` hjl dot tools at gmail dot com
@ 2009-01-29  4:04 ` hjl dot tools at gmail dot com
  2009-01-29  9:56 ` [Bug c/39013] " rguenth at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29  4:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hjl dot tools at gmail dot com  2009-01-29 04:04 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2009-01/msg01423.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2009-
                   |                            |01/msg01423.html
            Summary|[4.3/4.4 regression] @PLT is|[4.3/4.4 regression] Missing
                   |missing on failed inline    |@PLT when -fpie is used
                   |function when -fpie is used |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug c/39013] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (9 preceding siblings ...)
  2009-01-29  9:56 ` [Bug c/39013] " rguenth at gcc dot gnu dot org
@ 2009-01-29  9:56 ` rguenth at gcc dot gnu dot org
  2009-01-29 15:03 ` [Bug target/39013] " zorry at ume dot nu
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-29  9:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
   Target Milestone|4.3.4                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug c/39013] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (8 preceding siblings ...)
  2009-01-29  4:04 ` [Bug target/39013] [4.3/4.4 regression] Missing @PLT " hjl dot tools at gmail dot com
@ 2009-01-29  9:56 ` rguenth at gcc dot gnu dot org
  2009-01-29  9:56 ` rguenth at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-29  9:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2009-01-29 09:56 -------
No compiler with -fpie support manages to do this "correct".  Not a regression.

IMHO this is invalid.  6.7.4/6

"... If a function is declared with an inline function specifier, then it
shall also be defined in the same translation unit."

which is obviously not the case here.  That is C99 of course, so you might
argue that for GNU C89 the situation should be different, but then the
frontend should properly mark the declaration extern.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |c
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.4.6
            Summary|[4.3/4.4 regression] Missing|Missing @PLT when -fpie is
                   |@PLT when -fpie is used     |used


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (10 preceding siblings ...)
  2009-01-29  9:56 ` rguenth at gcc dot gnu dot org
@ 2009-01-29 15:03 ` zorry at ume dot nu
  2009-01-29 15:20 ` [Bug target/39013] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: zorry at ume dot nu @ 2009-01-29 15:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from zorry at ume dot nu  2009-01-29 15:03 -------
I don't get the link error with gcc 4.2.4 on the code in comment #7


-- 

zorry at ume dot nu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (11 preceding siblings ...)
  2009-01-29 15:03 ` [Bug target/39013] " zorry at ume dot nu
@ 2009-01-29 15:20 ` rguenth at gcc dot gnu dot org
  2009-01-29 15:52 ` hjl dot tools at gmail dot com
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-29 15:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rguenth at gcc dot gnu dot org  2009-01-29 15:20 -------
My testcase is

> cat t2.c
void foo() {}

> cat t.c
inline void foo ();
int main ()
{
  foo ();
  return 0;
}

which works perfectly fine even with 4.3 and 4.4 if I build both t2.c and t.c
with -fpie and fails with all compilers supporting -fpie if I only build
t.c with -fpie but t2.c not.

They bind locally with 4.3 and 4.4 though.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |
      Known to fail|3.4.6                       |4.3.3 4.4.0
      Known to work|                            |4.2.4
            Summary|Missing @PLT when -fpie is  |[4.3/4.4 Regression] Missing
                   |used                        |@PLT when -fpie is used
   Target Milestone|---                         |4.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (12 preceding siblings ...)
  2009-01-29 15:20 ` [Bug target/39013] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2009-01-29 15:52 ` hjl dot tools at gmail dot com
  2009-01-29 15:53 ` hjl dot tools at gmail dot com
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29 15:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from hjl dot tools at gmail dot com  2009-01-29 15:52 -------
(In reply to comment #12)
> My testcase is
> 
> > cat t2.c
> void foo() {}

The problem happens when t2.c is in a shared library.

> > cat t.c
> inline void foo ();
> int main ()
> {
>   foo ();
>   return 0;
> }
> 
> which works perfectly fine even with 4.3 and 4.4 if I build both t2.c and t.c
> with -fpie and fails with all compilers supporting -fpie if I only build
> t.c with -fpie but t2.c not.
> 

We can argue that this code is invalid and gcc shouldn't accept it
in the first place.  But from user perspective, gcc 4.3 doesn't work
on their codes any more silently.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (13 preceding siblings ...)
  2009-01-29 15:52 ` hjl dot tools at gmail dot com
@ 2009-01-29 15:53 ` hjl dot tools at gmail dot com
  2009-01-29 18:24 ` zorry at ume dot nu
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-29 15:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from hjl dot tools at gmail dot com  2009-01-29 15:53 -------
Created an attachment (id=17211)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17211&action=view)
A patch

This patch only checks

--- gcc/varasm.c.pie    2008-11-30 08:49:54.000000000 -0800
+++ gcc/varasm.c        2009-01-29 07:50:46.000000000 -0800
@@ -6321,6 +6321,10 @@ default_binds_local_p_1 (const_tree exp,
           && (DECL_INITIAL (exp) == NULL
               || DECL_INITIAL (exp) == error_mark_node))
     local_p = false;
+  /* Functions without body are not local.  */
+  else if (TREE_CODE (exp) == FUNCTION_DECL
+          && DECL_INITIAL (exp) == NULL)
+    local_p = false;
   /* Otherwise we're left with initialized (or non-common) global data
      which is of necessity defined locally.  */
   else


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (14 preceding siblings ...)
  2009-01-29 15:53 ` hjl dot tools at gmail dot com
@ 2009-01-29 18:24 ` zorry at ume dot nu
  2009-01-30 17:32 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: zorry at ume dot nu @ 2009-01-29 18:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from zorry at ume dot nu  2009-01-29 18:23 -------
We have this in the shared library that is compile with -fPIC
inline u_int32_t
libnet_getgre_length(u_int16_t fv)
{
code
}
And the app have 
code
len = libnet_getgre_length(gre_flags);
    size += len;
code


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (15 preceding siblings ...)
  2009-01-29 18:24 ` zorry at ume dot nu
@ 2009-01-30 17:32 ` jakub at gcc dot gnu dot org
  2009-01-30 20:32 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-30 17:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jakub at gcc dot gnu dot org  2009-01-30 17:31 -------
Patch to set DECL_EXTERNAL instead:
http://gcc.gnu.org/ml/gcc-patches/2009-01/msg01525.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (16 preceding siblings ...)
  2009-01-30 17:32 ` jakub at gcc dot gnu dot org
@ 2009-01-30 20:32 ` jakub at gcc dot gnu dot org
  2009-01-30 20:47 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-30 20:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-01-29 00:47:37         |2009-01-30 20:32:12
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3/4.4 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (17 preceding siblings ...)
  2009-01-30 20:32 ` jakub at gcc dot gnu dot org
@ 2009-01-30 20:47 ` jakub at gcc dot gnu dot org
  2009-01-30 20:50 ` [Bug target/39013] [4.3 " jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-30 20:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jakub at gcc dot gnu dot org  2009-01-30 20:47 -------
Subject: Bug 39013

Author: jakub
Date: Fri Jan 30 20:46:32 2009
New Revision: 143803

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143803
Log:
        PR target/39013
        * c-decl.c (pop_scope): Set DECL_EXTERNAL for functions declared
        inline but never defined.

        * gcc.target/i386/pr39013-1.c: New test.
        * gcc.target/i386/pr39013-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr39013-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr39013-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (18 preceding siblings ...)
  2009-01-30 20:47 ` jakub at gcc dot gnu dot org
@ 2009-01-30 20:50 ` jakub at gcc dot gnu dot org
  2009-01-30 22:59 ` zorry at ume dot nu
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-30 20:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jakub at gcc dot gnu dot org  2009-01-30 20:50 -------
Fixed on the trunk so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.3.3 4.4.0                 |4.3.3
      Known to work|4.2.4                       |4.2.4 4.4.0
            Summary|[4.3/4.4 Regression] Missing|[4.3 Regression] Missing
                   |@PLT when -fpie is used     |@PLT when -fpie is used


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (19 preceding siblings ...)
  2009-01-30 20:50 ` [Bug target/39013] [4.3 " jakub at gcc dot gnu dot org
@ 2009-01-30 22:59 ` zorry at ume dot nu
  2009-02-21 13:15 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: zorry at ume dot nu @ 2009-01-30 22:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from zorry at ume dot nu  2009-01-30 22:59 -------
Created an attachment (id=17218)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17218&action=view)
fixed for gcc 4.3.3

Thanx for the help
The patch fix the error i have.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (20 preceding siblings ...)
  2009-01-30 22:59 ` zorry at ume dot nu
@ 2009-02-21 13:15 ` rguenth at gcc dot gnu dot org
  2009-03-31  2:38 ` zorry at ume dot nu
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-21 13:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (21 preceding siblings ...)
  2009-02-21 13:15 ` rguenth at gcc dot gnu dot org
@ 2009-03-31  2:38 ` zorry at ume dot nu
  2009-06-18 14:50 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: zorry at ume dot nu @ 2009-03-31  2:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from zorry at ume dot nu  2009-03-31 02:37 -------
Created an attachment (id=17565)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17565&action=view)
Got ICE when compile some code with the old patch.

See http://bugs.gentoo.org/show_bug.cgi?id=262567 for ICE
when compiling.


-- 

zorry at ume dot nu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17218|0                           |1
        is obsolete|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (22 preceding siblings ...)
  2009-03-31  2:38 ` zorry at ume dot nu
@ 2009-06-18 14:50 ` rguenth at gcc dot gnu dot org
  2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
  2009-06-19 12:24 ` rguenth at gcc dot gnu dot org
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-18 14:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from rguenth at gcc dot gnu dot org  2009-06-18 14:50 -------
Testing a backport.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jakub at gcc dot gnu dot org|rguenth at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (23 preceding siblings ...)
  2009-06-18 14:50 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
  2009-06-19 12:24 ` rguenth at gcc dot gnu dot org
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from rguenth at gcc dot gnu dot org  2009-06-19 12:23 -------
Subject: Bug 39013

Author: rguenth
Date: Fri Jun 19 12:23:16 2009
New Revision: 148700

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148700
Log:
2009-06-19  Richard Guenther  <rguenther@suse.de>

        Backport from mainline:
        2009-04-22  Jakub Jelinek  <jakub@redhat.com>

        PR c/39855
        * fold-const.c (fold_binary) <case LSHIFT_EXPR>: When optimizing
        into 0, use omit_one_operand.

        * gcc.dg/torture/pr39855.c: New test.

        2009-01-30  Jakub Jelinek  <jakub@redhat.com>

        PR target/39013
        * c-decl.c (pop_scope): Set DECL_EXTERNAL for functions declared
        inline but never defined.

        * gcc.target/i386/pr39013-1.c: New test.
        * gcc.target/i386/pr39013-2.c: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/torture/pr39855.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr39013-1.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/i386/pr39013-2.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-decl.c
    branches/gcc-4_3-branch/gcc/fold-const.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

* [Bug target/39013] [4.3 Regression] Missing @PLT when -fpie is used
  2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
                   ` (24 preceding siblings ...)
  2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
@ 2009-06-19 12:24 ` rguenth at gcc dot gnu dot org
  25 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-19 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from rguenth at gcc dot gnu dot org  2009-06-19 12:24 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|4.2.4 4.4.0                 |4.2.4 4.3.4 4.4.0
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013


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

end of thread, other threads:[~2009-06-19 12:24 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28 22:11 [Bug c/39013] New: Compiler miss to add @PLT to symbols when object is compile with -fPIE -pie zorry at ume dot nu
2009-01-28 22:17 ` [Bug target/39013] " zorry at ume dot nu
2009-01-29  0:47 ` [Bug target/39013] [4.3/4.4 regression] @PLT is missing on failed inline function when -fpie is used hjl dot tools at gmail dot com
2009-01-29  0:48 ` hjl dot tools at gmail dot com
2009-01-29  0:50 ` pinskia at gcc dot gnu dot org
2009-01-29  0:52 ` pinskia at gcc dot gnu dot org
2009-01-29  0:58 ` pinskia at gcc dot gnu dot org
2009-01-29  1:13 ` hjl dot tools at gmail dot com
2009-01-29  1:46 ` hjl dot tools at gmail dot com
2009-01-29  4:04 ` [Bug target/39013] [4.3/4.4 regression] Missing @PLT " hjl dot tools at gmail dot com
2009-01-29  9:56 ` [Bug c/39013] " rguenth at gcc dot gnu dot org
2009-01-29  9:56 ` rguenth at gcc dot gnu dot org
2009-01-29 15:03 ` [Bug target/39013] " zorry at ume dot nu
2009-01-29 15:20 ` [Bug target/39013] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2009-01-29 15:52 ` hjl dot tools at gmail dot com
2009-01-29 15:53 ` hjl dot tools at gmail dot com
2009-01-29 18:24 ` zorry at ume dot nu
2009-01-30 17:32 ` jakub at gcc dot gnu dot org
2009-01-30 20:32 ` jakub at gcc dot gnu dot org
2009-01-30 20:47 ` jakub at gcc dot gnu dot org
2009-01-30 20:50 ` [Bug target/39013] [4.3 " jakub at gcc dot gnu dot org
2009-01-30 22:59 ` zorry at ume dot nu
2009-02-21 13:15 ` rguenth at gcc dot gnu dot org
2009-03-31  2:38 ` zorry at ume dot nu
2009-06-18 14:50 ` rguenth at gcc dot gnu dot org
2009-06-19 12:23 ` rguenth at gcc dot gnu dot org
2009-06-19 12:24 ` rguenth at gcc dot gnu dot 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).