All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc)
@ 2022-01-30 21:10 Yann E. MORIN
  2022-01-30 21:10 ` [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+ Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yann E. MORIN @ 2022-01-30 21:10 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E . MORIN, Thomas Petazzoni

Hello All!

This two-patch series aims at side-stepping the multiple symbol
declaration in older Linux and U-Boot, where the infamous yylloc is
defined more than once.

Like we have a fix for the perl timeconst issue in linux, do s similar
tweak for yylloc in the two packages known to be affected, Linux and
U-Boot.

Regards,
Yann E. MORIN.


----------------------------------------------------------------
Yann E. MORIN (2):
      boot/uboot: fix build with host-gcc 10+
      linux: fix build with host-gcc 10+

 boot/uboot/uboot.mk | 6 ++++++
 linux/linux.mk      | 6 ++++++
 2 files changed, 12 insertions(+)

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+
  2022-01-30 21:10 [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN
@ 2022-01-30 21:10 ` Yann E. MORIN
  2022-01-31  7:42   ` Arnout Vandecappelle
  2022-01-30 21:10 ` [Buildroot] [PATCH 2/2] linux: " Yann E. MORIN
  2022-01-31  6:34 ` [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN
  2 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2022-01-30 21:10 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E. MORIN, Thomas Petazzoni

Some older versions of U-Boot, 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
    make[4]: *** [scripts/Makefile.host:106: scripts/dtc/dtc] E

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 U-Boot versions or forks.

Upstream just dropped that line altogether:
    https://source.denx.de/u-boot/u-boot/-/commit/018921ee79d3f30893614b3b2b63b588d8544f73

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>
---
 boot/uboot/uboot.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 574fc7089a..9415c4722a 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -244,6 +244,12 @@ endef
 UBOOT_POST_EXTRACT_HOOKS += UBOOT_COPY_OLD_LICENSE_FILE
 UBOOT_POST_RSYNC_HOOKS += UBOOT_COPY_OLD_LICENSE_FILE
 
+# Older versions break on gcc 10+ because of redefined symbols
+define UBOOT_DROP_YYLLOC
+	$(SED) '/^YYLTYPE yylloc;$$/d' `grep -l -r -E '^YYLTYPE yylloc;$$' $(@D)`
+endef
+UBOOT_POST_PATCH_HOOKS += UBOOT_DROP_YYLLOC
+
 ifneq ($(ARCH_XTENSA_OVERLAY_FILE),)
 define UBOOT_XTENSA_OVERLAY_EXTRACT
 	$(call arch-xtensa-overlay-extract,$(@D),u-boot)
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] linux: fix build with host-gcc 10+
  2022-01-30 21:10 [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN
  2022-01-30 21:10 ` [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+ Yann E. MORIN
@ 2022-01-30 21:10 ` Yann E. MORIN
  2022-01-31  6:34 ` [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN
  2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2022-01-30 21:10 UTC (permalink / raw)
  To: buildroot; +Cc: Yann E. MORIN, Thomas Petazzoni

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 U-Boot 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>
---
 linux/linux.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index dd2eebd446..2a841ca3e6 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -268,6 +268,12 @@ endef
 
 LINUX_POST_PATCH_HOOKS += LINUX_APPLY_LOCAL_PATCHES
 
+# Older versions break on gcc 10+ because of redefined symbols
+define LINUX_DROP_YYLLOC
+	$(SED) '/^YYLTYPE yylloc;$$/d' `grep -l -r -E '^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
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc)
  2022-01-30 21:10 [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN
  2022-01-30 21:10 ` [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+ Yann E. MORIN
  2022-01-30 21:10 ` [Buildroot] [PATCH 2/2] linux: " Yann E. MORIN
@ 2022-01-31  6:34 ` Yann E. MORIN
  2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2022-01-31  6:34 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni

All,

On 2022-01-30 22:10 +0100, Yann E. MORIN spake thusly:
> This two-patch series aims at side-stepping the multiple symbol
> declaration in older Linux and U-Boot, where the infamous yylloc is
> defined more than once.
> 
> Like we have a fix for the perl timeconst issue in linux, do s similar
> tweak for yylloc in the two packages known to be affected, Linux and

And this does not work when the fix is not needed:

    https://gitlab.com/ymorin/buildroot/-/jobs/2032545273

    /bin/sed: no input files

Damned. :-(

I'll look into it soonish. In the meantime, patches marked as changs
requested in Patchwork, sorry for the noise...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+
  2022-01-30 21:10 ` [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+ Yann E. MORIN
@ 2022-01-31  7:42   ` Arnout Vandecappelle
  2022-01-31 17:13     ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2022-01-31  7:42 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Thomas Petazzoni



On 30/01/2022 22:10, Yann E. MORIN wrote:
> Some older versions of U-Boot, 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
>      make[4]: *** [scripts/Makefile.host:106: scripts/dtc/dtc] E
> 
> 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 U-Boot versions or forks.
> 
> Upstream just dropped that line altogether:
>      https://source.denx.de/u-boot/u-boot/-/commit/018921ee79d3f30893614b3b2b63b588d8544f73
> 
> 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>
> ---
>   boot/uboot/uboot.mk | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index 574fc7089a..9415c4722a 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -244,6 +244,12 @@ endef
>   UBOOT_POST_EXTRACT_HOOKS += UBOOT_COPY_OLD_LICENSE_FILE
>   UBOOT_POST_RSYNC_HOOKS += UBOOT_COPY_OLD_LICENSE_FILE
>   
> +# Older versions break on gcc 10+ because of redefined symbols
> +define UBOOT_DROP_YYLLOC
> +	$(SED) '/^YYLTYPE yylloc;$$/d' `grep -l -r -E '^YYLTYPE yylloc;$$' $(@D)`

  Why not use
	grep ... | xargs --no-run-if-empty $(SED) ...

which also avoids the "no input files" problem.

  Also:
- Isn't it enough to search in $(@D)/scripts?
- I guess we should use -Z to make is 0-separated. I'm not a 100% sure, but I 
vaguely remember encountering a U-Boot or Linux vendor fork which had file names 
with spaces in them.

  Regards,
  Arnout


> +endef
> +UBOOT_POST_PATCH_HOOKS += UBOOT_DROP_YYLLOC
> +
>   ifneq ($(ARCH_XTENSA_OVERLAY_FILE),)
>   define UBOOT_XTENSA_OVERLAY_EXTRACT
>   	$(call arch-xtensa-overlay-extract,$(@D),u-boot)
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+
  2022-01-31  7:42   ` Arnout Vandecappelle
@ 2022-01-31 17:13     ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2022-01-31 17:13 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Thomas Petazzoni, buildroot

Arnout, All,

On 2022-01-31 08:42 +0100, Arnout Vandecappelle spake thusly:
> On 30/01/2022 22:10, Yann E. MORIN wrote:
[--SNIP--]
> >Upstream just dropped that line altogether:
> >     https://source.denx.de/u-boot/u-boot/-/commit/018921ee79d3f30893614b3b2b63b588d8544f73
> >So, we use a little sed-grep combo to do the exact same change.
[--SNIP--]
> >+# Older versions break on gcc 10+ because of redefined symbols
> >+define UBOOT_DROP_YYLLOC
> >+	$(SED) '/^YYLTYPE yylloc;$$/d' `grep -l -r -E '^YYLTYPE yylloc;$$' $(@D)`
> 
>  Why not use
> 	grep ... | xargs --no-run-if-empty $(SED) ...
> 
> which also avoids the "no input files" problem.

Yes, this is the obviously correct solution; I just did not have time to
handle it this morning... ;-)

>  Also:
> - Isn't it enough to search in $(@D)/scripts?

I was also a bit conflicted on that one. It should even be enough to
look up scripts/dtc/ (kconfig was never impacted).

> - I guess we should use -Z to make is 0-separated. I'm not a 100% sure, but
> I vaguely remember encountering a U-Boot or Linux vendor fork which had file
> names with spaces in them.

Whether that exists or not, I am now trying to always use -Z et al. when
dealing with lists of files in shell.

Thanks for the input; v2 incoming shortly...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-31 17:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30 21:10 [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN
2022-01-30 21:10 ` [Buildroot] [PATCH 1/2] boot/uboot: fix build with host-gcc 10+ Yann E. MORIN
2022-01-31  7:42   ` Arnout Vandecappelle
2022-01-31 17:13     ` Yann E. MORIN
2022-01-30 21:10 ` [Buildroot] [PATCH 2/2] linux: " Yann E. MORIN
2022-01-31  6:34 ` [Buildroot] [PATCH 0/2] linux|uboot: fix build with host-gcc 10+ for older versions (branch yem/yylloc) Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.