Skip to content

Commit

Permalink
git: Set PKG_FORTIFY_SOURCE to 0 when lto enabled
Browse files Browse the repository at this point in the history
If has FORTIFY_SOURCE=y and CONFIG_USE_LTO=y in build config, git will
fail to compile with the following example error:

/openwrt/staging_dir/toolchain-aarch64_generic_gcc-14.1.0_musl/include/stdio.h: In function 'process_curl_messages':
/openwrt/staging_dir/toolchain-aarch64_generic_gcc-14.1.0_musl/include/stdio.h:90:8: error: inlining failed in call to 'always_inline' 'fwrite': function body can be overwritten at link time
   90 | size_t fwrite(const void *__restrict, size_t, size_t, FILE *__restrict);
      |        ^
http.c:355:33: note: called from here
  355 |                                 fprintf(stderr, "Received DONE message for unknown request!\n");
      |                                 ^

A related issue is openwrt#13016 .
This commit set PKG_FORTIFY_SOURCE to 0 if CONFIG_USE_LTO is y.

Close: openwrt#24366
Link: https://lore.kernel.org/git/CAHfWF5mjquES-nocQaK+CAEsqWgdy-_OYdGtN82heYs0eJP3eQ@mail.gmail.com/T/#t
Link: openwrt/openwrt#13016
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110834
Signed-off-by: Ryan Keane <[email protected]>
  • Loading branch information
Ra2-IFV committed Nov 13, 2024
1 parent 1116792 commit b47f6ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/git/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ define Package/git-gitweb/conffiles
/etc/gitweb.conf
endef

ifeq ($(CONFIG_USE_LTO),y)
PKG_FORTIFY_SOURCE:=0
endif

MAKE_FLAGS := \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
Expand Down

0 comments on commit b47f6ca

Please sign in to comment.