Page MenuHomeFreeBSD

initial linker support userland-DTrace aarch64
ClosedPublic

Authored by maciphone2_googlemail.com on Nov 14 2019, 5:36 AM.
Tags
None
Referenced Files
F103428390: D22360.id.diff
Sun, Nov 24, 9:55 PM
Unknown Object (File)
Fri, Nov 1, 9:38 PM
Unknown Object (File)
Oct 21 2024, 11:36 AM
Unknown Object (File)
Oct 5 2024, 11:41 PM
Unknown Object (File)
Oct 5 2024, 6:44 PM
Unknown Object (File)
Oct 5 2024, 8:01 AM
Unknown Object (File)
Oct 5 2024, 6:11 AM
Unknown Object (File)
Oct 4 2024, 10:56 PM

Details

Summary

this PR initially solves :
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239805

furthermore it would be nice if we could work on pid-provider-support for aarch64 :
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241028#c0

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
232 ↗(On Diff #64306)

This is missing that leading tab... did you upload the right version?

correction of missing leading tab (mentioned by Warner Losh, thank you )

maciphone2_googlemail.com added inline comments.
cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
232 ↗(On Diff #64306)

sorry for leading tab-typo- I`ll upload corrected version ..

`hope I've done that correctly now on this web-view-wysiwyg :-) , if not, please tell me

This looks reasonable to me. I will give it a spin later today.

cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
433 ↗(On Diff #64344)

Why are you using this relocation type instead of PREL64?

maciphone2_googlemail.com added inline comments.
cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
433 ↗(On Diff #64344)

good point.. it's from the Oracle sources :
https://github.com/oracle/dtrace-utils/blob/master/libdtrace/dt_link.c : line 401
clang fbsd told 'undefined reference to ..' or similar , so I defined
#define R_AARCH64_ABS64 257
here in line 429
although it`s defined in
freebsd/sys/sys/elf_common.h : line 1009

I tested the change and I can at least compile the USDT tests. There's no way to run them though since we do not have a fasttrap implementation for arm64. Do you have any plan to add one? It should be relatively straightforward to support USDT probes. (pid provider is more work.)

If you change the relocation type I'll commit.

cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
433 ↗(On Diff #64344)

Note that we use a different mechanism to relocate probe sites. See r313262 and D9374.

I tested the change and I can at least compile the USDT tests. There's no way to run them though since we do not have a fasttrap implementation for arm64. Do you have any plan to add one? It should be relatively straightforward to support USDT probes. (pid provider is more work.)

If you change the relocation type I'll commit.

Yes, I called PR 'Initial Support' so WE can start
Implement Fasttrap / pid provider.
I haven't worked on it in the past few weeks-
Example test without fasttrap (openjdk):
https://github.com/battleblow/openjdk-jdk11u/issues/62
Well, Oracle has a different approach than in freebsd-source,
For example. they removed dt_isadep.c: https://github.com/oracle/dtrace-utils/commit/41d221d85232d8bd06c91201e63b59a18fc9aff0 etc.

<< If you change the relocation type I'll commit.>>
Do you want (or recommend) it to be changed from absolute to relative :
e.g.

#define	R_AARCH64_PREL64	260
			rel->r_offset = s->dofs_offset +
			    dofr[j].dofr_offset;
			rel->r_info = ELF64_R_INFO(count + dep->de_global,
			    R_AARCH64_PREL64);

or something like that ?

<< Do you have any plan to add one? >>

We/you probably have no choice but to design a plan the next days or weeks :-)

---edit:--
or
#define R_AARCH64_PREL32 261
?

from absolute to relative relocation type :
R_AARCH64_PREL64 instead of R_AARCH64_ABS64
as recommended by markj@

I tested the change and I can at least compile the USDT tests. There's no way to run them though since we do not have a fasttrap implementation for arm64. Do you have any plan to add one? It should be relatively straightforward to support USDT probes. (pid provider is more work.)

If you change the relocation type I'll commit.

Yes, I called PR 'Initial Support' so WE can start
Implement Fasttrap / pid provider.
I haven't worked on it in the past few weeks-
Example test without fasttrap (openjdk):
https://github.com/battleblow/openjdk-jdk11u/issues/62
Well, Oracle has a different approach than in freebsd-source,
For example. they removed dt_isadep.c: https://github.com/oracle/dtrace-utils/commit/41d221d85232d8bd06c91201e63b59a18fc9aff0 etc.

<< If you change the relocation type I'll commit.>>
Do you want (or recommend) it to be changed from absolute to relative :

Yes, it is required for the code to be correct.

e.g.

#define	R_AARCH64_PREL64	260
			rel->r_offset = s->dofs_offset +
			    dofr[j].dofr_offset;
			rel->r_info = ELF64_R_INFO(count + dep->de_global,
			    R_AARCH64_PREL64);

or something like that ?

<< Do you have any plan to add one? >>

We/you probably have no choice but to design a plan the next days or weeks :-)

I do not have much time for that in the near future, but I am happy to answer questions and review code.

cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
429 ↗(On Diff #65946)

This should come from sys/elf_common.h.

819 ↗(On Diff #65946)

We should add these to elf_common.h instead.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 29 2019, 9:47 PM
This revision was automatically updated to reflect the committed changes.