Bug 214464 - gcc should compile crtbeginT.o w/ fPIC on Intel 64 (x86_64)
Summary: gcc should compile crtbeginT.o w/ fPIC on Intel 64 (x86_64)
Keywords:
Status: CLOSED DUPLICATE of bug 214465
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc4
Version: 4.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-07 19:11 UTC by Jeff Sullivan
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-11-07 20:44:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jeff Sullivan 2006-11-07 19:11:27 UTC
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 20:44:26 UTC

*** 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.