[Bug 192686] Segfaults using combinations of -pie -pthread -lm(|_p) when profiling

[email protected] Mon, 07 Apr 2025 00:14:52 +0000
Newsgroups gmane.os.freebsd.devel.threading
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D192686

yu shan wei <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #5 from yu shan wei <[email protected]> ---
[1]> clang -pg -pie -pthread -lm profile.c && ./a.out
ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in /tmp/profile-387333.o
>>> referenced by profile.c
>>>               /tmp/profile-387333.o:(main)

ld: error: relocation R_X86_64_64 cannot be used against symbol 'main';
recompile with -fPIC
>>> defined in /tmp/profile-387333.o
>>> referenced by crt1_s.S:69 (/usr/src/lib/csu/amd64/crt1_s.S:69)
>>>               /usr/lib/gcrt1.o:(_start)

ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in /usr/lib/gcrt1.o
>>> referenced by crt1_s.S:72 (/usr/src/lib/csu/amd64/crt1_s.S:72)
>>>               /usr/lib/gcrt1.o:(_start)

ld: error: relocation R_X86_64_64 cannot be used against symbol 'etext';
recompile with -fPIC
>>> defined in <internal>
>>> referenced by crt1_s.S:73 (/usr/src/lib/csu/amd64/crt1_s.S:73)
>>>               /usr/lib/gcrt1.o:(_start)
clang: error: linker command failed with exit code 1 (use -v to see invocat=
ion)
[2]> clang -pg -pie -pthread -lm_p profile.c && ./a.out
clang -pg -pie -pthread -lm_p profile.c && ./a.out
ld: error: unable to find library -lm_p

clang -pg -pie -pthread -lmp profile.c && ./a.out
ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in /tmp/profile-8d9771.o
>>> referenced by profile.c
>>>               /tmp/profile-8d9771.o:(main)

ld: error: relocation R_X86_64_64 cannot be used against symbol 'main';
recompile with -fPIC
>>> defined in /tmp/profile-8d9771.o
>>> referenced by crt1_s.S:69 (/usr/src/lib/csu/amd64/crt1_s.S:69)
>>>               /usr/lib/gcrt1.o:(_start)

ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in /usr/lib/gcrt1.o
>>> referenced by crt1_s.S:72 (/usr/src/lib/csu/amd64/crt1_s.S:72)
>>>               /usr/lib/gcrt1.o:(_start)

ld: error: relocation R_X86_64_64 cannot be used against symbol 'etext';
recompile with -fPIC
>>> defined in <internal>
>>> referenced by crt1_s.S:73 (/usr/src/lib/csu/amd64/crt1_s.S:73)
>>>               /usr/lib/gcrt1.o:(_start)
clang: error: linker command failed with exit code 1 (use -v to see invocat=
ion)

[3]> clang -pg -pthread -lm profile.c && ./a.out
success
[4]> clang -pg -pthread -lm_p profile.c && ./a.out
clang -pg -pthread -lm_p profile.c && ./a.out
success
[5]> clang -pg -pthread -lm profile.c && ./a.out
success
[6]> clang -pg -pie -pthread  profile.c && ./a.out
ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in /tmp/profile-1d081e.o
>>> referenced by profile.c
>>>               /tmp/profile-1d081e.o:(main)

ld: error: relocation R_X86_64_64 cannot be used against symbol 'main';
recompile with -fPIC
>>> defined in /tmp/profile-1d081e.o
>>> referenced by crt1_s.S:69 (/usr/src/lib/csu/amd64/crt1_s.S:69)
>>>               /usr/lib/gcrt1.o:(_start)

ld: error: relocation R_X86_64_64 cannot be used against local symbol;
recompile with -fPIC
>>> defined in /usr/lib/gcrt1.o
>>> referenced by crt1_s.S:72 (/usr/src/lib/csu/amd64/crt1_s.S:72)
>>>               /usr/lib/gcrt1.o:(_start)

ld: error: relocation R_X86_64_64 cannot be used against symbol 'etext';
recompile with -fPIC
>>> defined in <internal>
>>> referenced by crt1_s.S:73 (/usr/src/lib/csu/amd64/crt1_s.S:73)
>>>               /usr/lib/gcrt1.o:(_start)
clang: error: linker command failed with exit code 1 (use -v to see invocat=
ion)



FreeBSD 14.2

--=20
You are receiving this mail because:
You are the assignee for the bug.=