diff mbox series

[1/1] boot/syslinux: fix build with gnu-efi >= 3.0.16

Message ID 20240227213517.241837-1-ju.o@free.fr
State Superseded
Headers show
Series [1/1] boot/syslinux: fix build with gnu-efi >= 3.0.16 | expand

Commit Message

Julien Olivain Feb. 27, 2024, 9:35 p.m. UTC
Commit fa9893ad8f "package/gnu-efi: bump to version 3.0.17" updated
gnu-efi. This update introduced syslinux build failure, as reported
in [1].

This commit adds a package patch to fix this issue. For technical
details of the issue, see the package patch commit log.

Fixes:
- https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880937
- https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880949

[1] https://lists.buildroot.org/pipermail/buildroot/2024-February/685971.html

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 .checkpackageignore                           |  1 +
 ...stddef.h-add-wchar_t-type-definition.patch | 58 +++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch

Comments

Romain Naour Feb. 27, 2024, 10:31 p.m. UTC | #1
Hi Julien,

Le 27/02/2024 à 22:35, Julien Olivain a écrit :
> Commit fa9893ad8f "package/gnu-efi: bump to version 3.0.17" updated
> gnu-efi. This update introduced syslinux build failure, as reported
> in [1].
> 
> This commit adds a package patch to fix this issue. For technical
> details of the issue, see the package patch commit log.
> 
> Fixes:
> - https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880937
> - https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880949
> 
> [1] https://lists.buildroot.org/pipermail/buildroot/2024-February/685971.html
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  .checkpackageignore                           |  1 +
>  ...stddef.h-add-wchar_t-type-definition.patch | 58 +++++++++++++++++++
>  2 files changed, 59 insertions(+)
>  create mode 100644 boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
> 
> diff --git a/.checkpackageignore b/.checkpackageignore
> index a6cc58c448c..a98a53fbf36 100644
> --- a/.checkpackageignore
> +++ b/.checkpackageignore
> @@ -118,6 +118,7 @@ boot/syslinux/0013-Fix-build-with-gnu-efi-version-3.0.9.patch Upstream
>  boot/syslinux/0014-Fix-build-with-binutils-note-gnu-property-section.patch Upstream
>  boot/syslinux/0016-Workaround-multiple-definition-of-symbol-errors.patch Upstream
>  boot/syslinux/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch Upstream
> +boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch

We want to remove .checkpackageignore in a not too far future, please add an
upstream status tag in the patch 0019-stddef.h-add-wchar_t-type-definition.patch
itself. Even if upstream is not very active (last commit is 5 years ago).

>  linux/5.10.162-cip24-rt10/0001-arch-microblaze-mm-init.c-fix-build.patch Upstream
>  package/18xx-ti-utils/0001-plt.h-fix-build-with-gcc-10.patch Upstream
>  package/4th/0001-avoid-regen-during-install.patch Upstream
> diff --git a/boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch b/boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
> new file mode 100644
> index 00000000000..ac98c47dfdc
> --- /dev/null
> +++ b/boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
> @@ -0,0 +1,58 @@
> +From 063dac55c45d0264671c3463e824ab659e5cbb87 Mon Sep 17 00:00:00 2001
> +From: Julien Olivain <ju.o@free.fr>
> +Date: Tue, 27 Feb 2024 21:09:15 +0100
> +Subject: [PATCH] stddef.h: add wchar_t type definition
> +
> +Syslinux fail to build with gnu-efi >= 3.0.16 with error:
> +
> +    In file included from /host/i686-buildroot-linux-gnu/sysroot/usr/include/efi/efi.h:44,
> +                     from /build/syslinux-6.03/efi/efi.h:23,
> +                     from /build/syslinux-6.03/efi/adv.h:4,
> +                     from /build/syslinux-6.03/efi/adv.c:29:
> +    /host/i686-buildroot-linux-gnu/sysroot/usr/include/efi/ia32/efibind.h:90:9: error: unknown type name 'wchar_t'
> +     typedef wchar_t CHAR16;
> +             ^~~~~~~
> +
> +This is because gnu-efi started to use the "wchar_t" type from the
> +toolchain's <stddef.h> header, in commit [1]. Before this commit,
> +gnu-efi was defining the type as "short".
> +
> +Syslinux is including its own minimal stddef.h file, which masks the
> +one provided by the toolchain. See [2]. This file does not have a type
> +definition for "wchar_t".

Nice catch, didn't noticed this stddef.h provided by syslinux.

Best regards,
Romain


> +
> +Finally, the POSIX <stddef.h> header is supposed to provide this
> +"wchar_t" type definition. See [3].
> +
> +This commit fixes the issue by adding the "wchar_t" type definition in
> +the com32/include/stddef.h header. Since Syslinux has "-fshort-wchar"
> +in its CFLAGS (see [4]), "wchar_t" is simply defined as "short". This
> +also follow the previous gnu-efi < 3.0.16 behavior.
> +
> +This issue was seen in Buildroot Linux, in [5].
> +
> +[1] https://sourceforge.net/p/gnu-efi/code/ci/189200d0b0f6fff473d302880d9569f45d4d8c4d
> +[2] https://repo.or.cz/syslinux.git/blob/refs/tags/syslinux-6.03:/com32/include/stddef.h
> +[3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html
> +[4] https://repo.or.cz/syslinux.git/blob/refs/tags/syslinux-6.03:/mk/efi.mk#l27
> +[5] https://lists.buildroot.org/pipermail/buildroot/2024-February/685971.html
> +
> +Signed-off-by: Julien Olivain <ju.o@free.fr>
> +---
> + com32/include/stddef.h | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/com32/include/stddef.h b/com32/include/stddef.h
> +index f52d62f3..437b11f2 100644
> +--- a/com32/include/stddef.h
> ++++ b/com32/include/stddef.h
> +@@ -29,4 +29,6 @@
> +  */
> + #define container_of(p, c, m) ((c *)((char *)(p) - offsetof(c,m)))
> + 
> ++typedef short wchar_t;
> ++
> + #endif /* _STDDEF_H */
> +-- 
> +2.44.0
> +
Julien Olivain Feb. 28, 2024, 6:27 p.m. UTC | #2
Hi Romain,

On 27/02/2024 23:31, Romain Naour wrote:
> Hi Julien,
> 
> Le 27/02/2024 à 22:35, Julien Olivain a écrit :
>> Commit fa9893ad8f "package/gnu-efi: bump to version 3.0.17" updated
>> gnu-efi. This update introduced syslinux build failure, as reported
>> in [1].
>> 
>> This commit adds a package patch to fix this issue. For technical
>> details of the issue, see the package patch commit log.
>> 
>> Fixes:
>> - https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880937
>> - https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880949
>> 
>> [1] 
>> https://lists.buildroot.org/pipermail/buildroot/2024-February/685971.html
>> 
>> Signed-off-by: Julien Olivain <ju.o@free.fr>
>> ---
>>  .checkpackageignore                           |  1 +
>>  ...stddef.h-add-wchar_t-type-definition.patch | 58 
>> +++++++++++++++++++
>>  2 files changed, 59 insertions(+)
>>  create mode 100644 
>> boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
>> 
>> diff --git a/.checkpackageignore b/.checkpackageignore
>> index a6cc58c448c..a98a53fbf36 100644
>> --- a/.checkpackageignore
>> +++ b/.checkpackageignore
>> @@ -118,6 +118,7 @@ 
>> boot/syslinux/0013-Fix-build-with-gnu-efi-version-3.0.9.patch Upstream
>>  
>> boot/syslinux/0014-Fix-build-with-binutils-note-gnu-property-section.patch 
>> Upstream
>>  
>> boot/syslinux/0016-Workaround-multiple-definition-of-symbol-errors.patch 
>> Upstream
>>  
>> boot/syslinux/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch 
>> Upstream
>> +boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
> 
> We want to remove .checkpackageignore in a not too far future, please 
> add an
> upstream status tag in the patch 
> 0019-stddef.h-add-wchar_t-type-definition.patch
> itself. Even if upstream is not very active (last commit is 5 years 
> ago).

I sent a v2 fixing that:
https://patchwork.ozlabs.org/project/buildroot/patch/20240228181411.10174-1-ju.o@free.fr/

I initially set an exclusion because my registration to the list was 
slow. I also noted
the somewhat slow activity of the project. What would be your 
recommendation for the
"Upstream:" tag, in the case a patch does apply upstream, but the first 
time submission
takes a bit longer?  Something like "Upstream: Applicable (but not 
proposed yet)"?

Best regards,

Julien.
Romain Naour Feb. 28, 2024, 9:38 p.m. UTC | #3
Hello Julien,

Le 28/02/2024 à 19:27, Julien Olivain a écrit :
> Hi Romain,
> 
> On 27/02/2024 23:31, Romain Naour wrote:
>> Hi Julien,
>>
>> Le 27/02/2024 à 22:35, Julien Olivain a écrit :
>>> Commit fa9893ad8f "package/gnu-efi: bump to version 3.0.17" updated
>>> gnu-efi. This update introduced syslinux build failure, as reported
>>> in [1].
>>>
>>> This commit adds a package patch to fix this issue. For technical
>>> details of the issue, see the package patch commit log.
>>>
>>> Fixes:
>>> - https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880937
>>> - https://gitlab.com/buildroot.org/buildroot/-/jobs/6256880949
>>>
>>> [1] https://lists.buildroot.org/pipermail/buildroot/2024-February/685971.html
>>>
>>> Signed-off-by: Julien Olivain <ju.o@free.fr>
>>> ---
>>>  .checkpackageignore                           |  1 +
>>>  ...stddef.h-add-wchar_t-type-definition.patch | 58 +++++++++++++++++++
>>>  2 files changed, 59 insertions(+)
>>>  create mode 100644
>>> boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
>>>
>>> diff --git a/.checkpackageignore b/.checkpackageignore
>>> index a6cc58c448c..a98a53fbf36 100644
>>> --- a/.checkpackageignore
>>> +++ b/.checkpackageignore
>>> @@ -118,6 +118,7 @@
>>> boot/syslinux/0013-Fix-build-with-gnu-efi-version-3.0.9.patch Upstream
>>>  
>>> boot/syslinux/0014-Fix-build-with-binutils-note-gnu-property-section.patch
>>> Upstream
>>>  
>>> boot/syslinux/0016-Workaround-multiple-definition-of-symbol-errors.patch
>>> Upstream
>>>  
>>> boot/syslinux/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch
>>> Upstream
>>> +boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
>>
>> We want to remove .checkpackageignore in a not too far future, please add an
>> upstream status tag in the patch 0019-stddef.h-add-wchar_t-type-definition.patch
>> itself. Even if upstream is not very active (last commit is 5 years ago).
> 
> I sent a v2 fixing that:
> https://patchwork.ozlabs.org/project/buildroot/patch/20240228181411.10174-1-ju.o@free.fr/
> 
> I initially set an exclusion because my registration to the list was slow. I
> also noted
> the somewhat slow activity of the project. What would be your recommendation for
> the
> "Upstream:" tag, in the case a patch does apply upstream, but the first time
> submission
> takes a bit longer?  Something like "Upstream: Applicable (but not proposed yet)"?

The text after the "Upstream:" tag is a free format it seems.

Upstream: I'll send it to upstream, I promise :)

Maybe just:

Upstream: <url of the mailing list where the patch will appear, waiting for
first time submission>

Best regards,
Romain


> 
> Best regards,
> 
> Julien.
diff mbox series

Patch

diff --git a/.checkpackageignore b/.checkpackageignore
index a6cc58c448c..a98a53fbf36 100644
--- a/.checkpackageignore
+++ b/.checkpackageignore
@@ -118,6 +118,7 @@  boot/syslinux/0013-Fix-build-with-gnu-efi-version-3.0.9.patch Upstream
 boot/syslinux/0014-Fix-build-with-binutils-note-gnu-property-section.patch Upstream
 boot/syslinux/0016-Workaround-multiple-definition-of-symbol-errors.patch Upstream
 boot/syslinux/0017-Replace-builtin-strlen-that-appears-to-get-optimized.patch Upstream
+boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
 linux/5.10.162-cip24-rt10/0001-arch-microblaze-mm-init.c-fix-build.patch Upstream
 package/18xx-ti-utils/0001-plt.h-fix-build-with-gcc-10.patch Upstream
 package/4th/0001-avoid-regen-during-install.patch Upstream
diff --git a/boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch b/boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
new file mode 100644
index 00000000000..ac98c47dfdc
--- /dev/null
+++ b/boot/syslinux/0019-stddef.h-add-wchar_t-type-definition.patch
@@ -0,0 +1,58 @@ 
+From 063dac55c45d0264671c3463e824ab659e5cbb87 Mon Sep 17 00:00:00 2001
+From: Julien Olivain <ju.o@free.fr>
+Date: Tue, 27 Feb 2024 21:09:15 +0100
+Subject: [PATCH] stddef.h: add wchar_t type definition
+
+Syslinux fail to build with gnu-efi >= 3.0.16 with error:
+
+    In file included from /host/i686-buildroot-linux-gnu/sysroot/usr/include/efi/efi.h:44,
+                     from /build/syslinux-6.03/efi/efi.h:23,
+                     from /build/syslinux-6.03/efi/adv.h:4,
+                     from /build/syslinux-6.03/efi/adv.c:29:
+    /host/i686-buildroot-linux-gnu/sysroot/usr/include/efi/ia32/efibind.h:90:9: error: unknown type name 'wchar_t'
+     typedef wchar_t CHAR16;
+             ^~~~~~~
+
+This is because gnu-efi started to use the "wchar_t" type from the
+toolchain's <stddef.h> header, in commit [1]. Before this commit,
+gnu-efi was defining the type as "short".
+
+Syslinux is including its own minimal stddef.h file, which masks the
+one provided by the toolchain. See [2]. This file does not have a type
+definition for "wchar_t".
+
+Finally, the POSIX <stddef.h> header is supposed to provide this
+"wchar_t" type definition. See [3].
+
+This commit fixes the issue by adding the "wchar_t" type definition in
+the com32/include/stddef.h header. Since Syslinux has "-fshort-wchar"
+in its CFLAGS (see [4]), "wchar_t" is simply defined as "short". This
+also follow the previous gnu-efi < 3.0.16 behavior.
+
+This issue was seen in Buildroot Linux, in [5].
+
+[1] https://sourceforge.net/p/gnu-efi/code/ci/189200d0b0f6fff473d302880d9569f45d4d8c4d
+[2] https://repo.or.cz/syslinux.git/blob/refs/tags/syslinux-6.03:/com32/include/stddef.h
+[3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html
+[4] https://repo.or.cz/syslinux.git/blob/refs/tags/syslinux-6.03:/mk/efi.mk#l27
+[5] https://lists.buildroot.org/pipermail/buildroot/2024-February/685971.html
+
+Signed-off-by: Julien Olivain <ju.o@free.fr>
+---
+ com32/include/stddef.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/com32/include/stddef.h b/com32/include/stddef.h
+index f52d62f3..437b11f2 100644
+--- a/com32/include/stddef.h
++++ b/com32/include/stddef.h
+@@ -29,4 +29,6 @@
+  */
+ #define container_of(p, c, m) ((c *)((char *)(p) - offsetof(c,m)))
+ 
++typedef short wchar_t;
++
+ #endif /* _STDDEF_H */
+-- 
+2.44.0
+