Skip to content

Commit

Permalink
glib2: disable FORTIFY_SOURCE on powerpc64
Browse files Browse the repository at this point in the history
It seems, that powerpc64 is still not able to compile glib2 with
FORTIFY_SOURCE enabled:

 [81/481] Compiling C object glib/libglib-2.0.so.0.7400.0.p/gkeyfile.c.o
 FAILED: glib/libglib-2.0.so.0.7400.0.p/gkeyfile.c.o
 powerpc64-openwrt-linux-musl-gcc -Iglib/libglib-2.0.so.0.7400.0.p -Iglib -I../glib -I. -I.. -Iopenwrt/staging_dir/target-powerpc64_e5500_musl/usr/include -Iopenwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/usr/include -Iopenwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include/fortify -Iopenwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Werror=unused-result -Wstrict-prototypes -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pointer-sign -Os -pipe -mcpu=e5500 -g3 -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=openwrt/build_dir/target-powerpc64_e5500_musl/glib-2.74.0=glib-2.74.0 -ffunction-sections -fdata-sections -DPIC -fpic -fstack-protector-strong -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fPIC -pthread '-DG_LOG_DOMAIN="GLib"' -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/libglib-2.0.so.0.7400.0.p/gkeyfile.c.o -MF glib/libglib-2.0.so.0.7400.0.p/gkeyfile.c.o.d -o glib/libglib-2.0.so.0.7400.0.p/gkeyfile.c.o -c ../glib/gkeyfile.c
 In file included from ../glib/gkeyfile.c:35:
 openwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include/fortify/stdio.h: In function 'snprintf':
 openwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include/fortify/stdio.h:101:9: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   101 |         return __orig_snprintf(__s, __n, __f, __builtin_va_arg_pack());
       |         ^~~~~~
 openwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include/fortify/stdio.h: In function 'sprintf':
 openwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include/fortify/stdio.h:110:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   110 |                 __r = __orig_snprintf(__s, __b, __f, __builtin_va_arg_pack());
       |                 ^~~
 openwrt/staging_dir/toolchain-powerpc64_e5500_gcc-12.3.0_musl/include/fortify/stdio.h:114:17: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
   114 |                 __r = __orig_sprintf(__s, __f, __builtin_va_arg_pack());
       |                 ^~~
 cc1: some warnings being treated as errors

So lets enable PKG_FORTIFY_SOURCE workaround on the affected platform
only.

References: openwrt#21467 (comment)
Signed-off-by: Petr Štetiar <ynezz@true.cz>
  • Loading branch information
ynezz committed Jun 29, 2023
1 parent 377a1bc commit db43e10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/glib2/Makefile
Expand Up @@ -27,6 +27,10 @@ PKG_BUILD_FLAGS:=gc-sections
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/glib-$(PKG_VERSION)
HOST_BUILD_DEPENDS:=pcre2/host libffi/host

ifdef CONFIG_powerpc64
PKG_FORTIFY_SOURCE:=0
endif

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
Expand Down

0 comments on commit db43e10

Please sign in to comment.