Hi,
Anyone knows how to specify section flags(Allocate/Writable/eXecutable) in linker script? I found out GNU ld does set some flags to the "magic" sections, for example, it will set flags "AX" for .text & .init section. But GNU ld won't set any flags for sections with customized names, for example .mykernel section.
My elf loader relies on the "A" flag to work. If the "A" flag isn't set, it won't copy data to memory. I really don't want to parse the section name, it's much more complicated.
Thanks
torshie
Specify elf section flag in linker script.
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Specify elf section flag in linker script.
I remember that there is a way to specify flags for memory regions in ld and flags for sections in as - which is probably not quite what you want.
Alternatively you could set the correct section flags using objcopy after linking:
Alternatively you could set the correct section flags using objcopy after linking:
Code: Select all
objcopy --set-section-flags section=... infile outfile