Bug 512937 - Invalid STT_GNU_IFUNC SHN_UNDEF symbols
Summary: Invalid STT_GNU_IFUNC SHN_UNDEF symbols
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: rawhide
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
: 512078 (view as bug list)
Depends On:
Blocks: F12Blocker, F12FinalBlocker
TreeView+ depends on / blocked
 
Reported: 2009-07-21 12:37 UTC by Jakub Jelinek
Modified: 2009-07-22 17:36 UTC (History)
7 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2009-07-22 08:37:33 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 10426 None None None Never

Description Jakub Jelinek 2009-07-21 12:37:11 UTC
Description of problem:

2.19.51.0.11-24.fc12 ld creates STT_GNU_IFUNC SHN_UNDEF symbols.

How reproducible:

extern __SIZE_TYPE__ strlen (const char *);

int
foo (const char *p)
{
  return strlen (p);
}

gcc -shared -fpic -o /tmp/x.so /tmp/x.c
readelf -Ws /tmp/x.so | grep IFUNC
     4: 0000000000000000     0 IFUNC   GLOBAL DEFAULT  UND strlen@GLIBC_2.2.5 (2)
    47: 0000000000000000     0 IFUNC   GLOBAL DEFAULT  UND strlen@@GLIBC_2.2.5

Haven't checked trunk binutils.

STT_GNU_IFUNC should be used solely on symbol definitions, not when a symbol is undefined.  Whether it will bind to STT_GNU_IFUNC or normal STT_FUNC is unclear at runtime, and STT_FUNC should be used.

It would be very good if this could be fixed before the mass rebuild starts (I believe 2009-07-23).

Comment 1 Jakub Jelinek 2009-07-21 15:47:58 UTC
*** Bug 512078 has been marked as a duplicate of this bug. ***

Comment 2 Jakub Jelinek 2009-07-21 16:08:07 UTC
Here is a reproducer in the binutils tree:
BINUTILS_OBJ=/usr/src/binutils/obj
BINUTILS_SRC=/usr/src/binutils
gcc  -B$BINUTILS_OBJ/ld/tmpdir/gas/ -I$BINUTILS_SRC/ld/testsuite/ld-ifunc -g -O2 \
  -c -fPIC -DWITH_IFUNC -c $BINUTILS_SRC/ld/testsuite/ld-ifunc/lib.c \
  -o shared_ifunc.o
$BINUTILS_OBJ/ld/ld-new  -o libshared_ifunc.so -shared shared_ifunc.o
echo 'extern int library_func2 (void);' > test.c
echo 'int main (void) { library_func2 (); return 0; }' >> test.c
gcc -B $BINUTILS_OBJ/ld/tmpdir/ld/ -o test test.c ./libshared_ifunc.so
$BINUTILS_OBJ/binutils/readelf -Ws test | grep IFUNC.*UND
echo 'extern int library_func2 (void);' > test2.c
echo 'int (*fn) (void) = library_func2;' >> test2.c
echo 'int main (void) { fn (); return 0; }' >> test2.c
gcc -B $BINUTILS_OBJ/ld/tmpdir/ld/ -o test2 test2.c ./libshared_ifunc.so
$BINUTILS_OBJ/binutils/readelf -Ws test2 | grep IFUNC.*UND

test2 is what is fatal for gnome-panel, but both cases are wrong, no SHN_UNDEF symbols should be ever STT_GNU_IFUNC, the should be STT_FUNC instead.

Comment 3 H.J. Lu 2009-07-21 22:16:59 UTC
It is fixed in the Linux binutils 2.19.51.0.13.

Comment 4 Ulrich Drepper 2009-07-21 22:38:48 UTC
Thanks, HJ.

NickC, please build a new RPM right away.  We need it for the mass rebuild.

Comment 5 Nick Clifton 2009-07-22 08:37:33 UTC
New RPMS should be ready: binutils-2.19.51.0.13-28.fc12.src.rpm

Cheers
  Nick

Comment 6 H.J. Lu 2009-07-22 17:36:16 UTC
The current linker may be broken:

http://sourceware.org/ml/binutils/2009-07/msg00220.html


Note You need to log in before you can comment on or make changes to this bug.