diff mbox

[AArch64] Fix elf_greg_t on ILP32

Message ID 599DB988.7040501@arm.com
State Committed
Commit 39e7a5a66828a60008543db5f03f46dc7081668b
Headers show

Commit Message

Szabolcs Nagy Aug. 23, 2017, 5:21 p.m. UTC
Use uint64_t instead of unsigned long.

will commit it tomorrow if there are no objections.

ChangleLog:
2017-08-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (elf_greg_t):
	Use uint64_t instead of unsigned long.

Comments

Szabolcs Nagy Aug. 29, 2017, 3 p.m. UTC | #1
On 23/08/17 18:21, Szabolcs Nagy wrote:
> Use uint64_t instead of unsigned long.
> 
> will commit it tomorrow if there are no objections.
> 
> ChangleLog:
> 2017-08-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>
> 
> 	* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (elf_greg_t):
> 	Use uint64_t instead of unsigned long.
> 

hm sys/procfs.h is included into signal.h
via sys/ucontext.h, where stdint.h should
not be exposed..

this does not happen in standards conforming
mode, but happens with _DEFAULT_SOURCE==1 so
it may cause problems.

i'm not sure if this is ok or better use
unsigned long long instead of uint64_t
(preferred uint64_t to avoid changing the
type on lp64)
Zack Weinberg Aug. 29, 2017, 3:20 p.m. UTC | #2
On Tue, Aug 29, 2017 at 11:00 AM, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> On 23/08/17 18:21, Szabolcs Nagy wrote:
>> Use uint64_t instead of unsigned long.
>>
>> will commit it tomorrow if there are no objections.
>>
>> ChangleLog:
>> 2017-08-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>
>>
>>       * sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (elf_greg_t):
>>       Use uint64_t instead of unsigned long.
>>
>
> hm sys/procfs.h is included into signal.h
> via sys/ucontext.h, where stdint.h should
> not be exposed..

sys/procfs.h already includes sys/types.h, so use __uint64_t.

Why does sys/ucontext.h need to include sys/procfs.h?

zw
Szabolcs Nagy Aug. 29, 2017, 3:42 p.m. UTC | #3
On 29/08/17 16:20, Zack Weinberg wrote:
> On Tue, Aug 29, 2017 at 11:00 AM, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>> On 23/08/17 18:21, Szabolcs Nagy wrote:
>>> Use uint64_t instead of unsigned long.
>>>
>>> will commit it tomorrow if there are no objections.
>>>
>>> ChangleLog:
>>> 2017-08-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>
>>>
>>>       * sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (elf_greg_t):
>>>       Use uint64_t instead of unsigned long.
>>>
>>
>> hm sys/procfs.h is included into signal.h
>> via sys/ucontext.h, where stdint.h should
>> not be exposed..
> 
> sys/procfs.h already includes sys/types.h, so use __uint64_t.
> 

ah thanks, that works.

> Why does sys/ucontext.h need to include sys/procfs.h?
> 

it defines elf_*_t which is used in ucontext.h as

#ifdef __USE_MISC
# include <sys/procfs.h>


typedef elf_greg_t greg_t;

/* Container for all general registers.  */
typedef elf_gregset_t gregset_t;

/* Structure to describe FPU registers.  */
typedef elf_fpregset_t	fpregset_t;
#endif
diff mbox

Patch

diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h b/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h
index 7a7b1d0742..5c96bc5f17 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sys/procfs.h
@@ -32,11 +32,12 @@ 
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/user.h>
+#include <stdint.h>
 
 __BEGIN_DECLS
 
 /* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
+typedef uint64_t elf_greg_t;
 
 /* And the whole bunch of them.  We could have used `struct
    pt_regs' directly in the typedef, but tradition says that