Bug 214464 - gcc should compile crtbeginT.o w/ fPIC on Intel 64 (x86_64)
gcc should compile crtbeginT.o w/ fPIC on Intel 64 (x86_64)
Status: CLOSED DUPLICATE of bug 214465
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc4 (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-07 14:11 EST by Jeff Sullivan
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-11-07 15:44:26 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jeff Sullivan 2006-11-07 14:11:27 EST
Description of problem:

gcc should compile crtbeginT.o w/ fPIC on Intel 64 to avoid following problem -
 seen when using icc -fast to create a shared library (that example below).

This works:

$ gcc -static -fpic scale.c -o libscale.so -shared -m32

This fails:

$ gcc -static -fpic scale.c -o libscale.so -shared -m64
/usr/bin/ld: /opt/spdtools/compiler/ia32e/gcc-4.1.0/lib/gcc/x86_64-unknown-
linux-gnu/4.1.0/crtbeginT.o: relocation R_X86_64_32 can not be used when 
making a shared object; recompile with -fPIC
/opt/spdtools/compiler/ia32e/gcc-4.1.0/lib/gcc/x86_64-unknown-linux-
gnu/4.1.0/crtbeginT.o: could not read symbols: Bad value
collect2: ld returned 1 exit status


Version-Release number of selected component (if applicable):

$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.1.0/configure --
prefix=/opt/spdtools/compiler/ia32e/gcc-4.1.0
Thread model: posix
gcc version 4.1.0


How reproducible:

I was able to reproduce this problem with gcc 3.2.3 and 4.0.0 on x86_64. I did 
not see the problem using gcc 4.1.0.  

Steps to Reproduce:

1. Copy test case (below) to an x86_64 machine
2. Compile the test case: gcc -static -fpic scale.c -o libscale.so -shared -m64
3. Look for error message
  
Actual results:

// Fails with -m64

% gcc40 -static -fpic scale.c -o libscale.so -shared -m64
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.1.0/crtbeginT.o: relocation 
R_X86_64_32 against `__deregister_frame_info' can not be used when making a 
shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.1.0/crtbeginT.o: could not read symbols: Bad
value
collect2: ld returned 1 exit status 

Expected results:

// Works with -m32
% gcc40 -static -fpic scale.c -o libscale.so -shared -m32
%

Additional info:

Here's the test case:

% cat scale.c
#include <stdio.h>

int scale(int val)
{
  const int scalefactor = 999;
  int i= scalefactor * val;
  printf("scalefactor=%i. val=%i. i=%i \n", scalefactor, val, i);
  return i;
}
Comment 1 Jakub Jelinek 2006-11-07 15:44:26 EST

*** This bug has been marked as a duplicate of 214465 ***

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