* [PATCH] Makefile: Silence new GNU linker warnings
@ 2022-08-02 8:30 Joel Stanley
2022-08-02 10:45 ` Heinrich Schuchardt
0 siblings, 1 reply; 3+ messages in thread
From: Joel Stanley @ 2022-08-02 8:30 UTC (permalink / raw)
To: Simon Glass, u-boot; +Cc: Heinrich Schuchardt
The next version of the linker will complain about rwx segments with
permissions and executable stacks:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
These warnings are relevant for ELF binaries loaded by an operating
system linker, but do not make sense in the context of u-boot where the
objects are loaded by other means.
Disable the warnings using the following options:
--no-warn-rwx-segments
warning: u-boot has a LOAD segment with RWX permissions
warning: u-boot-spl has a LOAD segment with RWX permissions
--no-warn-execstack
warning: arch/arm/lib/setjmp.o: missing .note.GNU-stack section implies executable stack
NOTE: This behaviour is deprecated and will be removed in a future version of the linker
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
This behaviour can be seen when building with binutils
2.38.90.20220713-2 from Debian testing.
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index ff25f9297486..32aac7493f8d 100644
--- a/Makefile
+++ b/Makefile
@@ -432,7 +432,8 @@ KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
-fno-builtin -ffreestanding $(CSTD_FLAG)
KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing
KBUILD_AFLAGS := -D__ASSEMBLY__
-KBUILD_LDFLAGS :=
+KBUILD_LDFLAGS := $(call ld-option, --no-warn-rwx-segments) \
+ $(call ld-option, --no-warn-execstack)
ifeq ($(cc-name),clang)
ifneq ($(CROSS_COMPILE),)
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: Silence new GNU linker warnings
2022-08-02 8:30 [PATCH] Makefile: Silence new GNU linker warnings Joel Stanley
@ 2022-08-02 10:45 ` Heinrich Schuchardt
2022-08-05 7:01 ` Joel Stanley
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2022-08-02 10:45 UTC (permalink / raw)
To: Joel Stanley; +Cc: Heinrich Schuchardt, Simon Glass, u-boot
On 8/2/22 10:30, Joel Stanley wrote:
> The next version of the linker will complain about rwx segments with
> permissions and executable stacks:
>
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
>
> These warnings are relevant for ELF binaries loaded by an operating
> system linker, but do not make sense in the context of u-boot where the
> objects are loaded by other means.
The ELF binary can be loaded by OpenSBI or QEMU. The information about
rwx segments can be relevant for these. Only if a non-ELF form is used
it is irrelevant.
You should instead fix the single file that has a problem:
test/overlay/test-fdt-overlay-stacked.dtb.S
Just add the missing section information or change the build flags for
this single binary.
Best regards
Heinrich
>
> Disable the warnings using the following options:
>
> --no-warn-rwx-segments
>
> warning: u-boot has a LOAD segment with RWX permissions
> warning: u-boot-spl has a LOAD segment with RWX permissions
>
> --no-warn-execstack
>
> warning: arch/arm/lib/setjmp.o: missing .note.GNU-stack section implies executable stack
> NOTE: This behaviour is deprecated and will be removed in a future version of the linker
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> This behaviour can be seen when building with binutils
> 2.38.90.20220713-2 from Debian testing.
>
> Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index ff25f9297486..32aac7493f8d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -432,7 +432,8 @@ KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
> -fno-builtin -ffreestanding $(CSTD_FLAG)
> KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing
> KBUILD_AFLAGS := -D__ASSEMBLY__
> -KBUILD_LDFLAGS :=
> +KBUILD_LDFLAGS := $(call ld-option, --no-warn-rwx-segments) \
> + $(call ld-option, --no-warn-execstack)
>
> ifeq ($(cc-name),clang)
> ifneq ($(CROSS_COMPILE),)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: Silence new GNU linker warnings
2022-08-02 10:45 ` Heinrich Schuchardt
@ 2022-08-05 7:01 ` Joel Stanley
0 siblings, 0 replies; 3+ messages in thread
From: Joel Stanley @ 2022-08-05 7:01 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: Simon Glass, u-boot
On Tue, 2 Aug 2022 at 10:45, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 8/2/22 10:30, Joel Stanley wrote:
> > The next version of the linker will complain about rwx segments with
> > permissions and executable stacks:
> >
> > https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
> > https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
> >
> > These warnings are relevant for ELF binaries loaded by an operating
> > system linker, but do not make sense in the context of u-boot where the
> > objects are loaded by other means.
>
> The ELF binary can be loaded by OpenSBI or QEMU. The information about
> rwx segments can be relevant for these. Only if a non-ELF form is used
> it is irrelevant.
I couldn't see where it was used in the qemu elf loader.
I had assumed the system would need an operating system and/or to be
running with a MMU turned on to do anything sensible with the
information.
>
> You should instead fix the single file that has a problem:
>
> test/overlay/test-fdt-overlay-stacked.dtb.S
I saw it triggering on a different set of files:
$ make evb-ast2600_defconfig && make CROSS_COMPILE=arm-linux-gnueabihf- -s -j8
#
# configuration written to .config
#
arm-linux-gnueabihf-ld.bfd: warning: arch/arm/lib/lib1funcs.o: missing
.note.GNU-stack section implies executable stack
arm-linux-gnueabihf-ld.bfd: NOTE: This behaviour is deprecated and
will be removed in a future version of the linker
arm-linux-gnueabihf-ld.bfd: warning: u-boot has a LOAD segment with
RWX permissions
arm-linux-gnueabihf-ld.bfd: warning: arch/arm/lib/lib1funcs.o: missing
.note.GNU-stack section implies executable stack
arm-linux-gnueabihf-ld.bfd: NOTE: This behaviour is deprecated and
will be removed in a future version of the linker
arm-linux-gnueabihf-ld.bfd: warning: u-boot-spl has a LOAD segment
with RWX permissions
Cheers,
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-05 7:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 8:30 [PATCH] Makefile: Silence new GNU linker warnings Joel Stanley
2022-08-02 10:45 ` Heinrich Schuchardt
2022-08-05 7:01 ` Joel Stanley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).