Project

General

Profile

Actions

Bug #2559

closed

gcc -pie and __builtin_popcount causes

Added by akr over 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05/13/2013
Due date:
% Done:

0%

Estimated time:

Description

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 :/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

Actions

Also available in: Atom PDF