DragonFly BSD
DragonFly bugs List (threaded) for 2013-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[DragonFlyBSD - Bug #2559] gcc -pie and __builtin_popcount causes


From: Alex Hornung via Redmine <bugtracker-admin@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 May 2013 02:46:06 -0700

Issue #2559 has been updated by alexh.


This is not a bug. The compiler is telling you what do to: use -fPIC.

On 2013-05-14 10:05, John Marino via Redmine wrote:
> Issue #2559 has been updated by marino.
>
>
> Using your program, I see the same error with:
> * system gcc 4.4
> * dports gcc-aux version 4.7
>
> The latter is particularly telling because it's built with vendor 
> makefiles.
> Which means it's not a compiler problem but more likely a crt* stuff 
> problem.
> ----------------------------------------
> Bug #2559: gcc -pie and __builtin_popcount causes
> http://bugs.dragonflybsd.org/issues/2559
>
> Author: akr
> Status: New
> Priority: Normal
> Assignee:
> Category:
> Target version:
>
>
> I found that __builtin_popcount is not usable with -pie option for 
> gcc.
>
> $ uname -a
> DragonFly dragonfly34 3.4-RELEASE DragonFly v3.4.1-RELEASE #7: Wed
> Apr 24 20:01:27 PDT 2013
> 
> root@pkgbox64.dragonflybsd.org:/usr/obj/build/home/justin/src/sys/X86_64_GENERIC
>  x86_64
> $ cat tst.c
> #include <stdio.h>
> int main(int argc, char *argv[])
> {
>   printf("%d\n", __builtin_popcount(argc));
>   return 0;
> }
> $ gcc -pie tst.c
> /usr/libexec/binutils222/elf/ld.bfd: /tmp//cc2Tj2Mb.o: relocation
> R_X86_64_32 against `.rodata' can not be used when making a shared
> object; recompile with -fPIC
> /tmp//cc2Tj2Mb.o: could not read symbols: Bad value
----------------------------------------
Bug #2559: gcc -pie and __builtin_popcount causes 
http://bugs.dragonflybsd.org/issues/2559

Author: akr
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 


I found that __builtin_popcount is not usable with -pie option for gcc.

$ uname -a
DragonFly dragonfly34 3.4-RELEASE DragonFly v3.4.1-RELEASE #7: Wed Apr 24 20:01:27 PDT 2013     root@pkgbox64.dragonflybsd.org:/usr/obj/build/home/justin/src/sys/X86_64_GENERIC  x86_64
$ cat tst.c
#include <stdio.h>
int main(int argc, char *argv[])
{
  printf("%d\n", __builtin_popcount(argc));
  return 0;
}
$ gcc -pie tst.c
/usr/libexec/binutils222/elf/ld.bfd: /tmp//cc2Tj2Mb.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/tmp//cc2Tj2Mb.o: could not read symbols: Bad value




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]