Fix compile errors with musl>=1.2.3

Patch submitted on behalf of user AngryLoki:

The fix repeats common pattern, used for musl, 
e.g: https://github.com/void-linux/void-packages/blob/5ccf1c66a1df2d644e1a0db0a68fca321469c57e/srcpkgs/MangoHud/patches/0001-elfhacks-d_un.d_ptr-is-relative-on-non-glibc-systems.patch#L90.

Quoting:
d_un.d_ptr is relative on non glibc systems

elf(5) documents it this way, glibc diverts from this documentation

Change-Id: I815f88f127ef00c88ae827a8ad48df0d33c92467


[ROCm/ROCR-Runtime commit: a621bca303]
This commit is contained in:
James Xu
2024-08-16 15:26:14 -04:00
gecommit door David Yat Sin
bovenliggende cca5b9a960
commit e5d7121245
@@ -65,6 +65,12 @@
#include <cpuid.h>
#endif
#ifdef __GLIBC__
#define ABS_ADDR(base, ptr) (ptr)
#else
#define ABS_ADDR(base, ptr) ((base) + (ptr))
#endif
namespace rocr {
namespace os {
@@ -303,7 +309,7 @@ static int callback(struct dl_phdr_info* info, size_t size, void* data) {
for (int j = 0;; j++) {
if (dyn_section[j].d_tag == DT_NULL) break;
if (dyn_section[j].d_tag == DT_STRTAB) strings = (char*)(dyn_section[j].d_un.d_ptr);
if (dyn_section[j].d_tag == DT_STRTAB) strings = (char*)ABS_ADDR(info->dlpi_addr, dyn_section[j].d_un.d_ptr);
if (dyn_section[j].d_tag == DT_STRSZ) limit = dyn_section[j].d_un.d_val;
}