public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
@ 2021-03-15 15:47 Lukasz Majewski
  2021-03-15 15:55 ` Florian Weimer
  0 siblings, 1 reply; 11+ messages in thread
From: Lukasz Majewski @ 2021-03-15 15:47 UTC (permalink / raw)
  To: Joseph Myers, Adhemerval Zanella
  Cc: Paul Eggert, Arnd Bergmann, GNU C Library, Florian Weimer,
	Carlos O'Donell, Lukasz Majewski

The ARM port requires the __libc_do_syscall function to be able to call
utimensat_time64 syscall required to check if file system supports 64
bit time.

This patch adds the sysdeps/unix/sysv/linux/arm/libc-do-syscall.S to
libsupport routines.

It fixes the following error on ARM 32 bit port:

y2038-glibc/support/support_path_support_time64.c:34: undefined reference to
`__libc_do_syscall'
collect2: error: ld returned 1 exit status
---
 sysdeps/unix/sysv/linux/arm/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
index abdf01f00c..2344e74554 100644
--- a/sysdeps/unix/sysv/linux/arm/Makefile
+++ b/sysdeps/unix/sysv/linux/arm/Makefile
@@ -55,6 +55,11 @@ LDFLAGS-tst-rfc3484-2 += $(common-objpfx)csu/libc-do-syscall.o
 LDFLAGS-tst-rfc3484-3 += $(common-objpfx)csu/libc-do-syscall.o
 endif
 
+ifeq ($(subdir),support)
+libsupport-sysdep_routines += libc-do-syscall
+libsupport-static-only-routines += libc-do-syscall
+endif
+
 abi-variants := soft hard
 
 ifeq (,$(filter $(default-abi),$(abi-variants)))
-- 
2.20.1


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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-15 15:47 [PATCH] support: arm: Add libc_do_syscall function to libsupport routines Lukasz Majewski
@ 2021-03-15 15:55 ` Florian Weimer
  2021-03-15 22:14   ` Lukasz Majewski
  0 siblings, 1 reply; 11+ messages in thread
From: Florian Weimer @ 2021-03-15 15:55 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: Joseph Myers, Adhemerval Zanella, GNU C Library

* Lukasz Majewski:

> It fixes the following error on ARM 32 bit port:
>
> y2038-glibc/support/support_path_support_time64.c:34: undefined reference to
> `__libc_do_syscall'
> collect2: error: ld returned 1 exit status

Should libsupport use syscall for direct system calls?

Thanks,
Florian


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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-15 15:55 ` Florian Weimer
@ 2021-03-15 22:14   ` Lukasz Majewski
  2021-03-16  5:10     ` Florian Weimer
  0 siblings, 1 reply; 11+ messages in thread
From: Lukasz Majewski @ 2021-03-15 22:14 UTC (permalink / raw)
  To: Florian Weimer, Adhemerval Zanella; +Cc: Joseph Myers, GNU C Library

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

Hi Florian,

> * Lukasz Majewski:
> 
> > It fixes the following error on ARM 32 bit port:
> >
> > y2038-glibc/support/support_path_support_time64.c:34: undefined
> > reference to `__libc_do_syscall'
> > collect2: error: ld returned 1 exit status  
> 
> Should libsupport use syscall for direct system calls?

I'm not sure what is the correct approach here.

In my case - armv7, 32 bit - in support/support_path_support_time64.c
the utimensat_time64 syscall is called, which is wrapped to
INLINE_SYSCALL_CALL(), which calls __libc_do_syscall ASM ARM function.

This function is only defined for i386 and 32 bit ARM (in e.g.
sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)

> 
> Thanks,
> Florian
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-15 22:14   ` Lukasz Majewski
@ 2021-03-16  5:10     ` Florian Weimer
  2021-03-16  9:06       ` Lukasz Majewski
  2021-03-16 12:46       ` Adhemerval Zanella
  0 siblings, 2 replies; 11+ messages in thread
From: Florian Weimer @ 2021-03-16  5:10 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: Adhemerval Zanella, Joseph Myers, GNU C Library

* Lukasz Majewski:

> Hi Florian,
>
>> * Lukasz Majewski:
>> 
>> > It fixes the following error on ARM 32 bit port:
>> >
>> > y2038-glibc/support/support_path_support_time64.c:34: undefined
>> > reference to `__libc_do_syscall'
>> > collect2: error: ld returned 1 exit status  
>> 
>> Should libsupport use syscall for direct system calls?
>
> I'm not sure what is the correct approach here.
>
> In my case - armv7, 32 bit - in support/support_path_support_time64.c
> the utimensat_time64 syscall is called, which is wrapped to
> INLINE_SYSCALL_CALL(), which calls __libc_do_syscall ASM ARM function.
>
> This function is only defined for i386 and 32 bit ARM (in e.g.
> sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)

Yes, and using the syscall function would avoid this issue.

So the question is, why INLINE_SYSCALL_CALL?

Thanks,
Florian


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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16  5:10     ` Florian Weimer
@ 2021-03-16  9:06       ` Lukasz Majewski
  2021-03-16 12:46       ` Adhemerval Zanella
  1 sibling, 0 replies; 11+ messages in thread
From: Lukasz Majewski @ 2021-03-16  9:06 UTC (permalink / raw)
  To: Florian Weimer, Adhemerval Zanella; +Cc: Joseph Myers, GNU C Library

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

Hi Florian,

> * Lukasz Majewski:
> 
> > Hi Florian,
> >  
> >> * Lukasz Majewski:
> >>   
> >> > It fixes the following error on ARM 32 bit port:
> >> >
> >> > y2038-glibc/support/support_path_support_time64.c:34: undefined
> >> > reference to `__libc_do_syscall'
> >> > collect2: error: ld returned 1 exit status    
> >> 
> >> Should libsupport use syscall for direct system calls?  
> >
> > I'm not sure what is the correct approach here.
> >
> > In my case - armv7, 32 bit - in
> > support/support_path_support_time64.c the utimensat_time64 syscall
> > is called, which is wrapped to INLINE_SYSCALL_CALL(), which calls
> > __libc_do_syscall ASM ARM function.
> >
> > This function is only defined for i386 and 32 bit ARM (in e.g.
> > sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)  
> 
> Yes, and using the syscall function would avoid this issue.
> 
> So the question is, why INLINE_SYSCALL_CALL?

Good question - I guess that Adhemerval would know why it was necessary.

> 
> Thanks,
> Florian
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16  5:10     ` Florian Weimer
  2021-03-16  9:06       ` Lukasz Majewski
@ 2021-03-16 12:46       ` Adhemerval Zanella
  2021-03-16 13:17         ` Adhemerval Zanella
  2021-03-16 14:17         ` Lukasz Majewski
  1 sibling, 2 replies; 11+ messages in thread
From: Adhemerval Zanella @ 2021-03-16 12:46 UTC (permalink / raw)
  To: Florian Weimer, Lukasz Majewski; +Cc: Joseph Myers, GNU C Library



On 16/03/2021 02:10, Florian Weimer wrote:
> * Lukasz Majewski:
> 
>> Hi Florian,
>>
>>> * Lukasz Majewski:
>>>
>>>> It fixes the following error on ARM 32 bit port:
>>>>
>>>> y2038-glibc/support/support_path_support_time64.c:34: undefined
>>>> reference to `__libc_do_syscall'
>>>> collect2: error: ld returned 1 exit status  
>>>
>>> Should libsupport use syscall for direct system calls?
>>
>> I'm not sure what is the correct approach here.
>>
>> In my case - armv7, 32 bit - in support/support_path_support_time64.c
>> the utimensat_time64 syscall is called, which is wrapped to
>> INLINE_SYSCALL_CALL(), which calls __libc_do_syscall ASM ARM function.
>>
>> This function is only defined for i386 and 32 bit ARM (in e.g.
>> sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)
> 
> Yes, and using the syscall function would avoid this issue.
> 
> So the question is, why INLINE_SYSCALL_CALL?

The __libc_do_syscall is in fact only used thumb mode used as default,
and the direct syscall is used because there is no direct support
for using 64 bit types on ABI with default 32 bit time.  We might 
eventually remove the INLINE_SYSCALL_CALL once 64 bit time support is 
implemented (so we build the file with _TIME_SIZE=64).

The patch itself looks ok.

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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16 12:46       ` Adhemerval Zanella
@ 2021-03-16 13:17         ` Adhemerval Zanella
  2021-03-16 14:17         ` Lukasz Majewski
  1 sibling, 0 replies; 11+ messages in thread
From: Adhemerval Zanella @ 2021-03-16 13:17 UTC (permalink / raw)
  To: Florian Weimer, Lukasz Majewski; +Cc: Joseph Myers, GNU C Library



On 16/03/2021 09:46, Adhemerval Zanella wrote:
> 
> 
> On 16/03/2021 02:10, Florian Weimer wrote:
>> * Lukasz Majewski:
>>
>>> Hi Florian,
>>>
>>>> * Lukasz Majewski:
>>>>
>>>>> It fixes the following error on ARM 32 bit port:
>>>>>
>>>>> y2038-glibc/support/support_path_support_time64.c:34: undefined
>>>>> reference to `__libc_do_syscall'
>>>>> collect2: error: ld returned 1 exit status  
>>>>
>>>> Should libsupport use syscall for direct system calls?
>>>
>>> I'm not sure what is the correct approach here.
>>>
>>> In my case - armv7, 32 bit - in support/support_path_support_time64.c
>>> the utimensat_time64 syscall is called, which is wrapped to
>>> INLINE_SYSCALL_CALL(), which calls __libc_do_syscall ASM ARM function.
>>>
>>> This function is only defined for i386 and 32 bit ARM (in e.g.
>>> sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)
>>
>> Yes, and using the syscall function would avoid this issue.
>>
>> So the question is, why INLINE_SYSCALL_CALL?
> 
> The __libc_do_syscall is in fact only used thumb mode used as default,
> and the direct syscall is used because there is no direct support
> for using 64 bit types on ABI with default 32 bit time.  We might 
> eventually remove the INLINE_SYSCALL_CALL once 64 bit time support is 
> implemented (so we build the file with _TIME_SIZE=64).
> 
> The patch itself looks ok.
> 

And indeed there is no need to use INLINE_SYSCALL_CALL, syscall(...)
should suffice it won't require to handle the ARM __libc_do_syscall.

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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16 12:46       ` Adhemerval Zanella
  2021-03-16 13:17         ` Adhemerval Zanella
@ 2021-03-16 14:17         ` Lukasz Majewski
  2021-03-16 14:25           ` Adhemerval Zanella
  2021-03-16 14:28           ` Florian Weimer
  1 sibling, 2 replies; 11+ messages in thread
From: Lukasz Majewski @ 2021-03-16 14:17 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: Florian Weimer, Joseph Myers, GNU C Library

[-- Attachment #1: Type: text/plain, Size: 1724 bytes --]

Hi Adhemerval,

> On 16/03/2021 02:10, Florian Weimer wrote:
> > * Lukasz Majewski:
> >   
> >> Hi Florian,
> >>  
> >>> * Lukasz Majewski:
> >>>  
> >>>> It fixes the following error on ARM 32 bit port:
> >>>>
> >>>> y2038-glibc/support/support_path_support_time64.c:34: undefined
> >>>> reference to `__libc_do_syscall'
> >>>> collect2: error: ld returned 1 exit status    
> >>>
> >>> Should libsupport use syscall for direct system calls?  
> >>
> >> I'm not sure what is the correct approach here.
> >>
> >> In my case - armv7, 32 bit - in
> >> support/support_path_support_time64.c the utimensat_time64 syscall
> >> is called, which is wrapped to INLINE_SYSCALL_CALL(), which calls
> >> __libc_do_syscall ASM ARM function.
> >>
> >> This function is only defined for i386 and 32 bit ARM (in e.g.
> >> sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)  
> > 
> > Yes, and using the syscall function would avoid this issue.
> > 
> > So the question is, why INLINE_SYSCALL_CALL?  
> 
> The __libc_do_syscall is in fact only used thumb mode used as default,
> and the direct syscall is used because there is no direct support
> for using 64 bit types on ABI with default 32 bit time.  We might 
> eventually remove the INLINE_SYSCALL_CALL once 64 bit time support is 
> implemented (so we build the file with _TIME_SIZE=64).
> 
> The patch itself looks ok.

Thanks for review. I will apply it if Florian don't mind.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16 14:17         ` Lukasz Majewski
@ 2021-03-16 14:25           ` Adhemerval Zanella
  2021-03-16 14:28           ` Florian Weimer
  1 sibling, 0 replies; 11+ messages in thread
From: Adhemerval Zanella @ 2021-03-16 14:25 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: Florian Weimer, Joseph Myers, GNU C Library



On 16/03/2021 11:17, Lukasz Majewski wrote:
> Hi Adhemerval,
> 
>> On 16/03/2021 02:10, Florian Weimer wrote:
>>> * Lukasz Majewski:
>>>   
>>>> Hi Florian,
>>>>  
>>>>> * Lukasz Majewski:
>>>>>  
>>>>>> It fixes the following error on ARM 32 bit port:
>>>>>>
>>>>>> y2038-glibc/support/support_path_support_time64.c:34: undefined
>>>>>> reference to `__libc_do_syscall'
>>>>>> collect2: error: ld returned 1 exit status    
>>>>>
>>>>> Should libsupport use syscall for direct system calls?  
>>>>
>>>> I'm not sure what is the correct approach here.
>>>>
>>>> In my case - armv7, 32 bit - in
>>>> support/support_path_support_time64.c the utimensat_time64 syscall
>>>> is called, which is wrapped to INLINE_SYSCALL_CALL(), which calls
>>>> __libc_do_syscall ASM ARM function.
>>>>
>>>> This function is only defined for i386 and 32 bit ARM (in e.g.
>>>> sysdeps/unix/sysv/linux/{arm|i386}/libc-do-syscall.S)  
>>>
>>> Yes, and using the syscall function would avoid this issue.
>>>
>>> So the question is, why INLINE_SYSCALL_CALL?  
>>
>> The __libc_do_syscall is in fact only used thumb mode used as default,
>> and the direct syscall is used because there is no direct support
>> for using 64 bit types on ABI with default 32 bit time.  We might 
>> eventually remove the INLINE_SYSCALL_CALL once 64 bit time support is 
>> implemented (so we build the file with _TIME_SIZE=64).
>>
>> The patch itself looks ok.
> 
> Thanks for review. I will apply it if Florian don't mind.

Please replace the INLINE_SYSCALL_CALL with a simpler syscall(2) so
it won't require to add libc-do-syscall.

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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16 14:17         ` Lukasz Majewski
  2021-03-16 14:25           ` Adhemerval Zanella
@ 2021-03-16 14:28           ` Florian Weimer
  2021-03-16 15:36             ` Lukasz Majewski
  1 sibling, 1 reply; 11+ messages in thread
From: Florian Weimer @ 2021-03-16 14:28 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: Adhemerval Zanella, GNU C Library, Joseph Myers

* Lukasz Majewski:

> Thanks for review. I will apply it if Florian don't mind.

I prefer the syscall-based approach because it makes it easier to build
the test outside of the glibc source tree.

Thanks,
Florian


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

* Re: [PATCH] support: arm: Add libc_do_syscall function to libsupport routines
  2021-03-16 14:28           ` Florian Weimer
@ 2021-03-16 15:36             ` Lukasz Majewski
  0 siblings, 0 replies; 11+ messages in thread
From: Lukasz Majewski @ 2021-03-16 15:36 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Adhemerval Zanella, GNU C Library, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

Hi Florian,

> * Lukasz Majewski:
> 
> > Thanks for review. I will apply it if Florian don't mind.  
> 
> I prefer the syscall-based approach because it makes it easier to
> build the test outside of the glibc source tree.

Ok.

> 
> Thanks,
> Florian
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-03-16 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 15:47 [PATCH] support: arm: Add libc_do_syscall function to libsupport routines Lukasz Majewski
2021-03-15 15:55 ` Florian Weimer
2021-03-15 22:14   ` Lukasz Majewski
2021-03-16  5:10     ` Florian Weimer
2021-03-16  9:06       ` Lukasz Majewski
2021-03-16 12:46       ` Adhemerval Zanella
2021-03-16 13:17         ` Adhemerval Zanella
2021-03-16 14:17         ` Lukasz Majewski
2021-03-16 14:25           ` Adhemerval Zanella
2021-03-16 14:28           ` Florian Weimer
2021-03-16 15:36             ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).