dynamorio icon indicating copy to clipboard operation
dynamorio copied to clipboard

dr_set_sve_vector_length is not exported, causing link errors when used from libdynamorio

Open derekbruening opened this issue 1 year ago • 5 comments

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        

derekbruening avatar Jan 23 '24 14:01 derekbruening

There also seems to be no test of either API routine?

derekbruening avatar Jan 23 '24 14:01 derekbruening

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'

derekbruening avatar Jan 23 '24 14:01 derekbruening

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?

derekbruening avatar Jan 23 '24 14:01 derekbruening

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.

derekbruening avatar Jan 23 '24 14:01 derekbruening

Re-assigning to get the test to work on SVE hardware. My suggestion is to have the set routine return a bool as well.

derekbruening avatar Jan 23 '24 22:01 derekbruening