This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/30153] -fPIC failure



------- Comment #2 from price at ifa dot hawaii dot edu  2007-05-17 03:19 -------
This is also a problem on my amd64 Gentoo laptop, using gcc version Gentoo
4.1.1-r3.

I searched the binutils Bugzilla, but could not find a bug filed for this
problem.

Because the problem disappears when optimisation is turned on, the following
line from the docs for gcc caught my eye: "GCC does not inline any functions
when not optimizing unless you specify the `always_inline' attribute for the
function".  So I tried:

price@neverland:/home/price/test>cat static_inline.c 
static void foo (void) __attribute__((always_inline));
static inline void foo (void) { }
void baz (void (*f) (void));
void bar (void) { baz (foo); }
price@neverland:/home/price/test>gcc -O0 -g -c -fPIC static_inline.c
price@neverland:/home/price/test>gcc -shared -o static_inline.so
static_inline.o 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
warning: creating a DT_TEXTREL in object.
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
static_inline.o: relocation R_X86_64_PC32 against `foo' can not be used when
making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
final link failed: Bad value
collect2: ld returned 1 exit status


Should I take this bug over to binutils?


-- 

price at ifa dot hawaii dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |price at ifa dot hawaii dot
                   |                            |edu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]