dynamorio
dynamorio copied to clipboard
dr_set_sve_vector_length is not exported, causing link errors when used from libdynamorio
Quoting from https://github.com/DynamoRIO/dynamorio/pull/6544#issuecomment-1883354811
All standalone decode/encode functions should be available in libdynamorio. Looking at dr_set_sve_vector_length() and dr_get_sve_vector_length() in encode_api.h: they are missing DR_API specifiers and this is why they are not exported when in a shared library.
This has now broken our internal build with PR #6544 adding a call to dr_set_sve_vector_length to raw2trace:
ld: error: undefined reference...: dr_set_sve_vector_length
There also seems to be no test of either API routine?
Adding a call to one of these from ir_aarch64.c immediately reproduces the problem:
suite/tests/api/ir_aarch64.c:6931: undefined reference to `dr_get_sve_vector_length'
Also, the set routine returns null, but says it will not work if on an SVE system: how does the user know A) whether on an SVE system and B) whether the set routine succeeded? Should it return a bool instead?
I'm adding this test, but it seems it may fail on actual SVE hardware. I'll leave updating it as future work as I'm not sure how to detect the SVE hardware. I think the set routine should return a bool.
Re-assigning to get the test to work on SVE hardware. My suggestion is to have the set routine return a bool as well.