Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ALM_VERSION_STRING or alm_get_version symbols public (or an equivalent macro) #13

Open
blackwer opened this issue May 3, 2022 · 0 comments

Comments

@blackwer
Copy link

blackwer commented May 3, 2022

I'm making a benchmarking utility that catalogs various elementary/special function performance characteristics. I'd like to use the binary distribution and get the version for the current binary in use. I notice that the two symbols mentioned in the issue title are present in the binary, but they're both private. Currently I'm hacking up the version reader like so:

std::string get_alm_version() {
    std::string offset_str = "0x" + exec("objdump -t ../extern/amd-libm/lib/libalm.so --section=.rodata | grep -m1 "
                                         "ALM_VERSION_STRING | cut -d' ' -f 1");
    size_t offset = strtol(offset_str.c_str(), NULL, 0);
    FILE *obj = fopen("../extern/amd-libm/lib/libalm.so", "r");
    fseek(obj, offset, 0);
    char buf[16];
    fread(buf, sizeof(char), 16, obj);
    fclose(obj);
    return buf;
}

which... is messy and fragile.

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

No branches or pull requests

1 participant