Bug #7606

gcc -pie configure check is broken for OpenBSD/amd64

Added by George Koehler over 1 year ago. Updated over 1 year ago.

[ruby-core:51082]
Status:Closed
Priority:High
Assignee:Motohiro KOSAKI
Category:build
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-12-23 trunk 38563) [x86_64-openbsd5.2] Backport:

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 RX8664_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

config.log - config.log with failed -pie check (789 KB) George Koehler, 12/23/2012 10:48 AM

pie-check.diff Magnifier - git diff, patching configure.in (815 Bytes) George Koehler, 12/23/2012 10:48 AM

Associated revisions

Revision 38619
Added by Motohiro KOSAKI over 1 year ago

  • configure.in: enable -fPIE when checking -pie for fixing OpenBSD build error. Patch by George Koehler. Thank you! [Bug #7606]

History

#1 Updated by Motohiro KOSAKI over 1 year ago

  • Category set to build
  • Status changed from Open to Assigned
  • Assignee set to Motohiro KOSAKI
  • Priority changed from Low to High
  • Target version set to 2.0.0

I don't think OpenBSD support is low priority.

#2 Updated by Motohiro KOSAKI over 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38619.
George, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • configure.in: enable -fPIE when checking -pie for fixing OpenBSD build error. Patch by George Koehler. Thank you! [Bug #7606]

Also available in: Atom PDF