freebsd-dev/cddl
Mark Johnston e801af6fba Use PC-relative relocations for USDT probe sites on i386 and amd64.
When recording probe site addresses in the output DOF file, dtrace -G
needs to emit relocations for the .SUNW_dof section in order to obtain
the addresses of functions containing probe sites. DTrace expects the
addresses to be relative to the base address of the final ELF file,
and the amd64 USDT implementation was relying on some unspecified and
incorrect behaviour in the base system GNU ld to achieve this.

This change reimplements the probe site relocation handling to allow
USDT to be used with lld and newer GNU binutils. Specifically, it
makes use of R_X86_64_PC64/R_386_PC32 relocations to obtain the
probe site address relative to the DOF file address, and adds and uses a
new DOF relocation type which computes the final probe site address using
these relative offsets.

Reported by and discussed with:	Rafael Espíndola
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D9374
2017-02-05 02:39:12 +00:00
..
compat/opensolaris libproc: Add support for some proc_attach() flags. 2016-12-06 04:22:38 +00:00
contrib/opensolaris Use PC-relative relocations for USDT probe sites on i386 and amd64. 2017-02-05 02:39:12 +00:00
lib Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes. 2017-02-01 19:33:00 +00:00
sbin Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
usr.bin Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
usr.sbin Fix an unchecked return value in zfsd 2017-01-18 22:10:18 +00:00
Makefile Add more SUBDIR_PARALLEL. 2015-10-15 22:55:08 +00:00
Makefile.inc Make DTrace stuff compile with C99 standard. 2014-08-22 20:04:51 +00:00