diff options
| author | Yann E. MORIN <yann.morin.1998@free.fr> | 2022-01-31 22:38:09 +0100 |
|---|---|---|
| committer | Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> | 2022-02-12 21:38:18 +0100 |
| commit | 9b41b54be07711c10ad13ce157be272ed1cf402e (patch) | |
| tree | a25af460ee9c3bd2b28c10b3a176d242a382aca6 | |
| parent | 3b3859cc7df8edce10e5b4dad9005bd05342c8c3 (diff) | |
| download | buildroot-9b41b54be07711c10ad13ce157be272ed1cf402e.tar.bz2 | |
linux: fix build with host-gcc 10+
Some older versions of linux, or custom versions (like forks for some
boards), fail to build with host-gcc 10+, because of redefined symbols:
HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition
of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
Since this has been fixed in recent-ish versions, we can't use an
unconditionaly patch, so we must have a conditional patch. However, a
patch may not always apply to arbitrary Linux versions or forks.
Upstream just dropped that line altogether:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e33a814e772cdc36436c8c188d8c42d019fda639
So, we use a little sed-grep combo to do the exact same change.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
| -rw-r--r-- | linux/linux.mk | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/linux/linux.mk b/linux/linux.mk index d798aea057..102b7a15d4 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -271,6 +271,13 @@ endef LINUX_POST_PATCH_HOOKS += LINUX_APPLY_LOCAL_PATCHES +# Older versions break on gcc 10+ because of redefined symbols +define LINUX_DROP_YYLLOC + $(Q)grep -Z -l -r -E '^YYLTYPE yylloc;$$' $(@D) \ + |xargs -0 -r $(SED) '/^YYLTYPE yylloc;$$/d' +endef +LINUX_POST_PATCH_HOOKS += LINUX_DROP_YYLLOC + # Older linux kernels use deprecated perl constructs in timeconst.pl # that were removed for perl 5.22+ so it breaks on newer distributions # Try a dry-run patch to see if this applies, if it does go ahead |
