User account creation filtered due to spam.

Bug 28781 - -fPIC generates non-PIC code
Summary: -fPIC generates non-PIC code
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-19 20:18 UTC by bero
Modified: 2006-12-13 09:37 UTC (History)
3 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build: x86_64-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bero 2006-08-19 20:18:02 UTC
This happens when compiling arts (KDE sound server) 1.5.4:

/usr/bin/ld: ./flow/gslpp/.libs/libgslpp.a(datahandle.o): relocation R_X86_64_PC32 against `vtable for GSL::WaveDataHandle' can not be used when making a shared object; recompile with -fPIC

However, libgslpp.a and datahandle.o were built using -fPIC.

This is the extract of the build log for building datahandle.o and libgslpp.a:

g++ -DHAVE_CONFIG_H -I../../flow/gslpp -I/usr/src/ark/BUILD/arts/flow/gslpp -I../.. -I/usr/src/ark/BUILD/arts/flow -I/usr/src/ark/BUILD/arts/flow/gsl -I../../flow -I/usr/src/ark/BUILD/arts/mcop -I../../mcop -I../.. -I/usr/include/kde -I/usr/lib64/qt3-gcc4.1/include -I. -I/usr/src/ark/BUILD/arts/libltdl -DQT_THREAD_SUPPORT -D_REENTRANT -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -O2 -fomit-frame-pointer -fweb -frename-registers -fPIC -fno-exceptions -fno-check-new -fvisibility=hidden -fvisibility-inlines-hidden -D_GNU_SOURCE -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -ftemplate-depth-99 -fPIC -DPIC -c /usr/src/ark/BUILD/arts/flow/gslpp/datahandle.cpp -o ../../flow/gslpp/.libs/datahandle.o -Wp,-MD,../../flow/gslpp/.deps/datahandle.TUlo
/bin/sh ../../libtool --silent --mode=link --tag=CXX g++ -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -O2 -fomit-frame-pointer -fweb -frename-registers -fPIC -fno-exceptions -fno-check-new -fvisibility=hidden -fvisibility-inlines-hidden -D_GNU_SOURCE -Wformat-security -Wmissing-format-attribute -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -fvisibility=hidden -fvisibility-inlines-hidden -ftemplate-depth-99 -DQT_THREAD_SUPPORT -D_REENTRANT -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -o ../../flow/gslpp/libgslpp.la ../../flow/gslpp/datahandle.lo

This worked correctly before; binutils version is 2.17.50.0.3 (just in case this is a binutils bug that just happened not to show up with earlier gccs).
Comment 1 Martin Michlmayr 2006-08-19 23:01:20 UTC
This works for me with gcc 4.2.0 20060810 or 4.2.0 20060819 and binutils
2.17-2.  Can you try to downgrade binutils to see if it works then?

Comment 2 Andrew Pinski 2006-08-20 00:23:42 UTC
Can you stop using HJL's special non FSF binutils?  Can you try with a real snapshot of the FSF binutils before reporting bugs like this?
Comment 3 Andrew Pinski 2006-09-12 08:10:15 UTC
/usr/bin/ld: ./flow/gslpp/.libs/libgslpp.a(datahandle.o): relocation
R_X86_64_PC32 against `vtable for GSL::WaveDataHandle' can not be used when
making a shared object; recompile with -fPIC

This looks more like a binutils issue as I think the vtable has been marked as hidden which means it can bind local which is what is happening here so this is a non bug unless someone can come up with a testcase or show the code to what the class definition of the above class looks like.

And I doubt this is a regression also, more like a progression :).
Comment 4 H.J. Lu 2006-09-12 14:49:08 UTC
This may be related to

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

Please provide

# readelf -s --wide ./flow/gslpp/.libs/libgslpp.a | c++filt| grep "vtable for GSL::WaveDataHandle"
Comment 5 Andrew Pinski 2006-12-13 09:37:26 UTC
No testcase in 3 months so closing.