warning: yourfile has a LOAD segment with RWX permissions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
dustinmacdonald
Posts: 4
Joined: Tue Jun 23, 2026 11:17 am

warning: yourfile has a LOAD segment with RWX permissions

Post 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
nullplan
Member
Member
Posts: 2051
Joined: Wed Aug 30, 2017 8:24 am

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

Post 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.
Carpe diem!
Post Reply