RTEMS | libdl/sparc: Fix overflow in relocation bitmask (!1219)

SHIVAM DEOLANKAR (@D3athSkulll) gitlab at rtems.org
Fri Apr 24 22:09:16 UTC 2026




SHIVAM DEOLANKAR commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1219#note_149035


Verified using following config.

```
[DEFAULT]
RTEMS_POSIX_API = True
OPTIMIZATION_FLAGS = -Wpedantic -Wno-error

[sparc/leon3]
```

Before Fix:

![image.png](/uploads/298f9b57c17e6143d28581ee1f56d247/image.png){width=900 height=447}

After Fix: We can see the warning for the rtl-mdreloc-sparc.c is removed

![image.png](/uploads/bf2af3350f13cebdccfa7406bebcc4a8/image.png){width=900 height=317}

 The `_BM(x)` macro was creating 64-bit bitmask values, but they were being stored in an `int` array. On 32-bit systems, this led to the value `4294967295` getting converted to `-1`, causing overflow warnings. I fixed this by using `uint32_t` for the array and casting the result, so the bitmask stays consistent and avoids unsafe type conversions.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1219#note_149035
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260424/8e473730/attachment.htm>


More information about the bugs mailing list