https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91744
Bug ID: 91744
Summary: -fno-pie is not honored
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: noloader at gmail dot com
Target Milestone: ---
From Initial SUPERCOP Haswell results for round 2
(https://groups.google.com/a/list.nist.gov/d/msg/pqc-forum/kiMo-1jBwDI/KS8VtDwWAgAJ):
$ cat x.c
#include <stdio.h>
extern int thenumber(void);
int main() { printf("%d\n",thenumber()); return 0; }
$ cat y.c
static int myconstant = 5;
int thenumber(void) { return myconstant; }
And then:
$ gcc -c x.c; clang -c y.c; gcc -o x x.o y.o
/usr/bin/ld: y.o: relocation R_X86_64_32S against `.data' can not be used when
making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
And finally with -fno-pie:
$ gcc -c x.c; clang -c y.c; gcc -fno-pie -o x x.o y.o
/usr/bin/ld: y.o: relocation R_X86_64_32S against `.data' can not be used when
making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status