All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32
@ 2021-08-21 16:05 Fabrice Fontaine
  2021-08-21 19:08 ` Thomas Petazzoni
  2021-09-06 17:08 ` Peter Korsgaard
  0 siblings, 2 replies; 5+ messages in thread
From: Fabrice Fontaine @ 2021-08-21 16:05 UTC (permalink / raw)
  To: buildroot; +Cc: Bernd Kuhls, Romain Naour, Fabrice Fontaine

Fix the following build failure on riscv32:

../src/util/futex.h: In function 'sys_futex':
../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
   39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
      |                   ^~~~~~~~~
      |                   sys_futex

Fixes:
 - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...-fix-build-on-32-bit-architectures-u.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/mesa3d/0005-src-util-futex.h-fix-build-on-32-bit-architectures-u.patch

diff --git a/package/mesa3d/0005-src-util-futex.h-fix-build-on-32-bit-architectures-u.patch b/package/mesa3d/0005-src-util-futex.h-fix-build-on-32-bit-architectures-u.patch
new file mode 100644
index 0000000000..b01db8a4b4
--- /dev/null
+++ b/package/mesa3d/0005-src-util-futex.h-fix-build-on-32-bit-architectures-u.patch
@@ -0,0 +1,43 @@
+From e501b7c17ada9c694d3f8302622b78d733485b38 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sat, 21 Aug 2021 17:55:33 +0200
+Subject: [PATCH] src/util/futex.h: fix build on 32-bit architectures using
+ 64-bit time_t
+
+Fix the following build failure on 32-bit architectures using 64-bit
+time_t (e.g. riscv32):
+
+../src/util/futex.h: In function 'sys_futex':
+../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
+   39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
+      |                   ^~~~~~~~~
+      |                   sys_futex
+
+Fixes:
+ - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status:
+https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12496]
+---
+ src/util/futex.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/util/futex.h b/src/util/futex.h
+index 43097f4cd5b..221eda9db0c 100644
+--- a/src/util/futex.h
++++ b/src/util/futex.h
+@@ -34,6 +34,10 @@
+ #include <sys/syscall.h>
+ #include <sys/time.h>
+ 
++#ifndef SYS_futex
++#define SYS_futex SYS_futex_time64
++#endif
++
+ static inline long sys_futex(void *addr1, int op, int val1, const struct timespec *timeout, void *addr2, int val3)
+ {
+    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
+-- 
+2.32.0
+
-- 
2.32.0

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32
  2021-08-21 16:05 [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32 Fabrice Fontaine
@ 2021-08-21 19:08 ` Thomas Petazzoni
  2021-08-21 22:06   ` Fabrice Fontaine
  2021-09-06 17:08 ` Peter Korsgaard
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2021-08-21 19:08 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Bernd Kuhls, Romain Naour, buildroot

On Sat, 21 Aug 2021 18:05:09 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the following build failure on riscv32:
> 
> ../src/util/futex.h: In function 'sys_futex':
> ../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
>    39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
>       |                   ^~~~~~~~~
>       |                   sys_futex
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

> ++#ifndef SYS_futex
> ++#define SYS_futex SYS_futex_time64
> ++#endif

Are we sure that SYS_futex is exactly equivalent to SYS_futex_time64 ?
In another e-mail thread Arnout said they are not exactly equivalent.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32
  2021-08-21 19:08 ` Thomas Petazzoni
@ 2021-08-21 22:06   ` Fabrice Fontaine
  2021-08-23 22:06     ` Arnout Vandecappelle
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Fontaine @ 2021-08-21 22:06 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Bernd Kuhls, Romain Naour, Buildroot Mailing List

Le sam. 21 août 2021 à 21:08, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Sat, 21 Aug 2021 18:05:09 +0200
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > Fix the following build failure on riscv32:
> >
> > ../src/util/futex.h: In function 'sys_futex':
> > ../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
> >    39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
> >       |                   ^~~~~~~~~
> >       |                   sys_futex
> >
> > Fixes:
> >  - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>
> > ++#ifndef SYS_futex
> > ++#define SYS_futex SYS_futex_time64
> > ++#endif
>
> Are we sure that SYS_futex is exactly equivalent to SYS_futex_time64 ?
> In another e-mail thread Arnout said they are not exactly equivalent.
I'll let Arnout answers but the same kind of patch was applied for capnproto:
https://patchwork.ozlabs.org/project/buildroot/patch/20210527210402.555334-1-fontaine.fabrice@gmail.com

Another option would be to disable mesa3d on riscv32, especially if
upstream rejects the MR.
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32
  2021-08-21 22:06   ` Fabrice Fontaine
@ 2021-08-23 22:06     ` Arnout Vandecappelle
  0 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2021-08-23 22:06 UTC (permalink / raw)
  To: Fabrice Fontaine, Thomas Petazzoni
  Cc: Bernd Kuhls, Romain Naour, Buildroot Mailing List



On 22/08/2021 00:06, Fabrice Fontaine wrote:
> Le sam. 21 août 2021 à 21:08, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> a écrit :
>>
>> On Sat, 21 Aug 2021 18:05:09 +0200
>> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>>
>>> Fix the following build failure on riscv32:
>>>
>>> ../src/util/futex.h: In function 'sys_futex':
>>> ../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
>>>    39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
>>>       |                   ^~~~~~~~~
>>>       |                   sys_futex
>>>
>>> Fixes:
>>>  - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e
>>>
>>> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>>
>>> ++#ifndef SYS_futex
>>> ++#define SYS_futex SYS_futex_time64
>>> ++#endif
>>
>> Are we sure that SYS_futex is exactly equivalent to SYS_futex_time64 ?
>> In another e-mail thread Arnout said they are not exactly equivalent.
> I'll let Arnout answers but the same kind of patch was applied for capnproto:
> https://patchwork.ozlabs.org/project/buildroot/patch/20210527210402.555334-1-fontaine.fabrice@gmail.com

 I can't say I fully understand all of it, but this is my understanding:

 The only difference between SYS_futex and SYS_futex_time64 is that the former
takes a legay struct timespec while the latter takes a 64-bit struct timespec.

 Any system which doesn't have SYS_futex defined (but does have SYS_futex_time64
defined) is necessarily a system that only has 64-bit struct timespec. So unless
the libc is completely broken, it must have a 64-bit struct timespec.

 Therefore, a change like this is OK, as long as no code makes any assumptions
about the layout of the struct timespec that is passed as an argument. That
shouldn't be a problem unless some very weird casting is being done. With time_t
the risk is bigger (casting a pointer-to-long to pointer-to-time_t is pretty
easy to do), but for struct timespec it's not really likely.

 So I'm not particularly opposed to patches like this, as long as it's sent
upstream and upstream doesn't complain too much about it.

 A more official approach could be to rely on __TIMESIZE. If __TIMESIZE is 64
(which it is on riscv32), then struct timespec is 64-bit so we have to use
SYS_futex64 instead of SYS_futex. However, __TIMESIZE comes from glibc, I'm not
sure if uClibc and musl define it. I can't fine a reference to it in their repos.

 Of course, the better solution is to make the whole thing time64 compliant, but
that's generally a bigger change. And not really possible at this point - glibc
documentation itself says that it's not ready yet [1].

 Bottom line: I think this patch is good, as in, it's pretty much the only
feasible approach (other than disabling it for riscv32). Therefore, applied to
master,thanks.

 Regards,
 Arnout

[1]
https://www.gnu.org/software/libc/manual/html_node/64_002dbit-time-symbol-handling.html




> 
> Another option would be to disable mesa3d on riscv32, especially if
> upstream rejects the MR.
>>
>> Thomas
>> --
>> Thomas Petazzoni, co-owner and CEO, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
> Best Regards,
> 
> Fabrice
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32
  2021-08-21 16:05 [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32 Fabrice Fontaine
  2021-08-21 19:08 ` Thomas Petazzoni
@ 2021-09-06 17:08 ` Peter Korsgaard
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2021-09-06 17:08 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Bernd Kuhls, Romain Naour, buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Fix the following build failure on riscv32:
 > ../src/util/futex.h: In function 'sys_futex':
 > ../src/util/futex.h:39:19: error: 'SYS_futex' undeclared (first use in this function); did you mean 'sys_futex'?
 >    39 |    return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
 >       |                   ^~~~~~~~~
 >       |                   sys_futex

 > Fixes:
 >  - http://autobuild.buildroot.org/results/692700a5f967760a0b8cd358b1712f1d5a7b681e

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Committed to 2021.02.x and 2021.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-09-06 17:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 16:05 [Buildroot] [PATCH 1/1] package/mesa3d: fix build on riscv32 Fabrice Fontaine
2021-08-21 19:08 ` Thomas Petazzoni
2021-08-21 22:06   ` Fabrice Fontaine
2021-08-23 22:06     ` Arnout Vandecappelle
2021-09-06 17:08 ` Peter Korsgaard

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.