aboutsummaryrefslogtreecommitdiff
path: root/REORG.TODO/sysdeps/x86_64/x32
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/sysdeps/x86_64/x32')
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/Implies-after1
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/Makefile6
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/_itoa.h4
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/divdi3.c1
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/dl-machine.h86
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/ffs.c4
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrint.S27
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintf.S27
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintl.S30
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/gmp-mparam.h33
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/symbol-hacks.h1
-rw-r--r--REORG.TODO/sysdeps/x86_64/x32/sysdep.h92
12 files changed, 312 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/x86_64/x32/Implies-after b/REORG.TODO/sysdeps/x86_64/x32/Implies-after
new file mode 100644
index 0000000000..39a34c5f57
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/Implies-after
@@ -0,0 +1 @@
+wordsize-32
diff --git a/REORG.TODO/sysdeps/x86_64/x32/Makefile b/REORG.TODO/sysdeps/x86_64/x32/Makefile
new file mode 100644
index 0000000000..f2ebc24fb0
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/Makefile
@@ -0,0 +1,6 @@
+ifeq ($(subdir),math)
+# Since x32 returns 32-bit long int and 64-bit long long int in the
+# same 64-bit register, we make the 32b-bit lround an alias of the
+# 64-bit llround. Add -fno-builtin-lround to silence the compiler.
+CFLAGS-s_llround.c += -fno-builtin-lround
+endif
diff --git a/REORG.TODO/sysdeps/x86_64/x32/_itoa.h b/REORG.TODO/sysdeps/x86_64/x32/_itoa.h
new file mode 100644
index 0000000000..0f9ed47726
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/_itoa.h
@@ -0,0 +1,4 @@
+/* X32 uses 64-bit _itoa_word and _itoa is mapped to _itoa_word. */
+#define _ITOA_NEEDED 0
+#define _ITOA_WORD_TYPE unsigned long long int
+#include_next <_itoa.h>
diff --git a/REORG.TODO/sysdeps/x86_64/x32/divdi3.c b/REORG.TODO/sysdeps/x86_64/x32/divdi3.c
new file mode 100644
index 0000000000..bc7b4c4441
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/divdi3.c
@@ -0,0 +1 @@
+/* Fortunately nothing to do. */
diff --git a/REORG.TODO/sysdeps/x86_64/x32/dl-machine.h b/REORG.TODO/sysdeps/x86_64/x32/dl-machine.h
new file mode 100644
index 0000000000..2c50688d94
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/dl-machine.h
@@ -0,0 +1,86 @@
+/* Machine-dependent ELF dynamic relocation inline functions. x32 version.
+ Copyright (C) 2012-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Must allow <sysdeps/x86_64/dl-machine.h> to be included more than once.
+ See #ifdef RESOLVE_MAP in sysdeps/x86_64/dl-machine.h. */
+#include <sysdeps/x86_64/dl-machine.h>
+
+#ifndef _X32_DL_MACHINE_H
+#define _X32_DL_MACHINE_H
+
+#undef ARCH_LA_PLTENTER
+#undef ARCH_LA_PLTEXIT
+#undef RTLD_START
+
+/* Names of the architecture-specific auditing callback functions. */
+#define ARCH_LA_PLTENTER x32_gnu_pltenter
+#define ARCH_LA_PLTEXIT x32_gnu_pltexit
+
+/* Initial entry point code for the dynamic linker.
+ The C function `_dl_start' is the real entry point;
+ its return value is the user program's entry point. */
+#define RTLD_START asm ("\n\
+.text\n\
+ .p2align 4\n\
+.globl _start\n\
+.globl _dl_start_user\n\
+_start:\n\
+ movl %esp, %edi\n\
+ call _dl_start\n\
+_dl_start_user:\n\
+ # Save the user entry point address in %r12.\n\
+ movl %eax, %r12d\n\
+ # See if we were run as a command with the executable file\n\
+ # name as an extra leading argument.\n\
+ movl _dl_skip_args(%rip), %eax\n\
+ # Pop the original argument count.\n\
+ movl (%rsp), %edx\n\
+ # Adjust the stack pointer to skip _dl_skip_args words.\n\
+ lea 4(%rsp,%rax,4), %esp\n\
+ # Subtract _dl_skip_args from argc.\n\
+ subl %eax, %edx\n\
+ # Push argc back on the stack.\n\
+ subl $4, %esp\n\
+ movl %edx, (%rsp)\n\
+ # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
+ # argc -> rsi\n\
+ movl %edx, %esi\n\
+ # Save %rsp value in %r13.\n\
+ movl %esp, %r13d\n\
+ # And align stack for the _dl_init call.\n\
+ and $-16, %esp\n\
+ # _dl_loaded -> rdi\n\
+ movl _rtld_local(%rip), %edi\n\
+ # env -> rcx\n\
+ lea 8(%r13,%rdx,4), %ecx\n\
+ # argv -> rdx\n\
+ lea 4(%r13), %edx\n\
+ # Clear %rbp to mark outermost frame obviously even for constructors.\n\
+ xorl %ebp, %ebp\n\
+ # Call the function to run the initializers.\n\
+ call _dl_init\n\
+ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
+ lea _dl_fini(%rip), %edx\n\
+ # And make sure %rsp points to argc stored on the stack.\n\
+ movl %r13d, %esp\n\
+ # Jump to the user's entry point.\n\
+ jmp *%r12\n\
+.previous\n\
+");
+
+#endif /* !_X32_DL_MACHINE_H */
diff --git a/REORG.TODO/sysdeps/x86_64/x32/ffs.c b/REORG.TODO/sysdeps/x86_64/x32/ffs.c
new file mode 100644
index 0000000000..fa7de8b887
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/ffs.c
@@ -0,0 +1,4 @@
+#define ffsl __something_else
+#include <sysdeps/x86_64/ffs.c>
+#undef ffsl
+weak_alias (__ffs, ffsl)
diff --git a/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrint.S b/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrint.S
new file mode 100644
index 0000000000..86d258c192
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrint.S
@@ -0,0 +1,27 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ .text
+ENTRY(__lrint)
+ cvtsd2si %xmm0,%eax
+ ret
+END(__lrint)
+weak_alias (__lrint, lrint)
diff --git a/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintf.S b/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintf.S
new file mode 100644
index 0000000000..2e6f9aaf2b
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintf.S
@@ -0,0 +1,27 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ .text
+ENTRY(__lrintf)
+ cvtss2si %xmm0,%eax
+ ret
+END(__lrintf)
+weak_alias (__lrintf, lrintf)
diff --git a/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintl.S b/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintl.S
new file mode 100644
index 0000000000..623c6fcbc9
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/fpu/s_lrintl.S
@@ -0,0 +1,30 @@
+/* Round argument to nearest integral value according to current rounding
+ direction.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ .text
+ENTRY(__lrintl)
+ fldt 8(%rsp)
+ fistpl -4(%rsp)
+ fwait
+ movl -4(%rsp),%eax
+ ret
+END(__lrintl)
+weak_alias (__lrintl, lrintl)
diff --git a/REORG.TODO/sysdeps/x86_64/x32/gmp-mparam.h b/REORG.TODO/sysdeps/x86_64/x32/gmp-mparam.h
new file mode 100644
index 0000000000..1915bfc67a
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/gmp-mparam.h
@@ -0,0 +1,33 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#if defined __GMP_H__ && ! defined _LONG_LONG_LIMB
+#error "Included too late for _LONG_LONG_LIMB to take effect"
+#endif
+
+#define _LONG_LONG_LIMB
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+#define BITS_PER_LONGINT 32
+#define BITS_PER_INT 32
+#define BITS_PER_SHORTINT 16
+#define BITS_PER_CHAR 8
+
+#define IEEE_DOUBLE_BIG_ENDIAN 0
diff --git a/REORG.TODO/sysdeps/x86_64/x32/symbol-hacks.h b/REORG.TODO/sysdeps/x86_64/x32/symbol-hacks.h
new file mode 100644
index 0000000000..22aad04437
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/symbol-hacks.h
@@ -0,0 +1 @@
+#include <sysdeps/generic/symbol-hacks.h>
diff --git a/REORG.TODO/sysdeps/x86_64/x32/sysdep.h b/REORG.TODO/sysdeps/x86_64/x32/sysdep.h
new file mode 100644
index 0000000000..034a3f04e9
--- /dev/null
+++ b/REORG.TODO/sysdeps/x86_64/x32/sysdep.h
@@ -0,0 +1,92 @@
+/* Assembler macros for x32.
+ Copyright (C) 2012-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdeps/x86_64/sysdep.h>
+
+#undef LP_SIZE
+#undef LP_OP
+#undef ASM_ADDR
+
+#undef RAX_LP
+#undef RBP_LP
+#undef RBX_LP
+#undef RCX_LP
+#undef RDI_LP
+#undef RDX_LP
+#undef RSP_LP
+#undef RSI_LP
+#undef R8_LP
+#undef R9_LP
+#undef R10_LP
+#undef R11_LP
+#undef R12_LP
+#undef R13_LP
+#undef R14_LP
+#undef R15_LP
+
+#ifdef __ASSEMBLER__
+
+# define LP_SIZE 4
+
+# define LP_OP(insn) insn##l
+
+# define ASM_ADDR .long
+
+# define RAX_LP eax
+# define RBP_LP ebp
+# define RBX_LP ebx
+# define RCX_LP ecx
+# define RDI_LP edi
+# define RDX_LP edx
+# define RSI_LP esi
+# define RSP_LP esp
+# define R8_LP r8d
+# define R9_LP r9d
+# define R10_LP r10d
+# define R11_LP r11d
+# define R12_LP r12d
+# define R13_LP r13d
+# define R14_LP r14d
+# define R15_LP r15d
+
+#else /* __ASSEMBLER__ */
+
+# define LP_SIZE "4"
+
+# define LP_OP(insn) #insn "l"
+
+# define ASM_ADDR ".long"
+
+# define RAX_LP "eax"
+# define RBP_LP "ebp"
+# define RBX_LP "ebx"
+# define RCX_LP "ecx"
+# define RDI_LP "edi"
+# define RDX_LP "edx"
+# define RSI_LP "esi"
+# define RSP_LP "esp"
+# define R8_LP "r8d"
+# define R9_LP "r9d"
+# define R10_LP "r10d"
+# define R11_LP "r11d"
+# define R12_LP "r12d"
+# define R13_LP "r13d"
+# define R14_LP "r14d"
+# define R15_LP "r15d"
+
+#endif /* __ASSEMBLER__ */