All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Richard Henderson <rth@twiddle.net>
Cc: xen-devel@lists.xensource.com,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	qemu-devel@nongnu.org, Don Slutz <dslutz@verizon.com>,
	1257099@bugs.launchpad.net, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [Bug 1257099] [NEW] QEMU fails to build on CentOS 5.10 with relocation R_X86_64_PC32 error
Date: Mon, 9 Dec 2013 07:47:34 -0500	[thread overview]
Message-ID: <52A5BBE6.9070000@terremark.com> (raw)
In-Reply-To: <52A1427D.6000307@terremark.com>

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

On 12/05/13 22:20, Don Slutz wrote:
> On 12/05/13 16:24, Richard Henderson wrote:
>> On 12/06/2013 04:18 AM, Paolo Bonzini wrote:
>>> $ gcc -shared -o f.so f.c -fPIE -fPIC
>>> /usr/bin/ld: /tmp/ccQc9els.o: relocation R_X86_64_PC32 against `f' 
>>> can not be used when making a shared object; recompile with -fPIC
>>> /usr/bin/ld: final link failed: Bad value
>>> collect2: ld returned 1 exit status
>>>
>>>
>>> The bug is simply that "-fPIE -fPIC" counts as -fPIE rather than -fPIC:
>>>
>>> $ gcc -S -o - f.c -fPIE |grep call
>>>     call    f                      # PC32 relocation
>>> $ gcc -S -o - f.c -fPIC |grep call
>>>     call    f@PLT                  # PLT32 relocation
>> The easy workaround is to drop -fPIE when we're adding -fPIC.
>>
>>
>> r~
[snip]

Attached is a much better version.  It drops -fPIE and adds -fPIC for 
libtool.

    -Don Slutz

[-- Attachment #2: 0001-configure-Switch-libtool-from-fPIE-to-fPIC-bug-12570.patch --]
[-- Type: text/x-patch, Size: 2111 bytes --]

>From 82bc02f2bd5e02e341f9c86c9915707dc4edb778 Mon Sep 17 00:00:00 2001
From: Don Slutz <dslutz@verizon.com>
Date: Sat, 7 Dec 2013 17:33:52 +0000
Subject: [PATCH] configure: Switch libtool from -fPIE to -fPIC (bug #1257099)

Add new config-host variable LIBTOOL_CFLAGS

Signed-off-by: Don Slutz <dslutz@verizon.com>
---
 configure | 2 ++
 rules.mak | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 18fa608..7d32364 100755
--- a/configure
+++ b/configure
@@ -4113,11 +4113,13 @@ echo "WINDRES=$windres" >> $config_host_mak
 echo "LIBTOOL=$libtool" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
+echo "LIBTOOL_CFLAGS="$(echo $QEMU_CFLAGS | sed -e 's/-fPIE -DPIE/-fPIC -DPIC/') >>$config_host_mak
 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
 if test "$sparse" = "yes" ; then
   echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
   echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
+  echo "LIBTOOL_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
 fi
 if test "$cross_prefix" != ""; then
   echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
diff --git a/rules.mak b/rules.mak
index 4499745..e4dea9c 100644
--- a/rules.mak
+++ b/rules.mak
@@ -29,7 +29,7 @@ LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
 else
 LIBTOOL += $(if $(V),,--quiet)
 %.lo: %.c
-	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
+	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(LIBTOOL_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
 %.lo: %.rc
 	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=RC $(WINDRES) -I. -o $@ $<,"lt RC   $(TARGET_DIR)$@")
 %.lo: %.dtrace
-- 
1.7.11.7


WARNING: multiple messages have this Message-ID (diff)
From: Don Slutz <dslutz@verizon.com>
To: Richard Henderson <rth@twiddle.net>
Cc: xen-devel@lists.xensource.com,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	qemu-devel@nongnu.org, Don Slutz <dslutz@verizon.com>,
	1257099@bugs.launchpad.net, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Bug 1257099] [NEW] QEMU fails to build on CentOS 5.10 with relocation R_X86_64_PC32 error
Date: Mon, 9 Dec 2013 07:47:34 -0500	[thread overview]
Message-ID: <52A5BBE6.9070000@terremark.com> (raw)
In-Reply-To: <52A1427D.6000307@terremark.com>

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

On 12/05/13 22:20, Don Slutz wrote:
> On 12/05/13 16:24, Richard Henderson wrote:
>> On 12/06/2013 04:18 AM, Paolo Bonzini wrote:
>>> $ gcc -shared -o f.so f.c -fPIE -fPIC
>>> /usr/bin/ld: /tmp/ccQc9els.o: relocation R_X86_64_PC32 against `f' 
>>> can not be used when making a shared object; recompile with -fPIC
>>> /usr/bin/ld: final link failed: Bad value
>>> collect2: ld returned 1 exit status
>>>
>>>
>>> The bug is simply that "-fPIE -fPIC" counts as -fPIE rather than -fPIC:
>>>
>>> $ gcc -S -o - f.c -fPIE |grep call
>>>     call    f                      # PC32 relocation
>>> $ gcc -S -o - f.c -fPIC |grep call
>>>     call    f@PLT                  # PLT32 relocation
>> The easy workaround is to drop -fPIE when we're adding -fPIC.
>>
>>
>> r~
[snip]

Attached is a much better version.  It drops -fPIE and adds -fPIC for 
libtool.

    -Don Slutz

[-- Attachment #2: 0001-configure-Switch-libtool-from-fPIE-to-fPIC-bug-12570.patch --]
[-- Type: text/x-patch, Size: 2111 bytes --]

>From 82bc02f2bd5e02e341f9c86c9915707dc4edb778 Mon Sep 17 00:00:00 2001
From: Don Slutz <dslutz@verizon.com>
Date: Sat, 7 Dec 2013 17:33:52 +0000
Subject: [PATCH] configure: Switch libtool from -fPIE to -fPIC (bug #1257099)

Add new config-host variable LIBTOOL_CFLAGS

Signed-off-by: Don Slutz <dslutz@verizon.com>
---
 configure | 2 ++
 rules.mak | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 18fa608..7d32364 100755
--- a/configure
+++ b/configure
@@ -4113,11 +4113,13 @@ echo "WINDRES=$windres" >> $config_host_mak
 echo "LIBTOOL=$libtool" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
+echo "LIBTOOL_CFLAGS="$(echo $QEMU_CFLAGS | sed -e 's/-fPIE -DPIE/-fPIC -DPIC/') >>$config_host_mak
 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
 if test "$sparse" = "yes" ; then
   echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
   echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
+  echo "LIBTOOL_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
 fi
 if test "$cross_prefix" != ""; then
   echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
diff --git a/rules.mak b/rules.mak
index 4499745..e4dea9c 100644
--- a/rules.mak
+++ b/rules.mak
@@ -29,7 +29,7 @@ LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
 else
 LIBTOOL += $(if $(V),,--quiet)
 %.lo: %.c
-	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
+	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(LIBTOOL_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  lt CC $@")
 %.lo: %.rc
 	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=RC $(WINDRES) -I. -o $@ $<,"lt RC   $(TARGET_DIR)$@")
 %.lo: %.dtrace
-- 
1.7.11.7


  reply	other threads:[~2013-12-09 12:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 22:36 [Qemu-devel] [Bug 1257099] [NEW] QEMU fails to build on CentOS 5.10 with relocation R_X86_64_PC32 error Don Slutz
2013-12-03 13:25 ` Stefano Stabellini
2013-12-03 13:25   ` Stefano Stabellini
2013-12-03 14:06   ` [Qemu-devel] " Paolo Bonzini
2013-12-03 14:06     ` Paolo Bonzini
2013-12-03 20:19     ` [Qemu-devel] " Don Slutz
2013-12-03 20:19       ` Don Slutz
2013-12-03 17:15   ` [Qemu-devel] " Paolo Bonzini
2013-12-03 17:15     ` Paolo Bonzini
2013-12-04  1:32 ` [Qemu-devel] " Don Slutz
2013-12-04  1:32   ` Don Slutz
2013-12-05 15:18   ` Paolo Bonzini
2013-12-05 15:18     ` Paolo Bonzini
2013-12-05 19:09     ` [Qemu-devel] " Don Slutz
2013-12-05 19:09       ` Don Slutz
2013-12-05 21:24     ` [Qemu-devel] " Richard Henderson
2013-12-05 21:24       ` Richard Henderson
2013-12-06  3:20       ` [Qemu-devel] " Don Slutz
2013-12-06  3:20         ` Don Slutz
2013-12-09 12:47         ` Don Slutz [this message]
2013-12-09 12:47           ` Don Slutz
2013-12-09 13:22           ` [Qemu-devel] " Paolo Bonzini
2013-12-09 13:22             ` Paolo Bonzini
2013-12-14 20:21             ` [Qemu-devel] " Don Slutz
2013-12-14 20:21               ` Don Slutz
2013-12-15 16:01               ` [Qemu-devel] " Don Slutz
2013-12-15 16:01                 ` Don Slutz
2013-12-07 13:27     ` [Qemu-devel] " Don Slutz
2013-12-07 13:27       ` Don Slutz
2016-09-28 14:56 ` [Qemu-devel] [Bug 1257099] " T. Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A5BBE6.9070000@terremark.com \
    --to=dslutz@verizon.com \
    --cc=1257099@bugs.launchpad.net \
    --cc=Ian.Campbell@citrix.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.