https://sourceware.org/bugzilla/show_bug.cgi?id=20833
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
X32 uses 32-bit pointers in 64-bit address space. It can reach
the full 64-bit address space:
[hjl@gnu-6 far-3]$ cat x.c
#include <stdio.h>
extern int foo (long long);
int
main ()
{
long long addr = 0xffffffffff600000LL;
int x = foo (addr);
printf ("0x%llx: %p\n", addr, x);
return 0;
}
[hjl@gnu-6 far-3]$ cat foo.S
.text
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movl (%rdi), %eax
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 far-3]$ gcc x.c foo.S -mx32
[hjl@gnu-6 far-3]$ ./a.out
0xffffffffff600000: 0x60c0c748
[hjl@gnu-6 far-3]$
0xffffffffff600000 is mapped to vsyscall page, which is invisible to
normal x32 application. In this sense, ld isn't wrong not to issue
an error to access below 0 for both LP64 and ILP32.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils