qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: xen-devel@lists.xensource.com,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	1257099@bugs.launchpad.net, Don Slutz <dslutz@verizon.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Bug 1257099] [NEW] QEMU fails to build on CentOS 5.10 with relocation R_X86_64_PC32 error
Date: Sat, 7 Dec 2013 08:27:51 -0500	[thread overview]
Message-ID: <52A32257.2000001@terremark.com> (raw)
In-Reply-To: <52A09933.5090302@redhat.com>

On 12/05/13 10:18, Paolo Bonzini wrote:
> Il 04/12/2013 02:32, Don Slutz ha scritto:
>> Any hints or pointers about the bug in RHEL5 binutils?  I can try and
>> make a patch to auto detect this.
> Actually it's RHEL5 GCC:
>
> $ cat f.c
> void *
> f(unsigned char *buf, int len)
> {
>      return (void*)0L;
> }
>
>
> void *
> g(unsigned char *buf, int len)
> {
>      return f(buf, len);
> }
> $ 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
>
> On RHEL5:
> $ gcc -S -o - f.c -fPIE -fPIC |grep call
> 	call	f
>
> On RHEL6:
> $ gcc -S -o - f.c -fPIE -fPIC |grep call
> 	call	f@PLT
>
> Paolo
RHEL5 also "works" if you add -pie:

dcs-xen-53:~/tmp>gcc -shared -o f.so f.c -fPIE -fPIC
/usr/bin/ld: /tmp/cc6pp1n2.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
dcs-xen-53:~/tmp>gcc -shared -o f.so f.c -fPIE -fPIC -pie
dcs-xen-53:~/tmp>gcc -S -o - f.c -fPIE -pie|grep call
         call    f

I have not figured out a way to take advantage of this.

I just checked and Fedora 17 has the same issue with gcc:
FC17:
dcs-xen-52:~/tmp>gcc -S -o - f.c -fPIE -fPIC |grep call
         call    f
dcs-xen-52:~/tmp>gcc -shared -o f.so f.c -fPIE -fPIC
/usr/bin/ld: /tmp/ccUlVgMP.o: relocation R_X86_64_PC32 against symbol 
`f' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

However QEMU builds just fine.  So it is looking like libtool is also 
part of the problem.

    -Don Slutz

  parent reply	other threads:[~2013-12-07 13:28 UTC|newest]

Thread overview: 16+ 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 14:06   ` Paolo Bonzini
2013-12-03 20:19     ` Don Slutz
2013-12-03 17:15   ` Paolo Bonzini
2013-12-04  1:32 ` Don Slutz
2013-12-05 15:18   ` Paolo Bonzini
2013-12-05 19:09     ` Don Slutz
2013-12-05 21:24     ` Richard Henderson
2013-12-06  3:20       ` Don Slutz
2013-12-09 12:47         ` Don Slutz
2013-12-09 13:22           ` Paolo Bonzini
2013-12-14 20:21             ` Don Slutz
2013-12-15 16:01               ` Don Slutz
2013-12-07 13:27     ` Don Slutz [this message]
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=52A32257.2000001@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).