[Bug string/24097] New: Can't use 64-bit register for size_t in assembly codes for x32
hjl.tools at gmail dot com
sourceware-bugzilla@sourceware.org
Wed Jan 16 12:12:00 GMT 2019
https://sourceware.org/bugzilla/show_bug.cgi?id=24097
Bug ID: 24097
Summary: Can't use 64-bit register for size_t in assembly codes
for x32
Product: glibc
Version: 2.29
Status: NEW
Severity: normal
Priority: P2
Component: string
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
Target: x32
On x32, size_t is 32 bit. We must not use 64-bit register for size_t in
assembly codes for x32:
[hjl@gnu-cfl-1 size-1]$ cat tst-size_t-1.c
#include <string.h>
#include <stdlib.h>
#include <sys/mman.h>
struct foo
{
size_t len;
void *p;
};
static void
__attribute__ ((noinline, noclone))
func (struct foo a, struct foo b)
{
memcpy (a.p, b.p, a.len);
}
int
main (void)
{
char bufb[20] = "foo";
struct foo b = { sizeof (bufb), bufb };
char *bufa = (char*)mmap(NULL, 0x1000,
PROT_WRITE|PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
struct foo a = { 0x1000, bufa };
func (a, b);
if (memcmp (bufa, bufb, sizeof (bufa)))
abort ();
return 0;
}
[hjl@gnu-cfl-1 size-1]$ make tst-size_t-1-dynamic
gcc -mx32 -g -O2 -c -o tst-size_t-1.o tst-size_t-1.c
gcc -mx32 -L. -nostdlib -nostartfiles -o tst-size_t-1-dynamic \
-Wl,-dynamic-linker=/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/elf/ld-linux-x32.so.2
\
-Wl,-z,nocombreloc \
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/csu/crt1.o
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/csu/crti.o \
`gcc -mx32 --print-file-name=crtbegin.o` \
tst-size_t-1.o \
-Wl,-rpath=/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux:/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/nptl:/usr/lib/gcc/x86_64-redhat-linux/8/../../../../libx32:.
\
\
\
\
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/libc.so.6 \
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/elf/ld-linux-x32.so.2
\
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/libc_nonshared.a \
-Wl,-as-needed /usr/lib/gcc/x86_64-redhat-linux/8/x32/libgcc_s.so
-Wl,--no-as-needed `gcc -mx32 --print-file-name=crtend.o` \
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/csu/crtn.o
[hjl@gnu-cfl-1 size-1]$ gdb tst-size_t-1-dynamic
GNU gdb (GDB) Fedora 8.2-6.fc29
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
BFD: warning: /export/home/hjl/bugs/libc/size-1/tst-size_t-1-dynamic:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning: /export/home/hjl/bugs/libc/size-1/tst-size_t-1-dynamic:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
BFD: warning: /export/home/hjl/bugs/libc/size-1/tst-size_t-1-dynamic:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning: /export/home/hjl/bugs/libc/size-1/tst-size_t-1-dynamic:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
Reading symbols from tst-size_t-1-dynamic...done.
(gdb) b func
Breakpoint 1 at 0x4011c0: file tst-size_t-1.c, line 15.
(gdb) r
Starting program: /export/home/hjl/bugs/libc/size-1/tst-size_t-1-dynamic
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/elf/ld-linux-x32.so.2:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/elf/ld-linux-x32.so.2:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/elf/ld-linux-x32.so.2:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/elf/ld-linux-x32.so.2:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/libc.so.6:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/libc.so.6:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/libc.so.6:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010000
BFD: warning:
/export/build/gnu/tools-build/glibc-x32/build-x86_64-linux/libc.so.6:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
Breakpoint 1, func (a=..., b=b@entry=...) at tst-size_t-1.c:15
15 memcpy (a.p, b.p, a.len);
(gdb) step
__memmove_avx_unaligned_erms ()
at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:222
222 movq %rdi, %rax
(gdb) p/x $rdx
$1 = 0xf7e1f00000001000
(gdb) f 1
#1 0x004010cb in main () at tst-size_t-1.c:28
28 func (a, b);
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
__memmove_avx_unaligned_erms ()
at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:376
376 VMOVU -VEC_SIZE(%rsi, %rdx), %VEC(5)
(gdb)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list