diff mbox series

[RFC,v3,04/24] linux-user: riscv: Fix compile failure on riscv32 hosts

Message ID d6c491ecb5c0224c113ddfb2c06552ec89b68227.1544229872.git.alistair.francis@wdc.com (mailing list archive)
State New, archived
Headers show
Series Add RISC-V TCG backend support | expand

Commit Message

Alistair Francis Dec. 8, 2018, 12:46 a.m. UTC
When cross compilling for riscv32 hosts using GCC 8.2 this error is seen:
    error: '__NR__llseek' undeclared (first use in this function); did you mean '_llseek'?

To avoid the error let's ensure that __NR__llseek is defined.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 linux-user/riscv/target_syscall.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Richard Henderson Dec. 10, 2018, 5:04 p.m. UTC | #1
On 12/7/18 6:46 PM, Alistair Francis wrote:
> When cross compilling for riscv32 hosts using GCC 8.2 this error is seen:
>     error: '__NR__llseek' undeclared (first use in this function); did you mean '_llseek'?
> 
> To avoid the error let's ensure that __NR__llseek is defined.
> 
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  linux-user/riscv/target_syscall.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_syscall.h
> index ee81d8bc88..af73f71839 100644
> --- a/linux-user/riscv/target_syscall.h
> +++ b/linux-user/riscv/target_syscall.h
> @@ -47,6 +47,11 @@ struct target_pt_regs {
>  #endif
>  #define UNAME_MINIMUM_RELEASE "4.15.0"
>  
> +/* This is sometimes needed to compile riscv32 Linux user mode */
> +#if !defined(__NR__llseek) && !defined(__NR_lseek)
> +#define __NR__llseek __NR3264_lseek
> +#endif

I'm not quite sure how this could be.  Upstream I see

#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
...
#define __NR_lseek __NR3264_lseek
...
#else
...
#define __NR_llseek __NR3264_lseek

so this define should already exist.

Do you have the wrong headers installed for the cross-build?


r~
Alistair Francis Dec. 12, 2018, 12:20 a.m. UTC | #2
On Mon, Dec 10, 2018 at 9:04 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 12/7/18 6:46 PM, Alistair Francis wrote:
> > When cross compilling for riscv32 hosts using GCC 8.2 this error is seen:
> >     error: '__NR__llseek' undeclared (first use in this function); did you mean '_llseek'?
> >
> > To avoid the error let's ensure that __NR__llseek is defined.
> >
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> >  linux-user/riscv/target_syscall.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_syscall.h
> > index ee81d8bc88..af73f71839 100644
> > --- a/linux-user/riscv/target_syscall.h
> > +++ b/linux-user/riscv/target_syscall.h
> > @@ -47,6 +47,11 @@ struct target_pt_regs {
> >  #endif
> >  #define UNAME_MINIMUM_RELEASE "4.15.0"
> >
> > +/* This is sometimes needed to compile riscv32 Linux user mode */
> > +#if !defined(__NR__llseek) && !defined(__NR_lseek)
> > +#define __NR__llseek __NR3264_lseek
> > +#endif
>
> I'm not quite sure how this could be.  Upstream I see
>
> #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
> ...
> #define __NR_lseek __NR3264_lseek
> ...
> #else
> ...
> #define __NR_llseek __NR3264_lseek
>
> so this define should already exist.
>
> Do you have the wrong headers installed for the cross-build?

I'm using Yocto for the cross build, so I don't see how I can get the
wrong headers. I agree though that I probably shouldn't need this
patch. Maybe it's something to do with the glibc fork I'm using. I'll
drop this patch and see if I can figure out what's going on.

Alistair

>
>
> r~
diff mbox series

Patch

diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_syscall.h
index ee81d8bc88..af73f71839 100644
--- a/linux-user/riscv/target_syscall.h
+++ b/linux-user/riscv/target_syscall.h
@@ -47,6 +47,11 @@  struct target_pt_regs {
 #endif
 #define UNAME_MINIMUM_RELEASE "4.15.0"
 
+/* This is sometimes needed to compile riscv32 Linux user mode */
+#if !defined(__NR__llseek) && !defined(__NR_lseek)
+#define __NR__llseek __NR3264_lseek
+#endif
+
 #define TARGET_MINSIGSTKSZ 2048
 #define TARGET_MLOCKALL_MCL_CURRENT 1
 #define TARGET_MLOCKALL_MCL_FUTURE  2