Fix x86_64 build of mmconfig.c
PATCH 1/1 Fix x86_64 build of mmconfig.c
gcc -Wp,-MD,arch/x86_64/pci/.mmconfig.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/include -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci -Iarch/x86_64/pci -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -O2 -fomit-frame-pointer -Wdeclaration-after-statement -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/ -I arch/i386/pci -DKBUILD_BASENAME=mmconfig -DKBUILD_MODNAME=mmconfig -c -o arch/x86_64/pci/mmconfig.o /build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c
/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c:10:17: pci.h: No such file or directory
x86_64/pci/Makefile renamed from x86_64/pci/Makefile.orig +1 -1
@@ -3,7 +3,7 @@ # # Reuse the i386 PCI subsystem # -CFLAGS += -I arch/i386/pci +CFLAGS += -Iarch/i386/pci obj-y := i386.o obj-$(CONFIG_PCI_DIRECT)+= direct.o
x86_64/pci/Makefile line 6
Quoted 13 lines · On Thu, 05 Aug 2004 10:48:16 -0700 Tom Duffy <[email protected]> wrote:
Signed-by Tom Duffy <[email protected]>gcc -Wp,-MD,arch/x86_64/pci/.mmconfig.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/include -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci -Iarch/x86_64/pci -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -O2 -fomit-frame-pointer -Wdeclaration-after-statement -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/ -I
arch/i386/pci-DKBUILD_BASENAME=mmconfig -DKBUILD_MODNAME=mmconfig -c -oarch/x86_64/pci/mmconfig.o/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c
/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c:10:17:pci.h: No such file or directoryx86_64/pci/Makefile renamed from x86_64/pci/Makefile.orig +1
-1@@ -3,7 +3,7 @@ # # Reuse the i386 PCI subsystem # -CFLAGS += -I arch/i386/pci +CFLAGS += -Iarch/i386/pci
It never failed this way for me in hundreds of builds. Why is it failing for you? What gcc version do you use?
Normally -Ifoo and -I foo should be really equivalent.
-Andi
Quoted 1 line · Andi Kleen
It never failed this way for me in hundreds of builds. Why is it failing for you?
I don't know.
Quoted 1 line
What gcc version do you use?
$ gcc -v Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.3.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- infodir=/usr/share/info --enable-shared --enable-threads=posix -- disable-checking --disable-libunwind-exceptions --with-system-zlib -- enable-__cxa_atexit --host=x86_64-redhat-linux Thread model: posix gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
Quoted 1 line
Normally -Ifoo and -I foo should be really equivalent.
You'd think. It seems that everywhere else in the kernel, there is no space in between -I and dir.
[linux-2.6.8-rc3]$ find -name Makefile -exec grep -H \\-I {} \; ./arch/i386/mach-generic/Makefile:EXTRA_CFLAGS += -I../kernel
./arch/i386/Makefile:mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-i386/mach-voyager
./arch/i386/Makefile:mflags-$(CONFIG_X86_VISWS) := -Iinclude/asm-i386/mach-visws./arch/i386/Makefile:mflags-$(CONFIG_X86_NUMAQ) := -Iinclude/asm-i386/mach-numaq./arch/i386/Makefile:mflags-$(CONFIG_X86_BIGSMP) := -Iinclude/asm-i386/mach-bigsmp
./arch/i386/Makefile:mflags-$(CONFIG_X86_SUMMIT) := -Iinclude/asm-i386/mach-summit ./arch/i386/Makefile:mflags-$(CONFIG_X86_GENERICARCH) := -Iinclude/asm-i386/mach-generic
./arch/i386/Makefile:mflags-$(CONFIG_X86_ES7000) := -Iinclude/asm-i386/mach-es7000
./arch/i386/Makefile:mflags-y += -Iinclude/asm-i386/mach-default ./arch/i386/mach-voyager/Makefile:EXTRA_CFLAGS += -I../kernel ./arch/i386/boot/Makefile:HOSTCFLAGS_build.o := -Iinclude ./arch/sparc64/kernel/Makefile:CFLAGS_ioctl32.o += -Ifs/ ./arch/sparc64/math-emu/Makefile:EXTRA_CFLAGS = -I. -Iinclude/math-emu -w
./arch/ppc/boot/lib/Makefile:CFLAGS_kbd.o += -Idrivers/char
./arch/ppc/boot/Makefile:CFLAGS += -fno-builtin -D__BOOTER__ -Iarch/$(ARCH)/boot/include
./arch/ppc/boot/Makefile:HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
./arch/ppc/platforms/Makefile:CFLAGS_pmac_setup.o += -Iarch/$(ARCH)/mm
./arch/ppc/Makefile:CPPFLAGS += -Iarch/$(ARCH) ./arch/ppc/Makefile:aflags-y += -Iarch/$(ARCH) ./arch/ppc/Makefile:cflags-y += -Iarch/$(ARCH) -msoft-float -pipe \
./arch/mips/lasat/image/Makefile: $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
./arch/mips/kernel/Makefile:CFLAGS_ioctl32.o += -Ifs/
./arch/mips/Makefile:cflags-y := -I $(TOPDIR)/include/asm/gcc
./arch/mips/Makefile:cflags-$(CONFIG_MACH_JAZZ) += -Iinclude/asm-mips/mach-jazz
./arch/mips/Makefile:cflags-$(CONFIG_SOC_AU1X00) += -Iinclude/asm-mips/mach-au1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_PB1000) += -Iinclude/asm-mips/mach-pb1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_PB1100) += -Iinclude/asm-mips/mach-pb1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_PB1500) += -Iinclude/asm-mips/mach-pb1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_PB1550) += -Iinclude/asm-mips/mach-pb1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_DB1000) += -Iinclude/asm-mips/mach-db1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_DB1100) += -Iinclude/asm-mips/mach-db1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_DB1500) += -Iinclude/asm-mips/mach-db1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_BOSPORUS) += -Iinclude/asm-mips/mach-db1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_MIRAGE) += -Iinclude/asm-mips/mach-db1x00 ./arch/mips/Makefile:cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_EV64120) += -Iinclude/asm-mips/mach-ev64120 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_EV96100) += -Iinclude/asm-mips/mach-ev96100 ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-atlas ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-mips ./arch/mips/Makefile:cflags-$(CONFIG_MIPS_MALTA) += -Iinclude/asm-mips/mach-mips ./arch/mips/Makefile:cflags-$(CONFIG_MOMENCO_OCELOT) += -Iinclude/asm-mips/mach-ocelot ./arch/mips/Makefile:cflags-$(CONFIG_PMC_YOSEMITE) += -Iinclude/asm-mips/mach-yosemite
./arch/mips/Makefile:cflags-$(CONFIG_MOMENCO_JAGUAR_ATX) += -Iinclude/asm-mips/mach-ja
./arch/mips/Makefile:cflags-$(CONFIG_LASAT) += -Iinclude/asm-mips/mach-lasat
./arch/mips/Makefile:cflags-$(CONFIG_MACH_VR41XX) += -Iinclude/asm-mips/mach-vr41xx
./arch/mips/Makefile:cflags-$(CONFIG_SGI_IP22) += -Iinclude/asm-mips/mach-ip22
./arch/mips/Makefile:# SGI-IP27 (Origin200/2000)
./arch/mips/Makefile:cflags-$(CONFIG_SGI_IP27) += -Iinclude/asm-mips/mach-ip27
./arch/mips/Makefile:# SGI-IP32 (O2)
./arch/mips/Makefile:cflags-$(CONFIG_SGI_IP32) += -Iinclude/asm-mips/mach-ip32
./arch/mips/Makefile:cflags-$(CONFIG_SNI_RM200_PCI) += -Iinclude/asm-mips/mach-rm200
./arch/mips/Makefile:cflags-y += -Iinclude/asm-mips/mach-generic
./arch/sparc/math-emu/Makefile:EXTRA_CFLAGS = -I. -I$(TOPDIR)/include/math-emu -w./arch/um/kernel/Makefile: -I/usr/include -I../include
./arch/um/sys-ppc/Makefile:EXTRA_AFLAGS := -DCONFIG_PPC32 -I. -I$(TOPDIR)/arch/ppc/kernel ./arch/um/Makefile:ARCH_INCLUDE = -I$(ARCH_DIR)/include
./arch/um/Makefile:USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
./arch/cris/arch-v10/boot/compressed/Makefile:CC = gcc-cris -melf -I $(TOPDIR)/include ./arch/cris/arch-v10/boot/rescue/Makefile:CC = gcc-cris -mlinux -I $(TOPDIR)/include
./arch/m68k/Makefile:CHECK := $(CHECK) -D__mc68000__=1 -I$(shell $(CC) -print-file-name=include) ./arch/ia64/ia32/Makefile:CFLAGS_ia32_ioctl.o += -Ifs/
./arch/ppc64/kernel/Makefile:CFLAGS_ioctl32.o += -Ifs/
./arch/ppc64/boot/Makefile:BOOTCFLAGS := $(HOSTCFLAGS) -Iinclude -fno-builtin
./arch/parisc/kernel/Makefile:CFLAGS_ioctl32.o := -Ifs/
./arch/v850/Makefile:OBJCOPY_FLAGS_BLOB := -I binary -O elf32-little -B v850e ./arch/x86_64/ia32/Makefile:CFLAGS_ia32_ioctl.o += -Ifs/
./arch/x86_64/boot/compressed/Makefile:CFLAGS := -m32 -D__KERNEL__ -Iinclude -O2
./arch/x86_64/pci/Makefile:CFLAGS += -Iarch/i386/pci
./arch/s390/math-emu/Makefile:EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w
./arch/s390/boot/Makefile:EXTRA_CFLAGS := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I. ./drivers/net/sk98lin/Makefile:EXTRA_CFLAGS += -Idrivers/net/sk98lin -DSK_DIAG_SUPPORT -DSK_USE_CSUM -DGENESIS -DYUKON $(DBGDEF) $(SKPARAM) ./drivers/net/wireless/prism54/Makefile:EXTRA_CFLAGS = -I$(PWD) #-DCONFIG_PRISM54_WDS ./drivers/net/skfp/Makefile:EXTRA_CFLAGS += -Idrivers/net/skfp -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes ./drivers/net/wan/lmc/Makefile:EXTRA_CFLAGS += -I. $(DBGDEF)./drivers/net/wan/Makefile: $(CPP) -Wp,-MD,$(depfile) -I$(srctree)/include $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
./drivers/media/video/saa7134/Makefile:EXTRA_CFLAGS = -I$(src)/..
./drivers/media/video/cx88/Makefile:EXTRA_CFLAGS = -I$(src)/..
./drivers/media/dvb/frontends/Makefile:EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ ./drivers/media/dvb/ttusb-budget/Makefile:EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ ./drivers/media/dvb/bt8xx/Makefile:EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video -Idrivers/media/dvb/frontends ./drivers/media/dvb/ttpci/Makefile:EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ ./drivers/media/dvb/b2c2/Makefile:EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ ./drivers/media/dvb/ttusb-dec/Makefile:EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
./drivers/usb/storage/Makefile:EXTRA_CFLAGS := -Idrivers/scsi
./drivers/scsi/aic7xxx/aicasm/Makefile:AICASM_CFLAGS:= -I/usr/include -I. ./drivers/scsi/aic7xxx/Makefile:EXTRA_CFLAGS += -Idrivers/scsi./drivers/scsi/aic7xxx/Makefile: $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic7xxx_reg.h \./drivers/scsi/aic7xxx/Makefile: $(obj)/aicasm/aicasm -I$(src) -r $(obj)/aic79xx_reg.h \
./drivers/scsi/pcmcia/Makefile:EXTRA_CFLAGS += -Idrivers/scsi
./drivers/scsi/aacraid/Makefile:EXTRA_CFLAGS := -Idrivers/scsi
./drivers/ide/pci/Makefile:EXTRA_CFLAGS := -Idrivers/ide
./drivers/ide/legacy/Makefile:EXTRA_CFLAGS := -Idrivers/ide
./drivers/ide/arm/Makefile:EXTRA_CFLAGS := -Idrivers/ide
./drivers/ide/Makefile:EXTRA_CFLAGS += -Idrivers/ide./drivers/atm/Makefile: objcopy -Iihex $< -Obinary [email protected]
./drivers/md/raid6test/Makefile:CFLAGS = -I.. -g $(OPTFLAGS)
./fs/xfs/Makefile:EXTRA_CFLAGS += -Ifs/xfs -Ifs/xfs/linux-2.6 -funsigned-char./fs/smbfs/Makefile: cproto -E "gcc -E" -e -v -I $(TOPDIR)/include -DMAKING_PROTO -D__KERNEL__ $(SRC) >> proto2.h
./scripts/kconfig/Makefile:HOSTCFLAGS_lex.zconf.o := -I$(src)
./scripts/kconfig/Makefile:HOSTCFLAGS_zconf.tab.o := -I$(src)
./scripts/kconfig/Makefile:HOSTCXXFLAGS_qconf.o = -I$(QTDIR)/include./scripts/lxdialog/Makefile: HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"./scripts/lxdialog/Makefile: HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"
./scripts/genksyms/Makefile:# -I needed for generated C source (shipped source) ./scripts/genksyms/Makefile:HOSTCFLAGS_parse.o := -Wno-uninitialized -I$(src)
./scripts/genksyms/Makefile:# -I needed for generated C source (shipped source) ./scripts/genksyms/Makefile:HOSTCFLAGS_lex.o := -I$(src)
./security/selinux/Makefile:EXTRA_CFLAGS += -Isecurity/selinux/include
./security/selinux/ss/Makefile:EXTRA_CFLAGS += -Isecurity/selinux/include
./Makefile:CPPFLAGS := -D__KERNEL__ -Iinclude \
./Makefile: $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
./Makefile:# Exuberant ctags works better with -I
./Makefile: CTAGSF=ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"; \
-tduffy
Quoted 20 lines · Andi Kleen
x86_64/pci/Makefile line 6
Quoted 13 lines · On Thu, 05 Aug 2004 10:48:16 -0700 Tom Duffy <[email protected]> wrote:
Signed-by Tom Duffy <[email protected]>gcc -Wp,-MD,arch/x86_64/pci/.mmconfig.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/include -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci -Iarch/x86_64/pci -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -O2 -fomit-frame-pointer -Wdeclaration-after-statement -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/ -I
arch/i386/pci-DKBUILD_BASENAME=mmconfig -DKBUILD_MODNAME=mmconfig -c -oarch/x86_64/pci/mmconfig.o/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c
/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c:10:17:pci.h: No such file or directoryx86_64/pci/Makefile renamed from x86_64/pci/Makefile.orig +1
-1@@ -3,7 +3,7 @@ # # Reuse the i386 PCI subsystem # -CFLAGS += -I arch/i386/pci +CFLAGS += -Iarch/i386/pciIt never failed this way for me in hundreds of builds. Why is it failing for you? What gcc version do you use?
Quoted 1 line
Normally -Ifoo and -I foo should be really equivalent.
Notice the originally poster uses the make O=dir syntax - visible from the include2 directory being present on the commandline.
This issue is kbuild related. When using 'make O=dir' syntax kbuild process options passed to gcc, and all -Isomething are processed. Whitin the limits of the make syntax it it not easy to handle -I something. When I originally implemented this I grepped the kernel and did not find any uses of -I something, but only -Isomething.
I may easy have overlooked one.
And to the easy answer: fix kbuild.
If anyone can see a way to fix this using make syntax please let me know. I did not find the answer.
The lines to pay attention to are in Makefile.lib where cflags are processed.
Escaping to a shell is no option since this would be needed for all .o files even in an otherwise noop build.
That's because all flags has to be evaluated each time to check if the flags changed.
Sam
Quoted 21 lines · On Thu, 5 Aug 2004 22:54:01 +0200 Sam Ravnborg <[email protected]> wrote:
Quoted 20 lines · Andi Kleen
x86_64/pci/Makefile line 6
Quoted 13 lines · On Thu, 05 Aug 2004 10:48:16 -0700 Tom Duffy <[email protected]> wrote:
Signed-by Tom Duffy <[email protected]>gcc -Wp,-MD,arch/x86_64/pci/.mmconfig.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/include -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci -Iarch/x86_64/pci -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -O2 -fomit-frame-pointer -Wdeclaration-after-statement -I/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/ -I
arch/i386/pci-DKBUILD_BASENAME=mmconfig -DKBUILD_MODNAME=mmconfig -c -oarch/x86_64/pci/mmconfig.o/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c
/build1/tduffy/openib-work/linux-2.6.8-rc3-openib/arch/x86_64/pci/mmconfig.c:10:17:pci.h: No such file or directoryx86_64/pci/Makefile renamed from x86_64/pci/Makefile.orig +1
-1@@ -3,7 +3,7 @@ # # Reuse the i386 PCI subsystem # -CFLAGS += -I arch/i386/pci +CFLAGS += -Iarch/i386/pciIt never failed this way for me in hundreds of builds. Why is it failing for you? What gcc version do you use?
Quoted 7 lines
Quoted 1 line
Normally -Ifoo and -I foo should be really equivalent.
Notice the originally poster uses the make O=dir syntax - visible from the include2 directory being present on the commandline.
This issue is kbuild related. When using 'make O=dir' syntax kbuild process options passed to gcc, and all -Isomething are processed.
[...]
Thanks for the explanation, Sam. I don't use O=, so this would explain it. I added the change for now.
-Andi