Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Embed version number into abs symbol for hostcall_invoke detection #168

Open
wants to merge 1 commit into
base: amd-stg-openmp
Choose a base branch
from

Conversation

JonChesterfield
Copy link
Contributor

@JonChesterfield JonChesterfield commented Oct 6, 2020

This change includes the hostcall version macros in hostrpc_invoke then embeds them in the symbol used to detect whether hostcall is in use.

Uses an absolute symbol to save the four bytes. Unfortunately, our loader segfaults on any absolute symbols while loading the executable. So that needs to be fixed before this lands.

(common can't be initialized, weak gives invalid symbol redefinition after the first instance)

@JonChesterfield
Copy link
Contributor Author

Could use

// file scope, so can't detect whether hostrpc_invoke has been used with it
__attribute__((weak))
__attribute__((visibility("default")))
unsigned __hostcall_version = HOSTRPC_VRM;

or similar to embed the version number in the device runtime until the abs bug is fixed. The intent to do the version checking once instead of during each individual call.

@JonChesterfield
Copy link
Contributor Author

Reported the crash on weak in the assembler at https://bugs.llvm.org/show_bug.cgi?id=43187 but haven't looked into fixing it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant