stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>,
	George Spelvin <lkml@sdf.org>,
	Nathan Chancellor <natechancellor@gmail.com>
Subject: [PATCH 5.5 118/119] kconfig: introduce m32-flag and m64-flag
Date: Tue, 24 Mar 2020 14:11:43 +0100	[thread overview]
Message-ID: <20200324130819.320806799@linuxfoundation.org> (raw)
In-Reply-To: <20200324130808.041360967@linuxfoundation.org>

From: Masahiro Yamada <masahiroy@kernel.org>

commit 8cc4fd73501d9f1370c3eebb70cfe8cc9e24062b upstream.

When a compiler supports multiple architectures, some compiler features
can be dependent on the target architecture.

This is typical for Clang, which supports multiple LLVM backends.
Even for GCC, we need to take care of biarch compiler cases.

It is not a problem when we evaluate cc-option in Makefiles because
cc-option is tested against the flag in question + $(KBUILD_CFLAGS).

The cc-option in Kconfig, on the other hand, does not accumulate
tested flags. Due to this simplification, it could potentially test
cc-option against a different target.

At first, Kconfig always evaluated cc-option against the host
architecture.

Since commit e8de12fb7cde ("kbuild: Check for unknown options with
cc-option usage in Kconfig and clang"), in case of cross-compiling
with Clang, the target triple is correctly passed to Kconfig.

The case with biarch GCC (and native build with Clang) is still not
handled properly. We need to pass some flags to specify the target
machine bit.

Due to the design, all the macros in Kconfig are expanded in the
parse stage, where we do not know the target bit size yet.

For example, arch/x86/Kconfig allows a user to toggle CONFIG_64BIT.
If a compiler flag -foo depends on the machine bit, it must be tested
twice, one with -m32 and the other with -m64.

However, -m32/-m64 are not always recognized. So, this commits adds
m64-flag and m32-flag macros. They expand to -m32, -m64, respectively
if supported. Or, they expand to an empty string if unsupported.

The typical usage is like this:

  config FOO
          bool
          default $(cc-option,$(m64-flag) -foo) if 64BIT
          default $(cc-option,$(m32-flag) -foo)

This is clumsy, but there is no elegant way to handle this in the
current static macro expansion.

There was discussion for static functions vs dynamic functions.
The consensus was to go as far as possible with the static functions.
(https://lkml.org/lkml/2018/3/2/22)

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: George Spelvin <lkml@sdf.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 scripts/Kconfig.include |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -40,3 +40,10 @@ $(error-if,$(success, $(LD) -v | grep -q
 
 # gcc version including patch level
 gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
+
+# machine bit flags
+#  $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise.
+#  $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise.
+cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1))
+m32-flag := $(cc-option-bit,-m32)
+m64-flag := $(cc-option-bit,-m64)



  parent reply	other threads:[~2020-03-24 13:28 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 13:09 [PATCH 5.5 000/119] 5.5.12-rc1 review Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 001/119] locks: fix a potential use-after-free problem when wakeup a waiter Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 002/119] locks: reinstate locks_delete_block optimization Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 003/119] spi: spi-omap2-mcspi: Support probe deferral for DMA channels Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 004/119] drm/mediatek: Find the cursor plane instead of hard coding it Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 005/119] drm/mediatek: Ensure the cursor plane is on top of other overlays Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 006/119] phy: ti: gmii-sel: fix set of copy-paste errors Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 007/119] phy: ti: gmii-sel: do not fail in case of gmii Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 008/119] ARM: dts: dra7-l4: mark timer13-16 as pwm capable Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 009/119] spi: qup: call spi_qup_pm_resume_runtime before suspending Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 010/119] powerpc: Include .BTF section Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 011/119] cifs: fix potential mismatch of UNC paths Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 012/119] cifs: add missing mount option to /proc/mounts Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 013/119] ARM: dts: dra7: Add "dma-ranges" property to PCIe RC DT nodes Greg Kroah-Hartman
2020-03-24 13:09 ` [PATCH 5.5 014/119] spi: pxa2xx: Add CS control clock quirk Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 015/119] spi/zynqmp: remove entry that causes a cs glitch Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 016/119] ARM: dts: bcm283x: Add missing properties to the PWR LED Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 017/119] drm/exynos: dsi: propagate error value and silence meaningless warning Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 018/119] drm/exynos: dsi: fix workaround for the legacy clock name Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 019/119] drm/exynos: hdmi: dont leak enable HDMI_EN regulator if probe fails Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 020/119] drivers/perf: fsl_imx8_ddr: Correct the CLEAR bit definition Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 021/119] drivers/perf: arm_pmu_acpi: Fix incorrect checking of gicc pointer Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 022/119] io-wq: fix IO_WQ_WORK_NO_CANCEL cancellation Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 023/119] ARM: bcm2835_defconfig: Explicitly restore CONFIG_DEBUG_FS Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 024/119] altera-stapl: altera_get_note: prevent write beyond end of key Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 025/119] dm bio record: save/restore bi_end_io and bi_integrity Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 026/119] dm integrity: use dm_bio_record and dm_bio_restore Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 027/119] riscv: avoid the PIC offset of static percpu data in module beyond 2G limits Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 028/119] ASoC: stm32: sai: manage rebind issue Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 029/119] spi: spi_register_controller(): free bus id on error paths Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 030/119] riscv: Force flat memory model with no-mmu Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 031/119] riscv: Fix range looking for kernel image memblock Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 032/119] drm/amdgpu: clean wptr on wb when gpu recovery Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 033/119] drm/amd/display: Clear link settings on MST disable connector Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 034/119] drm/amd/display: fix dcc swath size calculations on dcn1 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 035/119] xenbus: req->body should be updated before req->state Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 036/119] xenbus: req->err " Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 037/119] riscv: fix seccomp reject syscall code path Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 038/119] parse-maintainers: Mark as executable Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 039/119] io_uring: fix lockup with timeouts Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 040/119] binderfs: use refcount for binder control devices too Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 041/119] Revert "drm/fbdev: Fallback to non tiled mode if all tiles not present" Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 042/119] USB: Disable LPM on WD19s Realtek Hub Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 043/119] usb: quirks: add NO_LPM quirk for RTL8153 based ethernet adapters Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 044/119] USB: serial: option: add ME910G1 ECM composition 0x110b Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 045/119] usb: chipidea: udc: fix sleeping function called from invalid context Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 046/119] usb: host: xhci-plat: add a shutdown Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 047/119] USB: serial: pl2303: add device-id for HP LD381 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 048/119] usb: xhci: apply XHCI_SUSPEND_DELAY to AMD XHCI controller 1022:145c Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 049/119] usb: typec: ucsi: displayport: Fix NULL pointer dereference Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 050/119] usb: typec: ucsi: displayport: Fix a potential race during registration Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 051/119] USB: cdc-acm: fix close_delay and closing_wait units in TIOCSSERIAL Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 052/119] USB: cdc-acm: fix rounding error " Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 053/119] ALSA: line6: Fix endless MIDI read loop Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 054/119] ALSA: hda/realtek - Enable headset mic of Acer X2660G with ALC662 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 055/119] ALSA: hda/realtek - Enable the headset of Acer N50-600 " Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 056/119] ALSA: seq: virmidi: Fix running status after receiving sysex Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 057/119] ALSA: seq: oss: " Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 058/119] ALSA: pcm: oss: Avoid plugin buffer overflow Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 059/119] ALSA: pcm: oss: Remove WARNING from snd_pcm_plug_alloc() checks Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 060/119] tty: fix compat TIOCGSERIAL leaking uninitialized memory Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 061/119] tty: fix compat TIOCGSERIAL checking wrong function ptr Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 062/119] iio: chemical: sps30: fix missing triggered buffer dependency Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 063/119] iio: st_sensors: remap SMO8840 to LIS2DH12 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 064/119] iio: trigger: stm32-timer: disable master mode when stopping Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 065/119] iio: accel: adxl372: Set iio_chan BE Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 066/119] iio: magnetometer: ak8974: Fix negative raw values in sysfs Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 067/119] iio: adc: stm32-dfsdm: fix sleep in atomic context Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 068/119] iio: adc: at91-sama5d2_adc: fix differential channels in triggered mode Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 069/119] iio: light: vcnl4000: update sampling periods for vcnl4200 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 070/119] iio: light: vcnl4000: update sampling periods for vcnl4040 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 071/119] mmc: rtsx_pci: Fix support for speed-modes that relies on tuning Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 072/119] mmc: sdhci-of-at91: fix cd-gpios for SAMA5D2 Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 073/119] mmc: sdhci-cadence: set SDHCI_QUIRK2_PRESET_VALUE_BROKEN for UniPhier Greg Kroah-Hartman
2020-03-24 13:10 ` [PATCH 5.5 074/119] mmc: sdhci-acpi: Switch signal voltage back to 3.3V on suspend on external microSD on Lenovo Miix 320 Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 075/119] mmc: sdhci-acpi: Disable write protect detection on Acer Aspire Switch 10 (SW5-012) Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 076/119] CIFS: fiemap: do not return EINVAL if get nothing Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 077/119] kbuild: Disable -Wpointer-to-enum-cast Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 078/119] staging: rtl8188eu: Add device id for MERCUSYS MW150US v2 Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 079/119] staging: greybus: loopback_test: fix poll-mask build breakage Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 080/119] staging/speakup: fix get_word non-space look-ahead Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 081/119] intel_th: msu: Fix the unexpected state warning Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 082/119] intel_th: Fix user-visible error codes Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 083/119] intel_th: pci: Add Elkhart Lake CPU support Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 084/119] modpost: move the namespace field in Module.symvers last Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 085/119] rtc: max8907: add missing select REGMAP_IRQ Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 086/119] arm64: compat: Fix syscall number of compat_clock_getres Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 087/119] xhci: Do not open code __print_symbolic() in xhci trace events Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 088/119] btrfs: fix log context list corruption after rename whiteout error Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 089/119] drm/amd/amdgpu: Fix GPR read from debugfs (v2) Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 090/119] drm/lease: fix WARNING in idr_destroy Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 091/119] stm class: sys-t: Fix the use of time_after() Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 092/119] memcg: fix NULL pointer dereference in __mem_cgroup_usage_unregister_event Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 093/119] mm, memcg: fix corruption on 64-bit divisor in memory.high throttling Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 094/119] mm, memcg: throttle allocators based on ancestral memory.high Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 095/119] mm/hotplug: fix hot remove failure in SPARSEMEM|!VMEMMAP case Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 096/119] mm: do not allow MADV_PAGEOUT for CoW pages Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 097/119] epoll: fix possible lost wakeup on epoll_ctl() path Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 098/119] mm: slub: be more careful about the double cmpxchg of freelist Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 099/119] mm, slub: prevent kmalloc_node crashes and memory leaks Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 100/119] page-flags: fix a crash at SetPageError(THP_SWAP) Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 101/119] x86/mm: split vmalloc_sync_all() Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 102/119] io_uring: NULL-deref for IOSQE_{ASYNC,DRAIN} Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 103/119] futex: Fix inode life-time issue Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 104/119] futex: Unbreak futex hashing Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 105/119] ALSA: hda/realtek: Fix pop noise on ALC225 Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 106/119] thunderbolt: Fix error code in tb_port_is_width_supported() Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 107/119] arm64: smp: fix smp_send_stop() behaviour Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 108/119] arm64: smp: fix crash_smp_send_stop() behaviour Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 109/119] nvmet-tcp: set MSG_MORE only if we actually have more to send Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 110/119] modpost: Get proper section index by get_secindex() instead of st_shndx Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 111/119] btrfs: fix removal of raid[56|1c34} incompat flags after removing block group Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 112/119] Revert "drm/i915/tgl: Add extra hdc flush workaround" Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 113/119] drm/bridge: dw-hdmi: fix AVI frame colorimetry Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 114/119] drm/i915/execlists: Track active elements during dequeue Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 115/119] drm/i915: Handle all MCR ranges Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 116/119] staging: greybus: loopback_test: fix potential path truncation Greg Kroah-Hartman
2020-03-24 13:11 ` [PATCH 5.5 117/119] staging: greybus: loopback_test: fix potential path truncations Greg Kroah-Hartman
2020-03-24 13:11 ` Greg Kroah-Hartman [this message]
2020-03-24 13:11 ` [PATCH 5.5 119/119] int128: fix __uint128_t compiler test in Kconfig Greg Kroah-Hartman
2020-03-24 19:45 ` [PATCH 5.5 000/119] 5.5.12-rc1 review shuah
2020-03-25 17:54   ` Greg Kroah-Hartman
2020-03-24 20:56 ` Guenter Roeck
2020-03-25 17:54   ` Greg Kroah-Hartman
2020-03-25  5:46 ` Naresh Kamboju
2020-03-25 17:54   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200324130819.320806799@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@sdf.org \
    --cc=masahiroy@kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).