diff mbox

[v2] kbuild: Enable Large File Support for hostprogs

Message ID 20170709180236.25184-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Uwe Kleine-König July 9, 2017, 6:02 p.m. UTC
This fixes the following build error for me when building on an 32 bit
machine using an XFS file system:

	$ make scripts/basic/fixdep
	  HOSTCC  scripts/basic/fixdep
	fixdep: error fstat'ing depfile: scripts/basic/.fixdep.d: Value too large for defined data type

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since v1:
 - rebase on current linus/master (conflicts with 9f3f1fd29976 ("kbuild: Add __cc-option macro"))
 - also add HOST_LFS_CFLAGS to HOSTCXXFLAGS

 Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Masahiro Yamada July 10, 2017, 3:28 p.m. UTC | #1
2017-07-10 3:02 GMT+09:00 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> This fixes the following build error for me when building on an 32 bit
> machine using an XFS file system:
>
>         $ make scripts/basic/fixdep
>           HOSTCC  scripts/basic/fixdep
>         fixdep: error fstat'ing depfile: scripts/basic/.fixdep.d: Value too large for defined data type
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Changes since v1:
>  - rebase on current linus/master (conflicts with 9f3f1fd29976 ("kbuild: Add __cc-option macro"))
>  - also add HOST_LFS_CFLAGS to HOSTCXXFLAGS
>
>  Makefile | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 06ef9947cf7c..7c901e644bf6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -294,10 +294,16 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
>           else if [ -x /bin/bash ]; then echo /bin/bash; \
>           else echo sh; fi ; fi)
>
> +HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS)
> +HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS)
> +HOST_LFS_LIBS := $(shell getconf LFS_LIBS)
> +
>  HOSTCC       = gcc
>  HOSTCXX      = g++
> -HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
> -HOSTCXXFLAGS = -O2
> +HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS)
> +HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS)
> +HOST_LOADLIBES := $(HOST_LFS_LIBS)
> +HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS)
>
>  ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
>  HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \
> @@ -408,7 +414,7 @@ KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(S
>
>  export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
>  export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
> -export CPP AR NM STRIP OBJCOPY OBJDUMP
> +export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES
>  export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
>  export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
>

Applied to linux-kbuild with Ben's Acked-by.  Thanks!


I slightly fixed up locally:
 - HOSTCFLAGS is too long now.  I wrapped the line with 80 cols.
 - Make HOSTCFLAGS and HOSTCXXFLAGS lined up.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 06ef9947cf7c..7c901e644bf6 100644
--- a/Makefile
+++ b/Makefile
@@ -294,10 +294,16 @@  CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
 	  else echo sh; fi ; fi)
 
+HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS)
+HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS)
+HOST_LFS_LIBS := $(shell getconf LFS_LIBS)
+
 HOSTCC       = gcc
 HOSTCXX      = g++
-HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
-HOSTCXXFLAGS = -O2
+HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS)
+HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS)
+HOST_LOADLIBES := $(HOST_LFS_LIBS)
+HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS)
 
 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
 HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \
@@ -408,7 +414,7 @@  KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(S
 
 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
-export CPP AR NM STRIP OBJCOPY OBJDUMP
+export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES
 export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS