June 13, 2024

the Zynq FSBL - idiotic linker warnings

I don't know who the morons were who imposed this stupidity upon us, but lately I have been rebuilding some old bare metal projects and getting these warnings:
/usr/bin/arm-linux-gnu-ld: warning: start.o: missing .note.GNU-stack section implies executable stack
/usr/bin/arm-linux-gnu-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
I understand in a general way what the intent is, but the situation that led to this nanny business has nothing to do with bare-metal embedded code. Nonetheless, to get rid of the above, add this to the end of any and all assembler code source files:
# Idiotic junk to avoid complaints from linker
.section        .note.GNU-stack,"",%progbits

Wait! There is more

Only the above seems necessary if you are using the "arm-linux-gnu-" cross compiler. If you use the "arm-none-eabi-" compiler, it seems to whine even about C code and it is not clear what options to gcc will make it do something that the linker won't complain about. So the thing to do is to just tell the linker to shut the heck up.

What seems to work is adding this option to your link options:

-z noexecstack
The history on all this is here:

Why?

It all started here (in the context of the linux kernel). These morons never considered that people might use the toolchain for things other than linux (such as embedded projects).

Some old notes

This seemed to work once, under some conditions now long forgotten:

I you are running gcc to do your linking, add this to the link options:

-Wl,--no-warn-rwx-segments

If you are running ld to do your linking, add this:

--no-warn-rwx-segments
In other words the "-Wl," prefix is just a way of wrapping anything and everything that you might want gcc to pass along to ld.
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org