Add support to build bl2 with new binutils 2.39+
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
These new warnings are enabled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Following the reasoning in 1, we set "-z noexecstack" for all linkers (although LLVM's LLD defaults to it). Based on 2, we add a macro helper to check if the linker supports a given option and add --no-warn-rwx-segments since this a ld.bfd related.
This commit was mainly based on 3.
Signed-off-by: Vitor Sato Eschholz vsatoes@baylibre.com