[openwrt/openwrt] tools/elfutils: pass -O2 in HOST_CXXFLAGS

LEDE Commits lede-commits at lists.infradead.org
Fri May 31 07:01:50 PDT 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/4454361e54b749bdc0b524092aea2366b5d5ed98

commit 4454361e54b749bdc0b524092aea2366b5d5ed98
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Fri May 31 15:47:15 2024 +0200

    tools/elfutils: pass -O2 in HOST_CXXFLAGS
    
    Trying to compile elfutils on Fedora 40 with GCC 14.1.1 will fail with:
    /home/robimarko/Building/AX3600/qualcommax/staging_dir/host/bin/g++ -std=c++11 -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/home/robimarko/Building/AX3600/qualcommax/staging_dir/host/share/locale"'  -DDEBUGPRED=0 -DSRCDIR=\"/home/robimarko/Building/AX3600/qualcommax/build_dir/host/elfutils-0.191/src\" -DOBJDIR=\"/home/robimarko/Building/AX3600/qualcommax/build_dir/host/elfutils-0.191/src\" -I. -I..  -I../libgnu -I../libgnu -I. -I. -I../lib -I.. -I./../libelf -I./../libebl -I./../libdw [...]
    In file included from /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h:39,
                     from /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h:2521,
                     from /usr/include/c++/14/cstdlib:41,
                     from ../libgnu/gettext.h:56,
                     from ../libgnu/eu-config.h:62,
                     from ../config.h:2378,
                     from srcfiles.cxx:31:
    /usr/include/features.h:414:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
      414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
          |    ^~~~~~~
    cc1plus: all warnings being treated as errors
    
    So, lets do as the error says and pass -O2 in HOST_CXXFLAGS like we already
    do by default in HOST_CFLAGS.
    
    Link: https://github.com/openwrt/openwrt/pull/15368
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 tools/elfutils/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile
index 39e7f80b4a..0fbf1aedad 100644
--- a/tools/elfutils/Makefile
+++ b/tools/elfutils/Makefile
@@ -68,6 +68,7 @@ ifeq ($(HOST_OS),Darwin)
 endif
 
 HOST_CFLAGS += -Wno-error -fPIC
+HOST_CXXFLAGS += -O2
 
 HOST_CONFIGURE_ARGS += \
 	--without-libintl-prefix \




More information about the lede-commits mailing list