dtrace -G vs. -flto

Jan Beich jbeich at FreeBSD.org
Tue Nov 28 00:34:04 UTC 2017


I'd like to build www/firefox with both DTrace and LTO support. Both
Clang and GCC emit code that dtrace(1) doesn't understand.

$ cat main.c
#include <sys/sdt.h>
#include <unistd.h>

int main()
{
  DTRACE_PROBE(test, foo);
  sleep(300);
  return 0;
}

$ cat test.d
provider test {
        probe foo();
};

$ clang50 -flto -c main.c
$ dtrace -G -s test.d main.o
dtrace: failed to link script test: invalid file type: main.o
$ file main.o
main.o: LLVM IR bitcode

$ gcc7 -flto -c main.c
$ dtrace -G -s test.d main.o
dtrace: failed to link script test: No probe sites found for declared provider
$ file main.o
main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), not stripped

--
$ uname -a
FreeBSD ... 12.0-CURRENT #0 r325899M ... amd64


More information about the freebsd-dtrace mailing list