can't get PIE with linker scripts

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

 



I want to compile a PIE with a linker script. But I can't get a PIE if I use a linker script even an inner linker script. Is it expected?

   ~/code/pie-test$ aarch64-linux-gnu-ld --verbose | sed -n '/OUTPUT_FORMAT/,/^}/p' > default.lds
   ~/code/pie-test$ aarch64-linux-gnu-gcc -fPIE -pie -T default.lds -o pie-lds main.c
   ~/code/pie-test$ file pie-lds
   pie-lds: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=54bf255dabcb707d6fcaa318d905fb3aae329640, not stripped
   ~/code/pie-test$ aarch64-linux-gnu-gcc -fPIE -pie -o pie main.c
   ~/code/pie-test$ file pie
   pie: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=44f263cf8b4c43b7d77c98d3294b73e9f876c40a, not stripped
   ~/code/pie-test$ cat main.c
   #include <stdio.h>

   int main(int argc, char *argv[])
   {
        printf("haha\n");
        return 0;
   }
   ~/code/pie-test$ aarch64-linux-gnu-gcc -v
   Using built-in specs.
   COLLECT_GCC=aarch64-linux-gnu-gcc
   COLLECT_LTO_WRAPPER=/home/w/local/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/7.2.1/lto-wrapper
   Target: aarch64-linux-gnu
   Configured with: '/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/snapshots/gcc.git~linaro-7.2-2017.11/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu
   --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-arch=armv8-a --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-gnu-indirect-function --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/sysroots/aarch64-linux-gnu --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu
   --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu
   Thread model: posix
   gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)
   ~/code/pie-test$ aarch64-linux-gnu-ld -v
   GNU ld (Linaro_Binutils-2017.11) 2.28.2.20170706




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux