Commit aa9950f
authored
fix(libhsakmt): Define _GNU_SOURCE before libhsakmt.h include (#8555)
## Summary
Move `#define _GNU_SOURCE` to the top of `hsakmtmodel.c`, before all
includes, and remove the redundant `#define __USE_GNU`. `_GNU_SOURCE`
must be defined before any system header is pulled in; `hsakmtmodel.h`,
`hsakmt_drm.h`, and `libhsakmt.h` all transitively include libc/drm
headers. Defining it after those includes breaks GNU extension
visibility (e.g. `secure_getenv`) and causes compile errors in strict or
sanitizer builds.
## JIRA ID
JIRA ID : ROCM-26861
## Test plan
Tested on **dayatsin-test-01** (Ubuntu 24.04, amdclang 23.0.0 from
`/opt/rocm`), including after removing `__USE_GNU` (`c651d3f278`):
- [x] Build `libhsakmt` / `rocr-runtime` with ASAN enabled
(`-DADDRESS_SANITIZER=ON -DTHEROCK_SANITIZER=ASAN`) — full build
succeeded (`libhsa-runtime64.so` produced)
- [x] Build with amdclang from TheRock/ROCm toolchain — Release `hsakmt`
target succeeded
- [x] Verify `hsakmtmodel.c` compiles without `_GNU_SOURCE` ordering
warnings/errors — no errors in either ASAN or Release builds1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
32 | | - | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments