* [Buildroot] [PATCH] package/ledmon: add patch fixing SSP detection
@ 2024-08-21 11:03 Thomas Petazzoni via buildroot
2024-08-21 12:04 ` Yann E. MORIN
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-08-21 11:03 UTC (permalink / raw)
To: buildroot; +Cc: Maksim Kiselev, Thomas Petazzoni
Fixes:
/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared: No such file or directory
/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp: No such file or directory
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:425: ledctl] Error 1
http://autobuild.buildroot.net/results/969b62c89bc37326260fb23c5652e21c0662cba2/
This issue exists since upstream commit
940149a9b53627ceabe67b01aac2859fb7c6fde0 ("Add compiler defenses
flags (#145)"), which has added -fstack-protector-strong to the flags
tested and used if supported. This commit first appeared in v1.0.0,
which is used by Buildroot since commit
b3819b761f4a06bc75fe33b785e5ff2cecc5d211 (which first appeared in
2024.05).
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
...-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch
diff --git a/package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch b/package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch
new file mode 100644
index 0000000000..730eb29595
--- /dev/null
+++ b/package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch
@@ -0,0 +1,49 @@
+From 0d391dbcb808755a65fcc9a8a0ceaf3aa53d153f Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Mon, 19 Aug 2024 00:08:40 +0200
+Subject: [PATCH] configure.ac: use AX_CHECK_LINK_FLAG() to test gcc flags
+
+ledmon's configure.ac defines an AX_AM_CFLAGS_ADD() macro that allows
+to test if a flag is supported by gcc, and if so add it to
+AM_CFLAGS. In order to test if the flag works, it uses
+AX_CHECK_COMPILE_FLAG(), which only does a *compile* test, but not
+a *link* test. However, some flags such as -fstack-protector might
+appear to work at compile time, but not link time. Therefore
+-fstack-protector is considered functional:
+
+checking whether C compiler accepts -fstack-protector-strong... yes
+
+but the build later fails:
+
+/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared: No such file or directory
+/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp: No such file or directory
+collect2: error: ld returned 1 exit status
+
+In order to fix this, we test all flags with AX_CHECK_LINK_FLAG()
+which does a full *link* of the test program. This allows to make sure
+that the flag is fully functional. In our test case,
+-fstack-protector-strong will be determined as being non-functional,
+and therefore won't be used.
+
+Upstream: https://github.com/intel/ledmon/pull/244
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d3fada5..747b168 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -52,7 +52,7 @@ AC_CONFIG_HEADERS([config_ac.h])
+ AM_CFLAGS='-Wall -I../config'
+ AM_CPPFLAGS='-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE -DBUILD_LABEL=\""$(BUILD_LABEL)"\"'
+
+-AC_DEFUN([AX_AM_CFLAGS_ADD],[AX_CHECK_COMPILE_FLAG($1, AM_CFLAGS="$AM_CFLAGS $1")])
++AC_DEFUN([AX_AM_CFLAGS_ADD],[AX_CHECK_LINK_FLAG($1, AM_CFLAGS="$AM_CFLAGS $1")])
+ AX_AM_CFLAGS_ADD([-Wformat -Wformat-security])
+ AX_AM_CFLAGS_ADD([-Wformat-overflow=2])
+ AX_AM_CFLAGS_ADD([-Wno-strict-overflow])
+--
+2.46.0
+
--
2.46.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] package/ledmon: add patch fixing SSP detection
2024-08-21 11:03 [Buildroot] [PATCH] package/ledmon: add patch fixing SSP detection Thomas Petazzoni via buildroot
@ 2024-08-21 12:04 ` Yann E. MORIN
2024-08-21 12:32 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2024-08-21 12:04 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: Maksim Kiselev, buildroot
Thomas, All,
On 2024-08-21 13:03 +0200, Thomas Petazzoni via buildroot spake thusly:
> Fixes:
>
> /home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared: No such file or directory
> /home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp: No such file or directory
> collect2: error: ld returned 1 exit status
> make[4]: *** [Makefile:425: ledctl] Error 1
>
> http://autobuild.buildroot.net/results/969b62c89bc37326260fb23c5652e21c0662cba2/
>
> This issue exists since upstream commit
> 940149a9b53627ceabe67b01aac2859fb7c6fde0 ("Add compiler defenses
> flags (#145)"), which has added -fstack-protector-strong to the flags
> tested and used if supported. This commit first appeared in v1.0.0,
> which is used by Buildroot since commit
> b3819b761f4a06bc75fe33b785e5ff2cecc5d211 (which first appeared in
> 2024.05).
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Barring a rebase, upstream seemed OK with the change.
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> ...-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch | 49 +++++++++++++++++++
> 1 file changed, 49 insertions(+)
> create mode 100644 package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch
>
> diff --git a/package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch b/package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch
> new file mode 100644
> index 0000000000..730eb29595
> --- /dev/null
> +++ b/package/ledmon/0002-configure.ac-use-AX_CHECK_LINK_FLAG-to-test-gcc-flag.patch
> @@ -0,0 +1,49 @@
> +From 0d391dbcb808755a65fcc9a8a0ceaf3aa53d153f Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +Date: Mon, 19 Aug 2024 00:08:40 +0200
> +Subject: [PATCH] configure.ac: use AX_CHECK_LINK_FLAG() to test gcc flags
> +
> +ledmon's configure.ac defines an AX_AM_CFLAGS_ADD() macro that allows
> +to test if a flag is supported by gcc, and if so add it to
> +AM_CFLAGS. In order to test if the flag works, it uses
> +AX_CHECK_COMPILE_FLAG(), which only does a *compile* test, but not
> +a *link* test. However, some flags such as -fstack-protector might
> +appear to work at compile time, but not link time. Therefore
> +-fstack-protector is considered functional:
> +
> +checking whether C compiler accepts -fstack-protector-strong... yes
> +
> +but the build later fails:
> +
> +/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared: No such file or directory
> +/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/m68k-buildroot-linux-uclibc/13.3.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: cannot find -lssp: No such file or directory
> +collect2: error: ld returned 1 exit status
> +
> +In order to fix this, we test all flags with AX_CHECK_LINK_FLAG()
> +which does a full *link* of the test program. This allows to make sure
> +that the flag is fully functional. In our test case,
> +-fstack-protector-strong will be determined as being non-functional,
> +and therefore won't be used.
> +
> +Upstream: https://github.com/intel/ledmon/pull/244
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +---
> + configure.ac | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index d3fada5..747b168 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -52,7 +52,7 @@ AC_CONFIG_HEADERS([config_ac.h])
> + AM_CFLAGS='-Wall -I../config'
> + AM_CPPFLAGS='-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE -DBUILD_LABEL=\""$(BUILD_LABEL)"\"'
> +
> +-AC_DEFUN([AX_AM_CFLAGS_ADD],[AX_CHECK_COMPILE_FLAG($1, AM_CFLAGS="$AM_CFLAGS $1")])
> ++AC_DEFUN([AX_AM_CFLAGS_ADD],[AX_CHECK_LINK_FLAG($1, AM_CFLAGS="$AM_CFLAGS $1")])
> + AX_AM_CFLAGS_ADD([-Wformat -Wformat-security])
> + AX_AM_CFLAGS_ADD([-Wformat-overflow=2])
> + AX_AM_CFLAGS_ADD([-Wno-strict-overflow])
> +--
> +2.46.0
> +
> --
> 2.46.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] package/ledmon: add patch fixing SSP detection
2024-08-21 12:04 ` Yann E. MORIN
@ 2024-08-21 12:32 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-08-21 12:32 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Maksim Kiselev, buildroot
On Wed, 21 Aug 2024 14:04:46 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> Barring a rebase, upstream seemed OK with the change.
I did update the upstream submission, rebased on "main" (I had it based
on their "master" branch...).
> Applied to master, thanks.
Thanks :-)
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-21 12:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 11:03 [Buildroot] [PATCH] package/ledmon: add patch fixing SSP detection Thomas Petazzoni via buildroot
2024-08-21 12:04 ` Yann E. MORIN
2024-08-21 12:32 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox