The answer depends on the platform. On most platforms, if output from
readelf --relocs foo.o | egrep '(GOT|PLT|JU?MP_SLOT)'
is empty, then either foo.o
was not compiled with -fPIC
, or foo.o
doesn’t contain any code where -fPIC
matters.
More Related Contents:
- How to specify non-default shared-library path in GCC Linux? Getting “error while loading shared libraries” when running
- Hiding symbol names in library
- Compile with older libc (version `GLIBC_2.14′ not found)
- CUDA incompatible with my gcc version
- How to install GCC piece by piece with GMP, MPFR, MPC, ELF, without shared libraries?
- How to see which flags -march=native will activate?
- Merge multiple .so shared libraries
- Why am I getting a gcc “undefined reference” error trying to create shared objects?
- How Does The Debugging Option -g Change the Binary Executable?
- exit.c:(.text+0x18): undefined reference to `_exit’ when using arm-none-eabi-gcc
- What does the compiler error “missing binary operator before token” mean?
- Selectively remove a warning message using GCC
- How to Install gcc 5.3 with yum on CentOS 7.2?
- How to link using GCC without -l nor hardcoding path for a library that does not follow the libNAME.so naming convention?
- Cuda Clang and OS X Mavericks
- How is -march different from -mtune?
- How can I see parse tree, intermediate code, optimization code and assembly code during COMPILATION?
- How to set a variable in GCC with Intel syntax inline assembly?
- long double (GCC specific) and __float128
- What does -fPIC mean when building a shared library?
- How to write multiline inline assembly code in GCC C++?
- Errors that refer to a bunch of unresolved OpenSSL symbols that clearly exist?
- Why do the addresses in my assembler dump differ from the addresses of registers?
- Why would one use #include_next in a project?
- CMake and Static Linking
- linking arbitrary data using GCC ARM toolchain
- valgrind, gcc 6.2.0 and “-fsanitize=address”
- Mathematical functions for SIMD registers
- How to view C preprocessor output?
- What’s the difference between -O3 and (-O2 + flags that man gcc says -O3 adds to -O2)?