Package: libc0.1-dev Version: 2.22-6 Severity: normal User: debian-bsd@lists.debian.org Usertags: kfreebsd
Hi, It seems that ever since Bug #430455, dpkg-buildflags thinks kfreebsd does not support Position-Independent Executable, so does not enable it even if specifically requested with DEB_BUILD_MAINT_OPTIONS=hardening=+pie Fixing dpkg-dev's /usr/share/perl5/Dpkg/Vendor/Debian.pm to permit use of PIC on kfreebsd, still doesn't enable it by default. Trying to compile+link anything as PIE, actually seems to fail at the moment: $ cc -fPIE -Wl,-pie -o foo foo.c /usr/bin/ld: /usr/lib/gcc/x86_64-kfreebsd-gnu/5/../../../x86_64-kfreebsd-gnu/crt1.o: relocation R_X86_64_32S against `__libc_csu_fini' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-kfreebsd-gnu/5/../../../x86_64-kfreebsd-gnu/crt1.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status The C runtime has been compiled as relocatable code, not PIC: $ file /usr/lib/x86_64-kfreebsd-gnu/crt1.o /usr/lib/x86_64-kfreebsd-gnu/crt1.o: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), for GNU/kFreeBSD 8.3.0, not stripped Is that the right file to link with, or should it rather use Scrt1.o or something else? Or does this mean PIC/PIE must be enabled somewhere in glibc first? It's not clear to me how that is done, or how/why this works at the moment on linux-amd64 but not kfreebsd-amd64. Thanks! p.s. the kernel of FreeBSD didn't implement ASLR yet, but when it does, we'd like to have as much as possible compiled as PIC/PIE already. -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: kfreebsd-amd64 (x86_64) Kernel: kFreeBSD 10.1-0-amd64 Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash