Author: ps-guest Date: 2013-05-10 04:48:34 +0000 (Fri, 10 May 2013) New Revision: 5573
Modified: glibc-package/trunk/debian/changelog glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff Log: update kfreebsd/local-sysdeps.diff Modified: glibc-package/trunk/debian/changelog =================================================================== --- glibc-package/trunk/debian/changelog 2013-05-09 19:23:10 UTC (rev 5572) +++ glibc-package/trunk/debian/changelog 2013-05-10 04:48:34 UTC (rev 5573) @@ -31,7 +31,7 @@ * patches/kfreebsd/local-linuxthreads-stackguard.diff: handle elf subdir removal * patches/kfreebsd/local-freopen.diff: support architecture without dup3() - * kfreebsd/local-sysdeps.diff: update to revision 4423 (from glibc-bsd). + * kfreebsd/local-sysdeps.diff: update to revision 4426 (from glibc-bsd). -- Adam Conrad <adcon...@0c3.net> Tue, 07 May 2013 13:58:05 -0600 Modified: glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff =================================================================== --- glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff 2013-05-09 19:23:10 UTC (rev 5572) +++ glibc-package/trunk/debian/patches/kfreebsd/local-sysdeps.diff 2013-05-10 04:48:34 UTC (rev 5573) @@ -307,109 +307,6 @@ + } +} --- /dev/null -+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/_G_config.h -@@ -0,0 +1,100 @@ -+/* This file is needed by libio to define various configuration parameters. -+ These are always the same in the GNU C library. */ -+ -+#ifndef _G_config_h -+#define _G_config_h 1 -+ -+/* Define types for libio in terms of the standard internal type names. */ -+ -+#include <bits/types.h> -+#define __need_size_t -+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -+# define __need_wchar_t -+#endif -+#define __need_NULL -+#include <stddef.h> -+#define __need_mbstate_t -+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -+# define __need_wint_t -+#endif -+#include <wchar.h> -+#define _G_size_t size_t -+typedef struct -+{ -+ __off_t __pos; -+ __mbstate_t __state; -+} _G_fpos_t; -+typedef struct -+{ -+ __off64_t __pos; -+ __mbstate_t __state; -+} _G_fpos64_t; -+#define _G_ssize_t __ssize_t -+#define _G_off_t __off_t -+#define _G_off64_t __off64_t -+#define _G_pid_t __pid_t -+#define _G_uid_t __uid_t -+#define _G_wchar_t wchar_t -+#define _G_wint_t wint_t -+#define _G_stat64 stat64 -+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -+# include <gconv.h> -+typedef union -+{ -+ struct __gconv_info __cd; -+ struct -+ { -+ struct __gconv_info __cd; -+ struct __gconv_step_data __data; -+ } __combined; -+} _G_iconv_t; -+#endif -+ -+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__))); -+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__))); -+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__))); -+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); -+ -+#define _G_HAVE_BOOL 1 -+ -+ -+/* These library features are always available in the GNU C library. */ -+#define _G_HAVE_ATEXIT 1 -+#define _G_HAVE_SYS_CDEFS 1 -+#define _G_HAVE_SYS_WAIT 1 -+#define _G_NEED_STDARG_H 1 -+#define _G_va_list __gnuc_va_list -+ -+#define _G_HAVE_PRINTF_FP 1 -+#define _G_HAVE_MMAP 1 -+#define _G_HAVE_LONG_DOUBLE_IO 1 -+#define _G_HAVE_IO_FILE_OPEN 1 -+#define _G_HAVE_IO_GETLINE_INFO 1 -+ -+#define _G_IO_IO_FILE_VERSION 0x20001 -+ -+#define _G_OPEN64 __open64 -+#define _G_LSEEK64 __lseek64 -+#define _G_MMAP64 __mmap64 -+#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf) -+ -+/* This is defined by <bits/stat.h> if `st_blksize' exists. */ -+#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) -+ -+#define _G_BUFSIZ 8192 -+ -+/* These are the vtbl details for ELF. */ -+#define _G_NAMES_HAVE_UNDERSCORE 0 -+#define _G_VTABLE_LABEL_HAS_LENGTH 1 -+#define _G_USING_THUNKS 1 -+#define _G_VTABLE_LABEL_PREFIX "__vt_" -+#define _G_VTABLE_LABEL_PREFIX_ID __vt_ -+ -+ -+#if defined __cplusplus || defined __STDC__ -+# define _G_ARGS(ARGLIST) ARGLIST -+#else -+# define _G_ARGS(ARGLIST) () -+#endif -+ -+#endif /* _G_config.h */ ---- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/_exit.S @@ -0,0 +1,25 @@ +/* Copyright (C) 1991,92,97,99,2002 Free Software Foundation, Inc. @@ -5045,10 +4942,10 @@ +extern int __syscall_obreak (void *addr); +libc_hidden_proto (__syscall_obreak) + -+extern void _end; ++extern char _end[]; + +/* sbrk.c expects this. */ -+void *__curbrk = &_end; ++void *__curbrk = _end; + +/* Set the end of the process's data space to ADDR. + Return 0 if successful, -1 if not. */ @@ -5374,21 +5271,10 @@ +weak_alias (__clone, clone) --- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/configure -@@ -0,0 +1,353 @@ +@@ -0,0 +1,342 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/unix/bsd/bsd4.4/kfreebsd. + -+case "$machine" in -+ x86_64*) -+ echo "Adding extra sysnames for kfreebsd/x86_64/elf" -+ sysnames="ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/elf $sysnames" -+ ;; -+ mips*) -+ echo "Adding extra sysnames for kfreebsd/mips/elf" -+ sysnames="ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/elf $sysnames" -+ ;; -+esac -+ +# The kFreeBSD headers can be found in +# /usr/src/sys/ +# Check whether this directory is available. @@ -5730,21 +5616,10 @@ +_ACEOF --- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/configure.in -@@ -0,0 +1,277 @@ +@@ -0,0 +1,266 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/unix/bsd/bsd4.4/kfreebsd. + -+case "$machine" in -+ x86_64*) -+ echo "Adding extra sysnames for kfreebsd/x86_64/elf" -+ sysnames="ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/elf $sysnames" -+ ;; -+ mips*) -+ echo "Adding extra sysnames for kfreebsd/mips/elf" -+ sysnames="ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/elf $sysnames" -+ ;; -+esac -+ +# The kFreeBSD headers can be found in +# /usr/src/sys/ +# Check whether this directory is available. @@ -15592,130 +15467,6 @@ + ".previous"\ +); --- /dev/null -+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/elf/start.S -@@ -0,0 +1,121 @@ -+/* Startup code compliant to the ELF Mips ABI. -+ Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004, 2010 -+ Free Software Foundation, Inc. -+ Port to kFreeBSD (kernel of FreeBSD) by Robert Millan. -+ -+ 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. -+ -+ In addition to the permissions in the GNU Lesser General Public -+ License, the Free Software Foundation gives you unlimited -+ permission to link the compiled version of this file with other -+ programs, and to distribute those programs without any restriction -+ coming from the use of this file. (The GNU Lesser General Public -+ License restrictions do apply in other respects; for example, they -+ cover modification of the file, and distribution when not linked -+ into another program.) -+ -+ Note that people who make modified versions of this file are not -+ obligated to grant this special exception for their modified -+ versions; it is their choice whether to do so. The GNU Lesser -+ General Public License gives permission to release a modified -+ version without this exception; this exception also makes it -+ possible to release a modified version which carries forward this -+ exception. -+ -+ 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, write to the Free -+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -+ 02111-1307 USA. */ -+ -+#define __ASSEMBLY__ 1 -+#include <entry.h> -+#include <sgidefs.h> -+#include <sys/asm.h> -+ -+#ifndef ENTRY_POINT -+#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. -+#endif -+ -+/* This is the canonical entry point, usually the first thing in the text -+ segment. The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry -+ point runs, most registers' values are unspecified, except for: -+ -+ v0 ($2) Contains a function pointer to be registered with `atexit'. -+ This is how the dynamic linker arranges to have DT_FINI -+ functions called for shared libraries that have been loaded -+ before this code runs. -+ -+ a0 ($4) Contains a pointer to the arguments and environment: -+ 0(a0) argc -+ 4(a0) argv[0] -+ ... -+ (4*argc)(a0) NULL -+ (4*(argc+1))(a0) envp[0] -+ ... -+ NULL -+ ra ($31) The return address register is set to zero so that programs -+ that search backword through stack frames recognize the last -+ stack frame. -+*/ -+ -+ -+/* We need to call: -+ __libc_start_main (int (*main) (int, char **, char **), int argc, -+ char **argv, void (*init) (void), void (*fini) (void), -+ void (*rtld_fini) (void), void *stack_end) -+*/ -+ -+ .text -+ .globl ENTRY_POINT -+ .type ENTRY_POINT,@function -+ENTRY_POINT: -+#ifdef __PIC__ -+ SETUP_GPX($0) -+ SETUP_GPX64($25,$0) -+#else -+ PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */ -+ move $31, $0 -+#endif -+ -+ PTR_L $5, 0($4) /* argc */ -+ PTR_ADDIU $6, $4, PTRSIZE /* argv */ -+ PTR_LA $4, main /* main */ -+ -+ /* Allocate space on the stack for seven arguments (o32 only) -+ and make sure the stack is aligned to double words (8 bytes) -+ on o32 and quad words (16 bytes) on n32 and n64. */ -+ -+ and $29, -2 * SZREG -+#if _MIPS_SIM == _ABIO32 -+ PTR_SUBIU $29, 32 -+#endif -+ PTR_LA $7, __libc_csu_init /* init */ -+ PTR_LA $8, __libc_csu_fini -+#if _MIPS_SIM == _ABIO32 -+ PTR_S $8, 16($29) /* fini */ -+ PTR_S $2, 20($29) /* rtld_fini */ -+ PTR_S $29, 24($29) /* stack_end */ -+#else -+ move $9, $2 /* rtld_fini */ -+ move $10, $29 /* stack_end */ -+#endif -+ jal __libc_start_main -+hlt: b hlt /* Crash if somehow it does return. */ -+ -+/* Define a symbol for the first piece of initialized data. */ -+ .data -+ .globl __data_start -+__data_start: -+ .long 0 -+ .weak data_start -+ data_start = __data_start ---- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/entry.h @@ -0,0 +1,7 @@ +/* http://sources.redhat.com/bugzilla/show_bug.cgi?id=12297 */ @@ -16506,6 +16257,130 @@ +#endif /* _BITS_SIGCONTEXT_H */ + --- /dev/null ++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/start.S +@@ -0,0 +1,121 @@ ++/* Startup code compliant to the ELF Mips ABI. ++ Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004, 2010 ++ Free Software Foundation, Inc. ++ Port to kFreeBSD (kernel of FreeBSD) by Robert Millan. ++ ++ 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. ++ ++ In addition to the permissions in the GNU Lesser General Public ++ License, the Free Software Foundation gives you unlimited ++ permission to link the compiled version of this file with other ++ programs, and to distribute those programs without any restriction ++ coming from the use of this file. (The GNU Lesser General Public ++ License restrictions do apply in other respects; for example, they ++ cover modification of the file, and distribution when not linked ++ into another program.) ++ ++ Note that people who make modified versions of this file are not ++ obligated to grant this special exception for their modified ++ versions; it is their choice whether to do so. The GNU Lesser ++ General Public License gives permission to release a modified ++ version without this exception; this exception also makes it ++ possible to release a modified version which carries forward this ++ exception. ++ ++ 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, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#define __ASSEMBLY__ 1 ++#include <entry.h> ++#include <sgidefs.h> ++#include <sys/asm.h> ++ ++#ifndef ENTRY_POINT ++#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF. ++#endif ++ ++/* This is the canonical entry point, usually the first thing in the text ++ segment. The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry ++ point runs, most registers' values are unspecified, except for: ++ ++ v0 ($2) Contains a function pointer to be registered with `atexit'. ++ This is how the dynamic linker arranges to have DT_FINI ++ functions called for shared libraries that have been loaded ++ before this code runs. ++ ++ a0 ($4) Contains a pointer to the arguments and environment: ++ 0(a0) argc ++ 4(a0) argv[0] ++ ... ++ (4*argc)(a0) NULL ++ (4*(argc+1))(a0) envp[0] ++ ... ++ NULL ++ ra ($31) The return address register is set to zero so that programs ++ that search backword through stack frames recognize the last ++ stack frame. ++*/ ++ ++ ++/* We need to call: ++ __libc_start_main (int (*main) (int, char **, char **), int argc, ++ char **argv, void (*init) (void), void (*fini) (void), ++ void (*rtld_fini) (void), void *stack_end) ++*/ ++ ++ .text ++ .globl ENTRY_POINT ++ .type ENTRY_POINT,@function ++ENTRY_POINT: ++#ifdef __PIC__ ++ SETUP_GPX($0) ++ SETUP_GPX64($25,$0) ++#else ++ PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */ ++ move $31, $0 ++#endif ++ ++ PTR_L $5, 0($4) /* argc */ ++ PTR_ADDIU $6, $4, PTRSIZE /* argv */ ++ PTR_LA $4, main /* main */ ++ ++ /* Allocate space on the stack for seven arguments (o32 only) ++ and make sure the stack is aligned to double words (8 bytes) ++ on o32 and quad words (16 bytes) on n32 and n64. */ ++ ++ and $29, -2 * SZREG ++#if _MIPS_SIM == _ABIO32 ++ PTR_SUBIU $29, 32 ++#endif ++ PTR_LA $7, __libc_csu_init /* init */ ++ PTR_LA $8, __libc_csu_fini ++#if _MIPS_SIM == _ABIO32 ++ PTR_S $8, 16($29) /* fini */ ++ PTR_S $2, 20($29) /* rtld_fini */ ++ PTR_S $29, 24($29) /* stack_end */ ++#else ++ move $9, $2 /* rtld_fini */ ++ move $10, $29 /* stack_end */ ++#endif ++ jal __libc_start_main ++hlt: b hlt /* Crash if somehow it does return. */ ++ ++/* Define a symbol for the first piece of initialized data. */ ++ .data ++ .globl __data_start ++__data_start: ++ .long 0 ++ .weak data_start ++ data_start = __data_start +--- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/start_thread.S @@ -0,0 +1,56 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. @@ -27358,152 +27233,6 @@ @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h> --- /dev/null -+++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/elf/start.S -@@ -0,0 +1,143 @@ -+/* Startup code for FreeBSD/amd64 ABI. -+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ Contributed by Andreas Jaeger <a...@suse.de>, 2001. -+ FreeBSD modification by Petr Salinger, 2006. -+ -+ 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. -+ -+ In addition to the permissions in the GNU Lesser General Public -+ License, the Free Software Foundation gives you unlimited -+ permission to link the compiled version of this file with other -+ programs, and to distribute those programs without any restriction -+ coming from the use of this file. (The GNU Lesser General Public -+ License restrictions do apply in other respects; for example, they -+ cover modification of the file, and distribution when not linked -+ into another program.) -+ -+ Note that people who make modified versions of this file are not -+ obligated to grant this special exception for their modified -+ versions; it is their choice whether to do so. The GNU Lesser -+ General Public License gives permission to release a modified -+ version without this exception; this exception also makes it -+ possible to release a modified version which carries forward this -+ exception. -+ -+ 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, write to the Free -+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -+ 02111-1307 USA. */ -+ -+/* This is the canonical entry point, usually the first thing in the text -+ segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry -+ point runs, most registers' values are unspecified, except for a few. -+ Blindly applied on amd64: -+ -+ %rdx Contains a function pointer to be registered with `atexit'. -+ This is how the dynamic linker arranges to have DT_FINI -+ functions called for shared libraries that have been loaded -+ before this code runs. -+ -+ %rsp The stack contains the arguments and environment: -+ 0(%rsp) argc -+ 8(%rsp) argv[0] -+ ... -+ (8*argc)(%rsp) NULL -+ (8*(argc+1))(%rsp) envp[0] -+ ... -+ NULL -+ -+ But on amd64 %rsp also have to be 16-byte aligned, -+ standard C calling convention already passes arguments in registers. -+ -+ FreeBSD uses %edi as pointer to arguments and environment, %rsp is passed aligned. -+ On entry from kernel, %rsp=%rdi or %rsp=%rdi-8, -+ on entry from ld.so, glibc might set up it slightly differently. -+ -+ On FreeBSD, we use %rsi for passing function pointer to rtld_fini(). -+ On entry from FreeBSD kernel, %rsi is cleared, %rdx is not cleared, -+ on entry from ld.so, glibc sets both %rsi and %rdx to point to rtld_fini(). -+ -+ Used interface (via %rdi, %rsi) is equal to standard C calling interface for -+ -+ void _start(void *arg, void *rtld_fini()); -+ -+*/ -+ -+#include "bp-sym.h" -+ -+ .text -+ .globl _start -+ .type _start,@function -+_start: -+ /* Clear the frame pointer. The ABI suggests this be done, to mark -+ the outermost frame obviously. */ -+ xorl %ebp, %ebp /* zero extending clears whole rbp */ -+ -+ /* Extract the arguments as encoded on the stack and set up -+ the arguments for __libc_start_main (int (*main) (int, char **, char **), -+ int argc, char *argv, -+ void (*init) (void), void (*fini) (void), -+ void (*rtld_fini) (void), void *stack_end). -+ The arguments are passed via registers and on the stack: -+ main: %rdi -+ argc: %rsi -+ argv: %rdx -+ init: %rcx -+ fini: %r8 -+ rtld_fini: %r9 -+ stack_end: stack. */ -+ -+ movq %rsi, %r9 /* Address of the shared library termination -+ function. */ -+ movq 0(%rdi), %rsi /* argument count. */ -+ leaq 8(%rdi), %rdx /* argv starts just at above argc. */ -+ -+ /* Align the stack to a 16 byte boundary to follow the ABI. */ -+ andq $~15, %rsp -+ -+ pushq %rax /* Push garbage because we push 8 more bytes. */ -+ -+ /* Provide the highest stack address to the user code (for stacks -+ which grow downwards). */ -+ pushq %rsp -+ -+#ifdef SHARED -+ /* Pass address of our own entry points to .fini and .init. */ -+ movq __libc_csu_fini@GOTPCREL(%rip), %r8 -+ movq __libc_csu_init@GOTPCREL(%rip), %rcx -+ -+ movq BP_SYM (main)@GOTPCREL(%rip), %rdi -+ -+ /* Call the user's main function, and exit with its value. -+ But let the libc call main. */ -+ call BP_SYM (__libc_start_main)@PLT -+#else -+ /* Pass address of our own entry points to .fini and .init. */ -+ movq $__libc_csu_fini, %r8 -+ movq $__libc_csu_init, %rcx -+ -+ movq $BP_SYM (main), %rdi -+ -+ /* Call the user's main function, and exit with its value. -+ But let the libc call main. */ -+ call BP_SYM (__libc_start_main) -+#endif -+ -+ hlt /* Crash if somehow `exit' does return. */ -+ -+/* Define a symbol for the first piece of initialized data. */ -+ .data -+ .globl __data_start -+__data_start: -+ .long 0 -+ .weak data_start -+ data_start = __data_start ---- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/get_clockfreq.c @@ -0,0 +1 @@ +#include "../i386/get_clockfreq.c" @@ -28318,6 +28047,152 @@ +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) --- /dev/null ++++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/start.S +@@ -0,0 +1,143 @@ ++/* Startup code for FreeBSD/amd64 ABI. ++ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ Contributed by Andreas Jaeger <a...@suse.de>, 2001. ++ FreeBSD modification by Petr Salinger, 2006. ++ ++ 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. ++ ++ In addition to the permissions in the GNU Lesser General Public ++ License, the Free Software Foundation gives you unlimited ++ permission to link the compiled version of this file with other ++ programs, and to distribute those programs without any restriction ++ coming from the use of this file. (The GNU Lesser General Public ++ License restrictions do apply in other respects; for example, they ++ cover modification of the file, and distribution when not linked ++ into another program.) ++ ++ Note that people who make modified versions of this file are not ++ obligated to grant this special exception for their modified ++ versions; it is their choice whether to do so. The GNU Lesser ++ General Public License gives permission to release a modified ++ version without this exception; this exception also makes it ++ possible to release a modified version which carries forward this ++ exception. ++ ++ 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, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++/* This is the canonical entry point, usually the first thing in the text ++ segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry ++ point runs, most registers' values are unspecified, except for a few. ++ Blindly applied on amd64: ++ ++ %rdx Contains a function pointer to be registered with `atexit'. ++ This is how the dynamic linker arranges to have DT_FINI ++ functions called for shared libraries that have been loaded ++ before this code runs. ++ ++ %rsp The stack contains the arguments and environment: ++ 0(%rsp) argc ++ 8(%rsp) argv[0] ++ ... ++ (8*argc)(%rsp) NULL ++ (8*(argc+1))(%rsp) envp[0] ++ ... ++ NULL ++ ++ But on amd64 %rsp also have to be 16-byte aligned, ++ standard C calling convention already passes arguments in registers. ++ ++ FreeBSD uses %edi as pointer to arguments and environment, %rsp is passed aligned. ++ On entry from kernel, %rsp=%rdi or %rsp=%rdi-8, ++ on entry from ld.so, glibc might set up it slightly differently. ++ ++ On FreeBSD, we use %rsi for passing function pointer to rtld_fini(). ++ On entry from FreeBSD kernel, %rsi is cleared, %rdx is not cleared, ++ on entry from ld.so, glibc sets both %rsi and %rdx to point to rtld_fini(). ++ ++ Used interface (via %rdi, %rsi) is equal to standard C calling interface for ++ ++ void _start(void *arg, void *rtld_fini()); ++ ++*/ ++ ++#include "bp-sym.h" ++ ++ .text ++ .globl _start ++ .type _start,@function ++_start: ++ /* Clear the frame pointer. The ABI suggests this be done, to mark ++ the outermost frame obviously. */ ++ xorl %ebp, %ebp /* zero extending clears whole rbp */ ++ ++ /* Extract the arguments as encoded on the stack and set up ++ the arguments for __libc_start_main (int (*main) (int, char **, char **), ++ int argc, char *argv, ++ void (*init) (void), void (*fini) (void), ++ void (*rtld_fini) (void), void *stack_end). ++ The arguments are passed via registers and on the stack: ++ main: %rdi ++ argc: %rsi ++ argv: %rdx ++ init: %rcx ++ fini: %r8 ++ rtld_fini: %r9 ++ stack_end: stack. */ ++ ++ movq %rsi, %r9 /* Address of the shared library termination ++ function. */ ++ movq 0(%rdi), %rsi /* argument count. */ ++ leaq 8(%rdi), %rdx /* argv starts just at above argc. */ ++ ++ /* Align the stack to a 16 byte boundary to follow the ABI. */ ++ andq $~15, %rsp ++ ++ pushq %rax /* Push garbage because we push 8 more bytes. */ ++ ++ /* Provide the highest stack address to the user code (for stacks ++ which grow downwards). */ ++ pushq %rsp ++ ++#ifdef SHARED ++ /* Pass address of our own entry points to .fini and .init. */ ++ movq __libc_csu_fini@GOTPCREL(%rip), %r8 ++ movq __libc_csu_init@GOTPCREL(%rip), %rcx ++ ++ movq BP_SYM (main)@GOTPCREL(%rip), %rdi ++ ++ /* Call the user's main function, and exit with its value. ++ But let the libc call main. */ ++ call BP_SYM (__libc_start_main)@PLT ++#else ++ /* Pass address of our own entry points to .fini and .init. */ ++ movq $__libc_csu_fini, %r8 ++ movq $__libc_csu_init, %rcx ++ ++ movq $BP_SYM (main), %rdi ++ ++ /* Call the user's main function, and exit with its value. ++ But let the libc call main. */ ++ call BP_SYM (__libc_start_main) ++#endif ++ ++ hlt /* Crash if somehow `exit' does return. */ ++ ++/* Define a symbol for the first piece of initialized data. */ ++ .data ++ .globl __data_start ++__data_start: ++ .long 0 ++ .weak data_start ++ data_start = __data_start +--- /dev/null +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/start_thread.S @@ -0,0 +1,196 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. -- To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1uafga-0002dl...@vasks.debian.org