You'll not be able to build shared library without -fPIC
. It'll report something like
/usr/bin/ld: /tmp/ccbCwoJo.o: relocation R_X86_64_PC32 against symbol `_Z1ff' can not be used when making a shared object; recompile with -fPIC
But if you really want to check something, grep for PLT calls:
$ objdump -d a.out | g @plt
628: e8 23 00 00 00 callq 650 <__gmon_start__@plt>
0000000000000650 <__gmon_start__@plt>:
0000000000000660 <__cxa_finalize@plt>:
0000000000000670 <_Z1ff@plt>:
0000000000000680 <cosf@plt>:
0000000000000690 <sinf@plt>:
72e: e8 2d ff ff ff callq 660 <__cxa_finalize@plt>
7df: e8 8c fe ff ff callq 670 <_Z1ff@plt>
819: e8 62 fe ff ff callq 680 <cosf@plt>
82e: e8 5d fe ff ff callq 690 <sinf@plt>
fPIC
indeed, butobjdump -d datetime.o | grep -i relacation
outputs nothing. – Brie