Project

General

Profile

Actions

Bug #7606

closed

gcc -pie configure check is broken for OpenBSD/amd64

Added by kernigh (George Koehler) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2012-12-23 trunk 38563) [x86_64-openbsd5.2]
Backport:
[ruby-core:51082]

Description

=begin
I can use PIE if I compile with gcc -fPIE and link with gcc -pie. Ruby's configure script tries to enable PIE, but the check for gcc -pie says "no". I expected "yes". My system runs OpenBSD 5.2 for amd64. My compiler is the default gcc 4.2.1.

The problem is it forgot to use -fPIE when checking -pie. Here is the relevant part of config.log:

configure:17900: checking whether -pie is accepted as LDFLAGS
configure:17922: gcc -o conftest -O3 -fno-fast-math -ggdb3 -ansi -std=iso9899:199409 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -I/usr/local/include -L/usr/local/lib -fstack-protector -Wl,-E -pie conftest.c -pthread -lm >&5
/usr/bin/ld: /tmp//ccYa9wrA.o: relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/tmp//ccYa9wrA.o: could not read symbols: Bad value
collect2: ld returned 1 exit status

I am attaching a patch (pie-check.diff) to solve this problem. I use -fPIE during the check for gcc -pie. I also add -fPIE to XCFLAGS only when adding -pie (or -Wl,-pie) to XLDFLAGS. With this patch, the check says "yes" and I see -pie in XLDFLAGS.
=end


Files

config.log (789 KB) config.log config.log with failed -pie check kernigh (George Koehler), 12/23/2012 10:48 AM
pie-check.diff (815 Bytes) pie-check.diff git diff, patching configure.in kernigh (George Koehler), 12/23/2012 10:48 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0