I had some fun doing build testing with older gcc versions, building
every release from 4.0 through 7.0 and running that on my randconfig
setup to see what comes out.
First of all, gcc-4.9 and higher is basically warning-free everywhere,
although gcc-7 introduces some interesting new warnings (I have started
doing patches for those as well). gcc-4.8 is probably good, too, and
gcc-4.6 and 4.7 at least don't produce build failures in general, though
the level of false-positive warnings increases (we could decide to turn
those off for older compilers for build test purposes).
In gcc-4.5 and below, dead code elimination is not as good as later,
causing a couple of link errors, and some of them have no good workaround
(see patch 1). It would be nice to declare that version too old, but
several older distros that are still in wide use ship with compilers
earlier than 4.6:
RHEL6: gcc-4.4
Debian 6: gcc-4.4
Ubuntu 10.04: gcc-4.4
SLES11: gcc-4.3
With gcc-4.3, we need a couple of workaround patches beyond the problem
mentioned above, more configuration options are unavailable and we get
a significant number of false-positive warnings, but it's not much worse
than gcc-4.5 otherwise.
These are the options I had to disable to get gcc-4.3 randconfig builds
working:
CONFIG_HAVE_GCC_PLUGINS
CONFIG_CC_STACKPROTECTOR_STRONG
CONFIG_ARM_SINGLE_ARMV7M
CONFIG_THUMB2_KERNEL
CONFIG_KERNEL_MODE_NEON
CONFIG_VDSO
CONFIG_FUNCTION_TRACER (with CONFIG_FRAME_POINTER=n)
I have not checked in detail which version is required for
each of the above.
Specifically on ARM, going further makes things rather useless especially
for build testing: with gcc-4.2, we lose support for ARMv7, EABI, and
effectively ARMv6 (as it relies on EABI for building reliably). Also,
the number of false-positive build warnings is so high that it is useless
for finding actual bugs from the warnings.
See the replies to this mail for 13 patches I needed to work around
issues for each of the releases before 4.6. I have also submitted
some separate patches for issues that I considered actual bugs
uncovered by the older compilers and that should be applied regardless.
The original gcc-4.3 release was in early 2008. If we decide to still
support that, we probably want the first 10 quirks in this series,
while gcc-4.6 (released in 2011) requires none of them.
Arnd
Arnd Bergmann (13):
[HACK] gcc-4.5: avoid link errors for unused function pointers
KVM: arm: fix gcc-4.5 build
ARM: div64: fix building with gcc-4.5 and lower
vfio-pci: use 32-bit comparisons for register address for gcc-4.5
clk: pxa: fix gcc-4.4 build
ARM: atomic: fix gcc-4.4 build
watchdog: kempld: fix gcc-4.3 build
arm/arm64: xen: avoid gcc-4.4 warning
ARM: mark cmpxchg and xchg __always_inline for gcc-4.3
asm-generic: mark cmpxchg as __always_inline for gcc-4.3
fs: fix unsigned enum warning with gcc-4.2
KVM: arm: avoid binary number literals for gcc-4.2
ARM: avoid 'Q' asm constraint for gcc-4.1 and earlier
arch/arm/include/asm/atomic.h | 10 ++++++++--
arch/arm/include/asm/cmpxchg.h | 12 ++++++------
arch/arm/include/asm/div64.h | 17 +++--------------
arch/arm/include/asm/io.h | 8 ++++++++
arch/arm/include/asm/kvm_mmu.h | 2 +-
arch/arm/include/asm/percpu.h | 5 ++++-
arch/arm/mach-imx/pm-imx5.c | 20 ++++++++++++++++----
arch/arm/mach-sa1100/pm.c | 2 ++
arch/arm/plat-samsung/pm.c | 4 ++++
drivers/clk/pxa/clk-pxa.c | 3 +--
drivers/dma/ti-dma-crossbar.c | 4 ++++
drivers/firmware/psci_checker.c | 3 +++
drivers/iio/adc/exynos_adc.c | 3 +++
drivers/net/ethernet/via/via-rhine.c | 6 ++++++
drivers/vfio/pci/vfio_pci_rdwr.c | 5 ++++-
drivers/watchdog/kempld_wdt.c | 9 ++++++++-
include/asm-generic/cmpxchg-local.h | 7 ++++---
include/linux/fs.h | 2 +-
include/xen/arm/page.h | 1 +
virt/kvm/arm/vgic/vgic-its.c | 4 ++--
virt/kvm/arm/vgic/vgic-mmio-v3.c | 8 ++++----
virt/kvm/arm/vgic/vgic-mmio.c | 16 ++++++++--------
virt/kvm/arm/vgic/vgic-mmio.h | 12 ++++++------
23 files changed, 107 insertions(+), 56 deletions(-)
--
2.9.0
Tree/Branch: master
Git describe: v4.10-10613-gf89db78
Commit: f89db789de Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Build Time: 113 min 16 sec
Passed: 10 / 10 (100.00 %)
Failed: 0 / 10 ( 0.00 %)
Errors: 0
Warnings: 7
Section Mismatches: 0
-------------------------------------------------------------------------------
defconfigs with issues (other than build errors):
7 warnings 0 mismatches : arm-allmodconfig
-------------------------------------------------------------------------------
Warnings Summary: 7
1 ../include/linux/dynamic_debug.h:126:3: warning: 'ept_cfg' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../include/linux/device.h:1479:15: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 ../include/linux/device.h:1474:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 ../drivers/iio/adc/rcar-gyroadc.c:429:27: warning: 'num_channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/iio/adc/rcar-gyroadc.c:428:23: warning: 'channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/iio/adc/rcar-gyroadc.c:426:22: warning: 'sample_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/iio/adc/rcar-gyroadc.c:398:26: warning: 'adcmode' may be used uninitialized in this function [-Wmaybe-uninitialized]
===============================================================================
Detailed per-defconfig build reports below:
-------------------------------------------------------------------------------
arm-allmodconfig : PASS, 0 errors, 7 warnings, 0 section mismatches
Warnings:
../drivers/iio/adc/rcar-gyroadc.c:429:27: warning: 'num_channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/iio/adc/rcar-gyroadc.c:426:22: warning: 'sample_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/iio/adc/rcar-gyroadc.c:428:23: warning: 'channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/iio/adc/rcar-gyroadc.c:398:26: warning: 'adcmode' may be used uninitialized in this function [-Wmaybe-uninitialized]
../include/linux/device.h:1474:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
../include/linux/device.h:1479:15: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
../include/linux/dynamic_debug.h:126:3: warning: 'ept_cfg' may be used uninitialized in this function [-Wmaybe-uninitialized]
-------------------------------------------------------------------------------
Passed with no errors, warnings or mismatches:
arm64-allnoconfig
arm64-allmodconfig
arm-multi_v5_defconfig
arm-multi_v7_defconfig
x86_64-defconfig
arm-allnoconfig
x86_64-allnoconfig
arm-multi_v4t_defconfig
arm64-defconfig
Here are the build results from automated periodic testing.
The tree being built was mainline, found at:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git (master branch)
Topmost commit:
d4f4cf7 Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Build logs (stderr only) can be found at the following link (experimental):
http://arm-soc.lixom.net/buildlogs/mainline/v4.10-10639-gd4f4cf7/
Runtime: 97m 57s
Passed: 125
Failed: 0
Warnings: 9
Section mismatches: 0
-------------------------------------------------------------------------------
Failed defconfigs:
-------------------------------------------------------------------------------
Errors:
Warnings:
1 drivers/iio/adc/rcar-gyroadc.c:398:26: warning: 'adcmode' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/iio/adc/rcar-gyroadc.c:426:22: warning: 'sample_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/iio/adc/rcar-gyroadc.c:428:23: warning: 'channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/iio/adc/rcar-gyroadc.c:429:27: warning: 'num_channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/media/platform/coda/imx-vdoa.c:333:571: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 drivers/media/platform/coda/imx-vdoa.c:333:625: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 drivers/usb/gadget/udc/atmel_usba_udc.c:636:38: warning: 'ept_cfg' may be used uninitialized in this function [-Wmaybe-uninitialized]
2 drivers/media/platform/coda/imx-vdoa.c:333:181: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
No new syscalls
No section mismatches
Here are the build results from automated periodic testing.
The tree being built was mainline, found at:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git (master branch)
Topmost commit:
3f26b0c Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Build logs (stderr only) can be found at the following link (experimental):
http://arm-soc.lixom.net/buildlogs/mainline/v4.10-10604-g3f26b0c/
Runtime: 105m 50s
Passed: 125
Failed: 0
Warnings: 9
Section mismatches: 0
-------------------------------------------------------------------------------
Failed defconfigs:
-------------------------------------------------------------------------------
Errors:
Warnings:
1 drivers/iio/adc/rcar-gyroadc.c:398:26: warning: 'adcmode' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/iio/adc/rcar-gyroadc.c:426:22: warning: 'sample_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/iio/adc/rcar-gyroadc.c:428:23: warning: 'channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/iio/adc/rcar-gyroadc.c:429:27: warning: 'num_channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 drivers/media/platform/coda/imx-vdoa.c:333:571: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 drivers/media/platform/coda/imx-vdoa.c:333:625: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 drivers/usb/gadget/udc/atmel_usba_udc.c:636:38: warning: 'ept_cfg' may be used uninitialized in this function [-Wmaybe-uninitialized]
2 drivers/media/platform/coda/imx-vdoa.c:333:181: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
No new syscalls
No section mismatches
Tree/Branch: master
Git describe: v4.10-10531-g86292b3
Commit: 86292b33d4 Merge branch 'akpm' (patches from Andrew)
Build Time: 113 min 26 sec
Passed: 10 / 10 (100.00 %)
Failed: 0 / 10 ( 0.00 %)
Errors: 0
Warnings: 7
Section Mismatches: 0
-------------------------------------------------------------------------------
defconfigs with issues (other than build errors):
7 warnings 0 mismatches : arm-allmodconfig
-------------------------------------------------------------------------------
Warnings Summary: 7
1 ../include/linux/dynamic_debug.h:126:3: warning: 'ept_cfg' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../include/linux/device.h:1479:15: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 ../include/linux/device.h:1474:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1 ../drivers/iio/adc/rcar-gyroadc.c:429:27: warning: 'num_channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/iio/adc/rcar-gyroadc.c:428:23: warning: 'channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/iio/adc/rcar-gyroadc.c:426:22: warning: 'sample_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 ../drivers/iio/adc/rcar-gyroadc.c:398:26: warning: 'adcmode' may be used uninitialized in this function [-Wmaybe-uninitialized]
===============================================================================
Detailed per-defconfig build reports below:
-------------------------------------------------------------------------------
arm-allmodconfig : PASS, 0 errors, 7 warnings, 0 section mismatches
Warnings:
../drivers/iio/adc/rcar-gyroadc.c:429:27: warning: 'num_channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/iio/adc/rcar-gyroadc.c:426:22: warning: 'sample_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/iio/adc/rcar-gyroadc.c:428:23: warning: 'channels' may be used uninitialized in this function [-Wmaybe-uninitialized]
../drivers/iio/adc/rcar-gyroadc.c:398:26: warning: 'adcmode' may be used uninitialized in this function [-Wmaybe-uninitialized]
../include/linux/device.h:1474:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
../include/linux/device.h:1479:15: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
../include/linux/dynamic_debug.h:126:3: warning: 'ept_cfg' may be used uninitialized in this function [-Wmaybe-uninitialized]
-------------------------------------------------------------------------------
Passed with no errors, warnings or mismatches:
arm64-allnoconfig
arm64-allmodconfig
arm-multi_v5_defconfig
arm-multi_v7_defconfig
x86_64-defconfig
arm-allnoconfig
x86_64-allnoconfig
arm-multi_v4t_defconfig
arm64-defconfig