Page 1 of 1

warning: yourfile has a LOAD segment with RWX permissions

Posted: Sat Jul 04, 2026 9:52 am
by dustinmacdonald
I wrote my own bootloader and was getting this warning: myos.kernel has a LOAD segment with RWX permissions.

I've seen a couple references to this message on the board, but they are all quite old so I didn't want to necropost, and the replies on those other threads didn't actually address the warning, which appears to involve your linker script having overlapping memory segments.

You can fix this by updating your linker script to explicitly declare the segments and mark the code/text section as RX and the data section as RW, or suppress the warning with the

Code: Select all

--no-warn-rwx-segments
flag added to the CFLAGS section of your makefile, which I have confirmed works for me.

This Stack Overflow post gives an example linker.ld. Though it references ARM, this should apply to other architectures as well:

https://stackoverflow.com/questions/734 ... 4_78073698

Re: warning: yourfile has a LOAD segment with RWX permissions

Posted: Sat Jul 04, 2026 10:46 pm
by nullplan
The correct solution is typically to do something about the warning other than just silencing it. For x86_64, the option

Code: Select all

-z max-page-size=0x1000
is often needed to tell the linker to not use 2MB pages. This is often enough to get the linker to separate your code and data segments.