[Glibc-bsd-commits] r4424 - in trunk/glibc-ports/kfreebsd: . mips x86_64

Petr Salinger ps-guest at alioth.debian.org
Thu May 9 20:36:43 UTC 2013


Author: ps-guest
Date: 2013-05-09 20:36:43 +0000 (Thu, 09 May 2013)
New Revision: 4424

Added:
   trunk/glibc-ports/kfreebsd/mips/start.S
   trunk/glibc-ports/kfreebsd/x86_64/start.S
Removed:
   trunk/glibc-ports/kfreebsd/_G_config.h
   trunk/glibc-ports/kfreebsd/mips/elf/
   trunk/glibc-ports/kfreebsd/x86_64/elf/
Modified:
   trunk/glibc-ports/kfreebsd/configure
   trunk/glibc-ports/kfreebsd/configure.in
Log:
cleanup for 2.17


Deleted: trunk/glibc-ports/kfreebsd/_G_config.h
===================================================================
--- trunk/glibc-ports/kfreebsd/_G_config.h	2013-05-09 19:21:36 UTC (rev 4423)
+++ trunk/glibc-ports/kfreebsd/_G_config.h	2013-05-09 20:36:43 UTC (rev 4424)
@@ -1,100 +0,0 @@
-/* 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 */

Modified: trunk/glibc-ports/kfreebsd/configure
===================================================================
--- trunk/glibc-ports/kfreebsd/configure	2013-05-09 19:21:36 UTC (rev 4423)
+++ trunk/glibc-ports/kfreebsd/configure	2013-05-09 20:36:43 UTC (rev 4424)
@@ -1,17 +1,6 @@
 # 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.

Modified: trunk/glibc-ports/kfreebsd/configure.in
===================================================================
--- trunk/glibc-ports/kfreebsd/configure.in	2013-05-09 19:21:36 UTC (rev 4423)
+++ trunk/glibc-ports/kfreebsd/configure.in	2013-05-09 20:36:43 UTC (rev 4424)
@@ -1,17 +1,6 @@
 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.

Copied: trunk/glibc-ports/kfreebsd/mips/start.S (from rev 4422, trunk/glibc-ports/kfreebsd/mips/elf/start.S)
===================================================================
--- trunk/glibc-ports/kfreebsd/mips/start.S	                        (rev 0)
+++ trunk/glibc-ports/kfreebsd/mips/start.S	2013-05-09 20:36:43 UTC (rev 4424)
@@ -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, at 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

Copied: trunk/glibc-ports/kfreebsd/x86_64/start.S (from rev 4422, trunk/glibc-ports/kfreebsd/x86_64/elf/start.S)
===================================================================
--- trunk/glibc-ports/kfreebsd/x86_64/start.S	                        (rev 0)
+++ trunk/glibc-ports/kfreebsd/x86_64/start.S	2013-05-09 20:36:43 UTC (rev 4424)
@@ -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 <aj at 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, at 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 at GOTPCREL(%rip), %r8
+	movq __libc_csu_init at 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




More information about the Glibc-bsd-commits mailing list