[Bug 250992] Binaries produced by clang -pg on x86-64 always crash in ld-elf.so.1

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Nov 9 22:18:57 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250992

--- Comment #2 from Oleg Derevenetz <oleg.derevenetz at gmail.com> ---
I found similar bug report in LLVM bugtracker:

https://bugs.llvm.org/show_bug.cgi?id=47455

with some discussion. According to truss output, the -dynamic-linker flag is
actually being passed to lld:

  890: execve("/usr/bin/clang",[ "/usr/bin/clang", "-cc1", "-triple",
"x86_64-unknown-freebsd12.2", "-emit-obj", "-mrelax-all", "-disable-free",
"-disable-llvm-verifier", "-discard-value-names", "-main-file-name", "test.c",
"-mrelocation-model", "static", "-mthread-model", "posix",
"-mframe-pointer=all", "-fno-rounding-math", "-masm-verbose",
"-mconstructor-aliases", "-munwind-tables", "-target-cpu", "x86-64",
"-dwarf-column-info", "-fno-split-dwarf-inlining", "-debugger-tuning=gdb",
"-resource-dir", "/usr/lib/clang/10.0.1", "-fdebug-compilation-dir",
"/usr/home/oleg/tmp/pg", "-ferror-limit", "19", "-fmessage-length", "237",
"-pg", "-fgnuc-version=4.2.1", "-fobjc-runtime=gnustep",
"-fdiagnostics-show-option", "-fcolor-diagnostics", "-faddrsig", "-o",
"/tmp/test-63e2c7.o", "-x", "c", "test.c" ],0x7fffffffebb0) EJUSTRETURN
  891: execve("/usr/bin/ld",[ "/usr/bin/ld", "--eh-frame-hdr",
"-dynamic-linker", "/libexec/ld-elf.so.1", "--hash-style=both",
"--enable-new-dtags", "-o", "a.out", "/usr/lib/gcrt1.o", "/usr/lib/crti.o",
"/usr/lib/crtbegin.o", "-L/usr/lib", "/tmp/test-63e2c7.o", "-lgcc_p",
"-lgcc_eh_p", "-lc_p", "-lgcc_p", "-lgcc_eh_p", "/usr/lib/crtend.o",
"/usr/lib/crtn.o" ],0x7fffffffebb0) EJUSTRETURN

However, it's unclear to me, why it is passed in the first place, if clang -pg
wants to produce statically linked binary. There is apparently some
inconsistency.

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


More information about the freebsd-bugs mailing list