Bug 192152 - linker doesn't fail on undefined references when using -pie
linker doesn't fail on undefined references when using -pie
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: binutils (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-17 18:02 EDT by James Ralston
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: 2007-10-19 14:44:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Ralston 2006-05-17 18:02:17 EDT
With gcc-3.2.3-54, if -pie is passed to the linker, undefined references aren't
treated as fatal errors.

To illustrate the problem:

$ cat test.c
int main (int argc, char *argv[]) {
  this_function_does_not_exist();
  return (0);
}

$ gcc -Wall -fPIE -pie -o test test.c; echo "retval = $?"
test.c: In function `main':
test.c:2: warning: implicit declaration of function `this_function_does_not_exist'
/tmp/qralston-T28960/ccgIf4dV.o(.text+0x1e): In function `main':
: undefined reference to `this_function_does_not_exist'
retval = 0

This is wrong; the linker should have returned 1, which is what happens if
"-fPIE -pie" isn't used:

$ gcc -Wall -o test test.c; echo "retval = $?"
test.c: In function `main':
test.c:2: warning: implicit declaration of function `this_function_does_not_exist'
/tmp/qralston-T28960/ccMsN3ck.o(.text+0x11): In function `main':
: undefined reference to `this_function_does_not_exist'
collect2: ld returned 1 exit status
retval = 1

This is a big problem for configure, which relies on the linker treating
undefined references in order to determine which functions are present.

Recent versions of gcc (RHEL4 and FC5) don't exhibit this problem, so I'm
guessing that this bug was found and squashed in more recent versions of gcc.  A
backport for RHEL3 would be appreciated if one is feasible.
Comment 2 RHEL Product and Program Management 2007-10-19 14:44:01 EDT
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
 
For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/
 
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.

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