Browse Source

Allow compilation of assembly files on OSX

Keno Fischer 13 năm trước cách đây
mục cha
commit
f0862df1db
79 tập tin đã thay đổi với 2015 bổ sung197 xóa
  1. 9 5
      Make.inc
  2. 2 2
      Makefile
  3. 14 0
      amd64/Makefile
  4. 96 0
      amd64/bsd_asm.h
  5. 577 0
      amd64/bsd_cdefs.h
  6. 3 3
      amd64/e_remainder.S
  7. 3 3
      amd64/e_remainderf.S
  8. 2 2
      amd64/e_remainderl.S
  9. 2 2
      amd64/e_sqrt.S
  10. 2 2
      amd64/e_sqrtf.S
  11. 2 2
      amd64/e_sqrtl.S
  12. 1 1
      amd64/s_llrint.S
  13. 1 1
      amd64/s_llrintf.S
  14. 2 2
      amd64/s_llrintl.S
  15. 2 2
      amd64/s_logbl.S
  16. 2 2
      amd64/s_lrint.S
  17. 2 2
      amd64/s_lrintf.S
  18. 2 2
      amd64/s_lrintl.S
  19. 2 2
      amd64/s_remquo.S
  20. 2 2
      amd64/s_remquof.S
  21. 2 2
      amd64/s_remquol.S
  22. 2 2
      amd64/s_rintl.S
  23. 2 2
      amd64/s_scalbn.S
  24. 2 2
      amd64/s_scalbnf.S
  25. 3 3
      amd64/s_scalbnl.S
  26. 26 0
      i387/Makefile
  27. 117 0
      i387/bsd_asm.h
  28. 577 0
      i387/bsd_cdefs.h
  29. 3 3
      i387/e_exp.S
  30. 2 2
      i387/e_fmod.S
  31. 2 2
      i387/e_log.S
  32. 2 2
      i387/e_log10.S
  33. 2 2
      i387/e_log10f.S
  34. 2 2
      i387/e_logf.S
  35. 2 2
      i387/e_remainder.S
  36. 2 2
      i387/e_remainderf.S
  37. 2 2
      i387/e_remainderl.S
  38. 2 2
      i387/e_sqrt.S
  39. 2 2
      i387/e_sqrtf.S
  40. 2 2
      i387/e_sqrtl.S
  41. 408 0
      i387/osx_asm.h
  42. 3 4
      i387/s_ceil.S
  43. 2 2
      i387/s_ceilf.S
  44. 2 2
      i387/s_ceill.S
  45. 2 2
      i387/s_copysign.S
  46. 2 2
      i387/s_copysignf.S
  47. 2 2
      i387/s_copysignl.S
  48. 2 2
      i387/s_cos.S
  49. 2 2
      i387/s_finite.S
  50. 2 2
      i387/s_floor.S
  51. 2 2
      i387/s_floorf.S
  52. 2 2
      i387/s_floorl.S
  53. 2 2
      i387/s_llrint.S
  54. 2 2
      i387/s_llrintf.S
  55. 2 2
      i387/s_llrintl.S
  56. 2 2
      i387/s_logb.S
  57. 2 2
      i387/s_logbf.S
  58. 2 2
      i387/s_logbl.S
  59. 2 2
      i387/s_lrint.S
  60. 2 2
      i387/s_lrintf.S
  61. 2 2
      i387/s_lrintl.S
  62. 2 2
      i387/s_remquo.S
  63. 2 2
      i387/s_remquof.S
  64. 2 2
      i387/s_remquol.S
  65. 2 2
      i387/s_rint.S
  66. 2 2
      i387/s_rintf.S
  67. 2 2
      i387/s_rintl.S
  68. 2 2
      i387/s_scalbn.S
  69. 2 2
      i387/s_scalbnf.S
  70. 2 2
      i387/s_scalbnl.S
  71. 2 2
      i387/s_significand.S
  72. 2 2
      i387/s_significandf.S
  73. 2 2
      i387/s_sin.S
  74. 2 2
      i387/s_tan.S
  75. 2 2
      i387/s_trunc.S
  76. 2 2
      i387/s_truncf.S
  77. 2 2
      i387/s_truncl.S
  78. 2 2
      ld128/Makefile
  79. 48 48
      src/Makefile

+ 9 - 5
Make.inc

@@ -1,11 +1,14 @@
 CC=gcc
-CFLAGS=-Wall -O2 -I. -I../include -I../ld128 -I../src -D__BSD_VISIBLE -Wno-implicit-function-declaration
+CFLAGS= -Wall -O2 -I. -I.. -I../include -I../ld128 -I../src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
 
 default: all
 
-%.o: %.c
+%.c.o: %.c
 	$(QUIET_CC)$(CC) $(CFLAGS) -c $< -o $@
 
+%.S.o: %.S
+	$(CC) $(filter -f% -m% -B% -I% -D%,$(CFLAGS)) -c $< -o $@
+
 clean:
 	rm -f *.o *~
 
@@ -20,17 +23,17 @@ endif
 
 ifeq ($(OS), Linux)
 SHLIB_EXT = so
-CFLAGS+=-fPIC
+CFLAGS+=-std=gnu99 -fPIC
 endif
 
 ifeq ($(OS), FreeBSD)
 SHLIB_EXT = so
-CFLAGS+=-fPIC
+CFLAGS+=-std=gnu99 -fPIC
 endif
 
 ifeq ($(OS), Darwin)
 SHLIB_EXT = dylib
-CFLAGS+=-std=c99 -fPIC
+CFLAGS+=-std=gnu99 -fPIC
 endif
 
 ifeq ($(OS), WINNT)
@@ -47,4 +50,5 @@ MAKECOLOR="\033[32;1m"
 ENDCOLOR="\033[0m"
 
 QUIET_CC = @printf '    %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR);
+QUIET_ASM = @printf '    %b %b\n' $(CCCOLOR)ASM$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR);
 QUIET_LINK = @printf '    %b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR);

+ 2 - 2
Makefile

@@ -4,8 +4,8 @@ all:
 	$(MAKE) -C src all
 	$(MAKE) -C ld128 all
 	$(MAKE) -C bsdsrc all
-	$(QUIET_LINK)ar -rcs libopenlibm.a src/*.o ld128/*.o bsdsrc/*.o
-	$(QUIET_LINK)$(CC) -shared -fPIC src/*.o ld128/*.o bsdsrc/*.o -o libopenlibm.$(SHLIB_EXT)
+	$(QUIET_LINK)ar -rcs libopenlibm.a src/*.c.o ld128/*.c.o bsdsrc/*.c.o
+	$(QUIET_LINK)$(CC) -shared -fPIC src/*.c.o ld128/*.c.o bsdsrc/*.c.o -o libopenlibm.$(SHLIB_EXT)
 
 cleanall:
 	$(MAKE) -C src clean

+ 14 - 0
amd64/Makefile

@@ -0,0 +1,14 @@
+include ../Make.inc
+
+SRCS = e_remainder.S e_remainderf.S e_remainderl.S \
+	    e_sqrt.S e_sqrtf.S e_sqrtl.S \
+	    s_llrint.S s_llrintf.S s_llrintl.S \
+	    s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \
+	    s_remquo.S s_remquof.S s_remquol.S \
+	    s_rintl.S s_scalbn.S s_scalbnf.S s_scalbnl.S
+
+CFLAGS += -m64
+
+all: $(patsubst %.S,%.S.o,$(SRCS))
+
+SYM_MAPS += ${.CURDIR}/amd64/Symbol.map

+ 96 - 0
amd64/bsd_asm.h

@@ -0,0 +1,96 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)DEFS.h	5.1 (Berkeley) 4/23/90
+ * $FreeBSD: src/sys/amd64/include/asm.h,v 1.18 2007/08/22 04:26:07 jkoshy Exp $
+ */
+
+#ifndef _MACHINE_ASM_H_
+#define	_MACHINE_ASM_H_
+
+#ifdef __APPLE__
+#include "../i387/osx_asm.h"
+#define CNAME(x) EXT(x)
+#else
+#include "bsd_cdefs.h"
+
+#ifdef PIC
+#define	PIC_PLT(x)	x@PLT
+#define	PIC_GOT(x)	x@GOTPCREL(%rip)
+#else
+#define	PIC_PLT(x)	x
+#define	PIC_GOT(x)	x
+#endif
+
+/*
+ * CNAME and HIDENAME manage the relationship between symbol names in C
+ * and the equivalent assembly language names.  CNAME is given a name as
+ * it would be used in a C program.  It expands to the equivalent assembly
+ * language name.  HIDENAME is given an assembly-language name, and expands
+ * to a possibly-modified form that will be invisible to C programs.
+ */
+#define CNAME(csym)		csym
+#define HIDENAME(asmsym)	.asmsym
+
+#define _START_ENTRY	.text; .p2align 4,0x90
+
+#define _ENTRY(x)	_START_ENTRY; \
+			.globl CNAME(x); .type CNAME(x),@function; CNAME(x):
+
+#ifdef PROF
+#define	ALTENTRY(x)	_ENTRY(x); \
+			pushq %rbp; movq %rsp,%rbp; \
+			call PIC_PLT(HIDENAME(mcount)); \
+			popq %rbp; \
+			jmp 9f
+#define	ENTRY(x)	_ENTRY(x); \
+			pushq %rbp; movq %rsp,%rbp; \
+			call PIC_PLT(HIDENAME(mcount)); \
+			popq %rbp; \
+			9:
+#else
+#define	ALTENTRY(x)	_ENTRY(x)
+#define	ENTRY(x)	_ENTRY(x)
+#endif
+
+#define	END(x)		.size x, . - x
+
+#define RCSID(x)	.text; .asciz x
+
+#undef __FBSDID
+#if !defined(lint) && !defined(STRIP_FBSDID)
+#define __FBSDID(s)	.ident s
+#else
+#define __FBSDID(s)	/* nothing */
+#endif /* not lint and not STRIP_FBSDID */
+
+#endif
+#endif /* !_MACHINE_ASM_H_ */

+ 577 - 0
amd64/bsd_cdefs.h

@@ -0,0 +1,577 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
+ * $FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $
+ */
+
+#ifndef	_SYS_CDEFS_H_
+#define	_SYS_CDEFS_H_
+
+#if defined(__cplusplus)
+#define	__BEGIN_DECLS	extern "C" {
+#define	__END_DECLS	}
+#else
+#define	__BEGIN_DECLS
+#define	__END_DECLS
+#endif
+
+/*
+ * This code has been put in place to help reduce the addition of
+ * compiler specific defines in FreeBSD code.  It helps to aid in
+ * having a compiler-agnostic source tree.
+ */
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+
+#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
+#define __GNUCLIKE_ASM 3
+#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
+#else
+#define __GNUCLIKE_ASM 2
+#endif
+#define __GNUCLIKE___TYPEOF 1
+#define __GNUCLIKE___OFFSETOF 1
+#define __GNUCLIKE___SECTION 1
+
+#ifndef __INTEL_COMPILER
+# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
+#endif
+
+#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
+# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
+    && __INTEL_COMPILER < 800
+#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
+# endif
+
+#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
+# define __GNUCLIKE_BUILTIN_VARARGS 1
+# define __GNUCLIKE_BUILTIN_STDARG 1
+# define __GNUCLIKE_BUILTIN_VAALIST 1
+#endif
+
+#if defined(__GNUC__)
+# define __GNUC_VA_LIST_COMPATIBILITY 1
+#endif
+
+#ifndef __INTEL_COMPILER
+# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
+# define __GNUCLIKE_MATH_BUILTIN_RELOPS
+#endif
+
+#define __GNUCLIKE_BUILTIN_MEMCPY 1
+
+/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
+#define __CC_SUPPORTS_INLINE 1
+#define __CC_SUPPORTS___INLINE 1
+#define __CC_SUPPORTS___INLINE__ 1
+
+#define __CC_SUPPORTS___FUNC__ 1
+#define __CC_SUPPORTS_WARNING 1
+
+#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
+
+#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
+
+#endif /* __GNUC__ || __INTEL_COMPILER */
+
+/*
+ * Macro to test if we're using a specific version of gcc or later.
+ */
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#define	__GNUC_PREREQ__(ma, mi)	\
+	(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
+#else
+#define	__GNUC_PREREQ__(ma, mi)	0
+#endif
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
+ * mode -- there must be no spaces between its arguments, and for nested
+ * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
+ * concatenate double-quoted strings produced by the __STRING macro, but
+ * this only works with ANSI C.
+ *
+ * __XSTRING is like __STRING, but it expands any macros in its argument
+ * first.  It is only available with ANSI C.
+ */
+#if defined(__STDC__) || defined(__cplusplus)
+#define	__P(protos)	protos		/* full-blown ANSI C */
+#define	__CONCAT1(x,y)	x ## y
+#define	__CONCAT(x,y)	__CONCAT1(x,y)
+#define	__STRING(x)	#x		/* stringify without expanding x */
+#define	__XSTRING(x)	__STRING(x)	/* expand x, then stringify */
+
+#define	__const		const		/* define reserved names to standard */
+#define	__signed	signed
+#define	__volatile	volatile
+#if defined(__cplusplus)
+#define	__inline	inline		/* convert to C++ keyword */
+#else
+#if !(defined(__CC_SUPPORTS___INLINE))
+#define	__inline			/* delete GCC keyword */
+#endif /* ! __CC_SUPPORTS___INLINE */
+#endif /* !__cplusplus */
+
+#else	/* !(__STDC__ || __cplusplus) */
+#define	__P(protos)	()		/* traditional C preprocessor */
+#define	__CONCAT(x,y)	x/**/y
+#define	__STRING(x)	"x"
+
+#if !defined(__CC_SUPPORTS___INLINE)
+#define	__const				/* delete pseudo-ANSI C keywords */
+#define	__inline
+#define	__signed
+#define	__volatile
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * When using a compiler other than gcc, programs using the ANSI C keywords
+ * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
+ * When using "gcc -traditional", we assume that this is the intent; if
+ * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
+ */
+#ifndef	NO_ANSI_KEYWORDS
+#define	const				/* delete ANSI C keywords */
+#define	inline
+#define	signed
+#define	volatile
+#endif	/* !NO_ANSI_KEYWORDS */
+#endif	/* !__CC_SUPPORTS___INLINE */
+#endif	/* !(__STDC__ || __cplusplus) */
+
+/*
+ * Compiler-dependent macros to help declare dead (non-returning) and
+ * pure (no side effects) functions, and unused variables.  They are
+ * null except for versions of gcc that are known to support the features
+ * properly (old versions of gcc-2 supported the dead and pure features
+ * in a different (wrong) way).  If we do not provide an implementation
+ * for a given compiler, let the compile fail if it is told to use
+ * a feature that we cannot live without.
+ */
+#ifdef lint
+#define	__dead2
+#define	__pure2
+#define	__unused
+#define	__packed
+#define	__aligned(x)
+#define	__section(x)
+#else
+#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
+#define	__dead2
+#define	__pure2
+#define	__unused
+#endif
+#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
+#define	__dead2		__attribute__((__noreturn__))
+#define	__pure2		__attribute__((__const__))
+#define	__unused
+/* XXX Find out what to do for __packed, __aligned and __section */
+#endif
+#if __GNUC_PREREQ__(2, 7)
+#define	__dead2		__attribute__((__noreturn__))
+#define	__pure2		__attribute__((__const__))
+#define	__unused	__attribute__((__unused__))
+#define	__used		__attribute__((__used__))
+#define	__packed	__attribute__((__packed__))
+#define	__aligned(x)	__attribute__((__aligned__(x)))
+#define	__section(x)	__attribute__((__section__(x)))
+#endif
+#if defined(__INTEL_COMPILER)
+#define __dead2		__attribute__((__noreturn__))
+#define __pure2		__attribute__((__const__))
+#define __unused	__attribute__((__unused__))
+#define __used		__attribute__((__used__))
+#define __packed	__attribute__((__packed__))
+#define __aligned(x)	__attribute__((__aligned__(x)))
+#define __section(x)	__attribute__((__section__(x)))
+#endif
+#endif
+
+#if __GNUC_PREREQ__(2, 96)
+#define	__malloc_like	__attribute__((__malloc__))
+#define	__pure		__attribute__((__pure__))
+#else
+#define	__malloc_like
+#define	__pure
+#endif
+
+#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
+#define	__always_inline	__attribute__((__always_inline__))
+#else
+#define	__always_inline
+#endif
+
+#if __GNUC_PREREQ__(3, 1)
+#define	__noinline	__attribute__ ((__noinline__))
+#else
+#define	__noinline
+#endif
+
+#if __GNUC_PREREQ__(3, 3)
+#define __nonnull(x)	__attribute__((__nonnull__(x)))
+#else
+#define __nonnull(x)
+#endif
+
+/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
+#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
+#define	__func__	NULL
+#endif
+
+#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
+#define	__LONG_LONG_SUPPORTED
+#endif
+
+/*
+ * GCC 2.95 provides `__restrict' as an extension to C90 to support the
+ * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
+ * a way to define the `restrict' type qualifier without disturbing older
+ * software that is unaware of C99 keywords.
+ */
+#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
+#define	__restrict
+#else
+#define	__restrict	restrict
+#endif
+#endif
+
+/*
+ * GNU C version 2.96 adds explicit branch prediction so that
+ * the CPU back-end can hint the processor and also so that
+ * code blocks can be reordered such that the predicted path
+ * sees a more linear flow, thus improving cache behavior, etc.
+ *
+ * The following two macros provide us with a way to utilize this
+ * compiler feature.  Use __predict_true() if you expect the expression
+ * to evaluate to true, and __predict_false() if you expect the
+ * expression to evaluate to false.
+ *
+ * A few notes about usage:
+ *
+ *	* Generally, __predict_false() error condition checks (unless
+ *	  you have some _strong_ reason to do otherwise, in which case
+ *	  document it), and/or __predict_true() `no-error' condition
+ *	  checks, assuming you want to optimize for the no-error case.
+ *
+ *	* Other than that, if you don't know the likelihood of a test
+ *	  succeeding from empirical or other `hard' evidence, don't
+ *	  make predictions.
+ *
+ *	* These are meant to be used in places that are run `a lot'.
+ *	  It is wasteful to make predictions in code that is run
+ *	  seldomly (e.g. at subsystem initialization time) as the
+ *	  basic block reordering that this affects can often generate
+ *	  larger code.
+ */
+#if __GNUC_PREREQ__(2, 96)
+#define __predict_true(exp)     __builtin_expect((exp), 1)
+#define __predict_false(exp)    __builtin_expect((exp), 0)
+#else
+#define __predict_true(exp)     (exp)
+#define __predict_false(exp)    (exp)
+#endif
+
+#if __GNUC_PREREQ__(4, 2)
+#define	__hidden	__attribute__((__visibility__("hidden")))
+#define	__exported	__attribute__((__visibility__("default")))
+#else
+#define	__hidden
+#define	__exported
+#endif
+
+/*
+ * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
+ * require it.
+ */
+#if __GNUC_PREREQ__(4, 1)
+#define __offsetof(type, field)	 __builtin_offsetof(type, field)
+#else
+#ifndef __cplusplus
+#define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
+#else
+#define __offsetof(type, field)					\
+  (__offsetof__ (reinterpret_cast <size_t>			\
+                 (&reinterpret_cast <const volatile char &>	\
+                  (static_cast<type *> (0)->field))))
+#endif
+#endif
+#define	__rangeof(type, start, end) \
+	(__offsetof(type, end) - __offsetof(type, start))
+
+/*
+ * Compiler-dependent macros to declare that functions take printf-like
+ * or scanf-like arguments.  They are null except for versions of gcc
+ * that are known to support the features properly (old versions of gcc-2
+ * didn't permit keeping the keywords out of the application namespace).
+ */
+#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
+#define	__printflike(fmtarg, firstvararg)
+#define	__scanflike(fmtarg, firstvararg)
+#define	__format_arg(fmtarg)
+#else
+#define	__printflike(fmtarg, firstvararg) \
+	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+#define	__scanflike(fmtarg, firstvararg) \
+	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
+#define	__format_arg(fmtarg)	__attribute__((__format_arg__ (fmtarg)))
+#endif
+
+/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
+#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#define	__printf0like(fmtarg, firstvararg) \
+	    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
+#else
+#define	__printf0like(fmtarg, firstvararg)
+#endif
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+#ifndef __INTEL_COMPILER
+#define	__strong_reference(sym,aliassym)	\
+	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
+#endif
+#ifdef __STDC__
+#define	__weak_reference(sym,alias)	\
+	__asm__(".weak " #alias);	\
+	__asm__(".equ "  #alias ", " #sym)
+#define	__warn_references(sym,msg)	\
+	__asm__(".section .gnu.warning." #sym);	\
+	__asm__(".asciz \"" msg "\"");	\
+	__asm__(".previous")
+#define	__sym_compat(sym,impl,verid)	\
+	__asm__(".symver " #impl ", " #sym "@" #verid)
+#define	__sym_default(sym,impl,verid)	\
+	__asm__(".symver " #impl ", " #sym "@@" #verid)
+#else
+#define	__weak_reference(sym,alias)	\
+	__asm__(".weak alias");		\
+	__asm__(".equ alias, sym")
+#define	__warn_references(sym,msg)	\
+	__asm__(".section .gnu.warning.sym"); \
+	__asm__(".asciz \"msg\"");	\
+	__asm__(".previous")
+#define	__sym_compat(sym,impl,verid)	\
+	__asm__(".symver impl, sym@verid")
+#define	__sym_default(impl,sym,verid)	\
+	__asm__(".symver impl, sym@@verid")
+#endif	/* __STDC__ */
+#endif	/* __GNUC__ || __INTEL_COMPILER */
+
+#define	__GLOBL1(sym)	__asm__(".globl " #sym)
+#define	__GLOBL(sym)	__GLOBL1(sym)
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+#define	__IDSTRING(name,string)	__asm__(".ident\t\"" string "\"")
+#else
+/*
+ * The following definition might not work well if used in header files,
+ * but it should be better than nothing.  If you want a "do nothing"
+ * version, then it should generate some harmless declaration, such as:
+ *    #define __IDSTRING(name,string)	struct __hack
+ */
+#define	__IDSTRING(name,string)	static const char name[] __unused = string
+#endif
+
+/*
+ * Embed the rcs id of a source file in the resulting library.  Note that in
+ * more recent ELF binutils, we use .ident allowing the ID to be stripped.
+ * Usage:
+ *	__FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $");
+ */
+#ifndef	__FBSDID
+#if !defined(lint) && !defined(STRIP_FBSDID)
+#define	__FBSDID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
+#else
+#define	__FBSDID(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__RCSID
+#ifndef	NO__RCSID
+#define	__RCSID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
+#else
+#define	__RCSID(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__RCSID_SOURCE
+#ifndef	NO__RCSID_SOURCE
+#define	__RCSID_SOURCE(s)	__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
+#else
+#define	__RCSID_SOURCE(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__SCCSID
+#ifndef	NO__SCCSID
+#define	__SCCSID(s)	__IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
+#else
+#define	__SCCSID(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__COPYRIGHT
+#ifndef	NO__COPYRIGHT
+#define	__COPYRIGHT(s)	__IDSTRING(__CONCAT(__copyright_,__LINE__),s)
+#else
+#define	__COPYRIGHT(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__DECONST
+#define	__DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
+#endif
+
+#ifndef	__DEVOLATILE
+#define	__DEVOLATILE(type, var)	((type)(uintptr_t)(volatile void *)(var))
+#endif
+
+#ifndef	__DEQUALIFY
+#define	__DEQUALIFY(type, var)	((type)(uintptr_t)(const volatile void *)(var))
+#endif
+
+/*-
+ * The following definitions are an extension of the behavior originally
+ * implemented in <sys/_posix.h>, but with a different level of granularity.
+ * POSIX.1 requires that the macros we test be defined before any standard
+ * header file is included.
+ *
+ * Here's a quick run-down of the versions:
+ *  defined(_POSIX_SOURCE)		1003.1-1988
+ *  _POSIX_C_SOURCE == 1		1003.1-1990
+ *  _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option
+ *  _POSIX_C_SOURCE == 199309		1003.1b-1993
+ *  _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995,
+ *					and the omnibus ISO/IEC 9945-1: 1996
+ *  _POSIX_C_SOURCE == 200112		1003.1-2001
+ *  _POSIX_C_SOURCE == 200809		1003.1-2008
+ *
+ * In addition, the X/Open Portability Guide, which is now the Single UNIX
+ * Specification, defines a feature-test macro which indicates the version of
+ * that specification, and which subsumes _POSIX_C_SOURCE.
+ *
+ * Our macros begin with two underscores to avoid namespace screwage.
+ */
+
+/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
+#undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */
+#define	_POSIX_C_SOURCE		199009
+#endif
+
+/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		199209
+#endif
+
+/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
+#ifdef _XOPEN_SOURCE
+#if _XOPEN_SOURCE - 0 >= 700
+#define	__XSI_VISIBLE		700
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		200809
+#elif _XOPEN_SOURCE - 0 >= 600
+#define	__XSI_VISIBLE		600
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		200112
+#elif _XOPEN_SOURCE - 0 >= 500
+#define	__XSI_VISIBLE		500
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		199506
+#endif
+#endif
+
+/*
+ * Deal with all versions of POSIX.  The ordering relative to the tests above is
+ * important.
+ */
+#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
+#define	_POSIX_C_SOURCE		198808
+#endif
+#ifdef _POSIX_C_SOURCE
+#if _POSIX_C_SOURCE >= 200809
+#define	__POSIX_VISIBLE		200809
+#define	__ISO_C_VISIBLE		1999
+#elif _POSIX_C_SOURCE >= 200112
+#define	__POSIX_VISIBLE		200112
+#define	__ISO_C_VISIBLE		1999
+#elif _POSIX_C_SOURCE >= 199506
+#define	__POSIX_VISIBLE		199506
+#define	__ISO_C_VISIBLE		1990
+#elif _POSIX_C_SOURCE >= 199309
+#define	__POSIX_VISIBLE		199309
+#define	__ISO_C_VISIBLE		1990
+#elif _POSIX_C_SOURCE >= 199209
+#define	__POSIX_VISIBLE		199209
+#define	__ISO_C_VISIBLE		1990
+#elif _POSIX_C_SOURCE >= 199009
+#define	__POSIX_VISIBLE		199009
+#define	__ISO_C_VISIBLE		1990
+#else
+#define	__POSIX_VISIBLE		198808
+#define	__ISO_C_VISIBLE		0
+#endif /* _POSIX_C_SOURCE */
+#else
+/*-
+ * Deal with _ANSI_SOURCE:
+ * If it is defined, and no other compilation environment is explicitly
+ * requested, then define our internal feature-test macros to zero.  This
+ * makes no difference to the preprocessor (undefined symbols in preprocessing
+ * expressions are defined to have value zero), but makes it more convenient for
+ * a test program to print out the values.
+ *
+ * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
+ * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
+ * environment (and in fact we will never get here).
+ */
+#if defined(_ANSI_SOURCE)	/* Hide almost everything. */
+#define	__POSIX_VISIBLE		0
+#define	__XSI_VISIBLE		0
+#define	__BSD_VISIBLE		0
+#define	__ISO_C_VISIBLE		1990
+#elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */
+#define	__POSIX_VISIBLE		0
+#define	__XSI_VISIBLE		0
+#define	__BSD_VISIBLE		0
+#define	__ISO_C_VISIBLE		1999
+#else				/* Default environment: show everything. */
+#define	__POSIX_VISIBLE		200809
+#define	__XSI_VISIBLE		700
+#define	__BSD_VISIBLE		1
+#define	__ISO_C_VISIBLE		1999
+#endif
+#endif
+
+#endif /* !_SYS_CDEFS_H_ */

+ 3 - 3
amd64/e_remainder.S

@@ -33,9 +33,9 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 
-RCSID("from: FreeBSD: src/lib/msun/i387/e_remainder.S,v 1.8 2005/02/04 14:08:32 das Exp")
+//RCSID("from: FreeBSD: src/lib/msun/i387/e_remainder.S,v 1.8 2005/02/04 14:08:32 das Exp")
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainder.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(remainder)
@@ -52,4 +52,4 @@ ENTRY(remainder)
 	fstp	%st
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 3 - 3
amd64/e_remainderf.S

@@ -3,9 +3,9 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 
-RCSID("from: $NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $")
+//RCSID("from: $NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $")
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainderf.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(remainderf)
@@ -22,4 +22,4 @@ ENTRY(remainderf)
 	fstp	%st
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/e_remainderl.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainderl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
 
@@ -47,4 +47,4 @@ ENTRY(remainderl)
 	fstp	%st(1)
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/e_sqrt.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrt.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
 	
 ENTRY(sqrt)
@@ -33,4 +33,4 @@ ENTRY(sqrt)
 END(sqrt)
 
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/e_sqrtf.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrtf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 	
 ENTRY(sqrtf)
@@ -32,4 +32,4 @@ ENTRY(sqrtf)
 	ret
 END(sqrtf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/e_sqrtl.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrtl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
 	
 ENTRY(sqrtl)
@@ -32,4 +32,4 @@ ENTRY(sqrtl)
 	fsqrt
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 1 - 1
amd64/s_llrint.S

@@ -1,4 +1,4 @@
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrint.S,v 1.3 2011/02/04 21:54:06 kib Exp $")
 	
 /* sizeof(long) == sizeof(long long) */

+ 1 - 1
amd64/s_llrintf.S

@@ -1,4 +1,4 @@
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrintf.S,v 1.3 2011/02/04 21:54:06 kib Exp $")
 	
 /* sizeof(long) == sizeof(long long) */

+ 2 - 2
amd64/s_llrintl.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(llrintl)
@@ -34,4 +34,4 @@ ENTRY(llrintl)
 	popq	%rax
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_logbl.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_logbl.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(logbl)
@@ -42,4 +42,4 @@ ENTRY(logbl)
 	fstp	%st
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_lrint.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 
 #ifndef fn
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
@@ -36,4 +36,4 @@ ENTRY(fn)
 	ret
 END(fn)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_lrintf.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 
 #ifndef fn
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
@@ -36,4 +36,4 @@ ENTRY(fn)
 	ret
 END(fn)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_lrintl.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(lrintl)
@@ -34,4 +34,4 @@ ENTRY(lrintl)
 	popq	%rax
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_remquo.S

@@ -28,7 +28,7 @@
  * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquo.S,v 1.3 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(remquo)
@@ -65,4 +65,4 @@ ENTRY(remquo)
 	ret
 END(remquo)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_remquof.S

@@ -28,7 +28,7 @@
  * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquof.S,v 1.3 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(remquof)
@@ -65,4 +65,4 @@ ENTRY(remquof)
 	ret
 END(remquof)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_remquol.S

@@ -28,7 +28,7 @@
  * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquol.S,v 1.2 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(remquol)
@@ -61,4 +61,4 @@ ENTRY(remquol)
 	movl	%eax,(%rdi)
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_rintl.S

@@ -35,11 +35,11 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 
 ENTRY(rintl)
 	fldt	8(%rsp)
 	frndint
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_scalbn.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbn.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(scalbn)
@@ -39,4 +39,4 @@ ENTRY(scalbn)
 	ret
 END(scalbn)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
amd64/s_scalbnf.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbnf.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(scalbnf)
@@ -42,4 +42,4 @@ END(scalbnf)
 .globl CNAME(ldexpf)
 .set	CNAME(ldexpf),CNAME(scalbnf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 3 - 3
amd64/s_scalbnl.S

@@ -3,9 +3,9 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <amd64/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbnl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
-/* RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
+/* //RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
 
 ENTRY(scalbnl)
 	movl	%edi,-4(%rsp)
@@ -19,4 +19,4 @@ END(scalbnl)
 .globl	CNAME(ldexpl)
 .set	CNAME(ldexpl),CNAME(scalbnl)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 26 - 0
i387/Makefile

@@ -0,0 +1,26 @@
+include ../Make.inc
+
+SRCS = e_exp.S e_fmod.S e_log.S e_log10.S \
+	    e_remainder.S e_sqrt.S s_ceil.S s_copysign.S \
+	    s_cos.S s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \
+	    s_remquo.S s_rint.S s_scalbn.S s_significand.S s_sin.S s_tan.S \
+	    s_trunc.S
+
+# float counterparts
+SRCS+= e_log10f.S e_logf.S e_remainderf.S \
+	    e_sqrtf.S s_ceilf.S s_copysignf.S s_floorf.S \
+	    s_llrintf.S s_logbf.S s_lrintf.S \
+	    s_remquof.S s_rintf.S s_scalbnf.S s_significandf.S s_truncf.S
+
+# long double counterparts
+SRCS+= e_remainderl.S e_sqrtl.S s_ceill.S s_copysignl.S \
+	    s_floorl.S s_llrintl.S \
+	    s_logbl.S s_lrintl.S s_remquol.S s_rintl.S s_scalbnl.S s_truncl.S
+
+CFLAGS += -m32
+
+all: $(patsubst %.S,%.S.o,$(SRCS))
+
+
+LDBL_PREC = 64	# XXX 64-bit format, but truncated to 53 bits
+SYM_MAPS += ${.CURDIR}/i387/Symbol.map

+ 117 - 0
i387/bsd_asm.h

@@ -0,0 +1,117 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)DEFS.h	5.1 (Berkeley) 4/23/90
+ * $FreeBSD: src/sys/i386/include/asm.h,v 1.14 2007/08/22 04:26:07 jkoshy Exp $
+ */
+
+#ifndef _MACHINE_ASM_H_
+#define	_MACHINE_ASM_H_
+
+#if defined(__APPLE__)
+#include "osx_asm.h"
+#define CNAME(x) EXT(x)
+#elif defined(__FreeBSD__) || defined(__linux__)
+#include "bsd_cdefs.h"
+
+#ifdef PIC
+#define	PIC_PROLOGUE	\
+	pushl	%ebx;	\
+	call	1f;	\
+1:			\
+	popl	%ebx;	\
+	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
+#define	PIC_EPILOGUE	\
+	popl	%ebx
+#define	PIC_PLT(x)	x@PLT
+#define	PIC_GOT(x)	x@GOT(%ebx)
+#else
+#define	PIC_PROLOGUE
+#define	PIC_EPILOGUE
+#define	PIC_PLT(x)	x
+#define	PIC_GOT(x)	x
+#endif
+
+/*
+ * CNAME and HIDENAME manage the relationship between symbol names in C
+ * and the equivalent assembly language names.  CNAME is given a name as
+ * it would be used in a C program.  It expands to the equivalent assembly
+ * language name.  HIDENAME is given an assembly-language name, and expands
+ * to a possibly-modified form that will be invisible to C programs.
+ */
+
+#if defined(__FreeBSD__) || defined(__linux__)
+#define CNAME(csym)		csym
+#define HIDENAME(asmsym)	.asmsym
+
+/* XXX should use .p2align 4,0x90 for -m486. */
+#define _START_ENTRY	.text; .p2align 2,0x90
+
+#define _ENTRY(x)	_START_ENTRY; \
+			.globl CNAME(x); .type CNAME(x),@function; CNAME(x):
+#define	END(x)		.size x, . - x
+#else
+#define CNAME(csym)		_csym
+#define HIDENAME(asmsym)	.asmsym
+
+/* XXX should use .p2align 4,0x90 for -m486. */
+#define _START_ENTRY	.text; .p2align 2,0x90
+
+#define _ENTRY(x)	_START_ENTRY; \
+            .globl CNAME(x); CNAME(x):
+#define	END(x)		.size x, . - x
+#endif
+
+
+
+#ifdef PROF
+#define	ALTENTRY(x)	_ENTRY(x); \
+			pushl %ebp; movl %esp,%ebp; \
+			call PIC_PLT(HIDENAME(mcount)); \
+			popl %ebp; \
+			jmp 9f
+#define	ENTRY(x)	_ENTRY(x); \
+			pushl %ebp; movl %esp,%ebp; \
+			call PIC_PLT(HIDENAME(mcount)); \
+			popl %ebp; \
+			9:
+#else
+#define	ALTENTRY(x)	_ENTRY(x)
+#define	ENTRY(x)	_ENTRY(x)
+#endif
+
+#define RCSID(x)	.text; .asciz x
+
+#undef __FBSDID
+#define __FBSDID(s)	/* nothing */
+
+#endif
+#endif /* !_MACHINE_ASM_H_ */

+ 577 - 0
i387/bsd_cdefs.h

@@ -0,0 +1,577 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
+ * $FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $
+ */
+
+#ifndef	_SYS_CDEFS_H_
+#define	_SYS_CDEFS_H_
+
+#if defined(__cplusplus)
+#define	__BEGIN_DECLS	extern "C" {
+#define	__END_DECLS	}
+#else
+#define	__BEGIN_DECLS
+#define	__END_DECLS
+#endif
+
+/*
+ * This code has been put in place to help reduce the addition of
+ * compiler specific defines in FreeBSD code.  It helps to aid in
+ * having a compiler-agnostic source tree.
+ */
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+
+#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
+#define __GNUCLIKE_ASM 3
+#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
+#else
+#define __GNUCLIKE_ASM 2
+#endif
+#define __GNUCLIKE___TYPEOF 1
+#define __GNUCLIKE___OFFSETOF 1
+#define __GNUCLIKE___SECTION 1
+
+#ifndef __INTEL_COMPILER
+# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
+#endif
+
+#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
+# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
+    && __INTEL_COMPILER < 800
+#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
+# endif
+
+#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
+# define __GNUCLIKE_BUILTIN_VARARGS 1
+# define __GNUCLIKE_BUILTIN_STDARG 1
+# define __GNUCLIKE_BUILTIN_VAALIST 1
+#endif
+
+#if defined(__GNUC__)
+# define __GNUC_VA_LIST_COMPATIBILITY 1
+#endif
+
+#ifndef __INTEL_COMPILER
+# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
+# define __GNUCLIKE_MATH_BUILTIN_RELOPS
+#endif
+
+#define __GNUCLIKE_BUILTIN_MEMCPY 1
+
+/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
+#define __CC_SUPPORTS_INLINE 1
+#define __CC_SUPPORTS___INLINE 1
+#define __CC_SUPPORTS___INLINE__ 1
+
+#define __CC_SUPPORTS___FUNC__ 1
+#define __CC_SUPPORTS_WARNING 1
+
+#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
+
+#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
+
+#endif /* __GNUC__ || __INTEL_COMPILER */
+
+/*
+ * Macro to test if we're using a specific version of gcc or later.
+ */
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#define	__GNUC_PREREQ__(ma, mi)	\
+	(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
+#else
+#define	__GNUC_PREREQ__(ma, mi)	0
+#endif
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
+ * mode -- there must be no spaces between its arguments, and for nested
+ * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
+ * concatenate double-quoted strings produced by the __STRING macro, but
+ * this only works with ANSI C.
+ *
+ * __XSTRING is like __STRING, but it expands any macros in its argument
+ * first.  It is only available with ANSI C.
+ */
+#if defined(__STDC__) || defined(__cplusplus)
+#define	__P(protos)	protos		/* full-blown ANSI C */
+#define	__CONCAT1(x,y)	x ## y
+#define	__CONCAT(x,y)	__CONCAT1(x,y)
+#define	__STRING(x)	#x		/* stringify without expanding x */
+#define	__XSTRING(x)	__STRING(x)	/* expand x, then stringify */
+
+#define	__const		const		/* define reserved names to standard */
+#define	__signed	signed
+#define	__volatile	volatile
+#if defined(__cplusplus)
+#define	__inline	inline		/* convert to C++ keyword */
+#else
+#if !(defined(__CC_SUPPORTS___INLINE))
+#define	__inline			/* delete GCC keyword */
+#endif /* ! __CC_SUPPORTS___INLINE */
+#endif /* !__cplusplus */
+
+#else	/* !(__STDC__ || __cplusplus) */
+#define	__P(protos)	()		/* traditional C preprocessor */
+#define	__CONCAT(x,y)	x/**/y
+#define	__STRING(x)	"x"
+
+#if !defined(__CC_SUPPORTS___INLINE)
+#define	__const				/* delete pseudo-ANSI C keywords */
+#define	__inline
+#define	__signed
+#define	__volatile
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * When using a compiler other than gcc, programs using the ANSI C keywords
+ * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
+ * When using "gcc -traditional", we assume that this is the intent; if
+ * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
+ */
+#ifndef	NO_ANSI_KEYWORDS
+#define	const				/* delete ANSI C keywords */
+#define	inline
+#define	signed
+#define	volatile
+#endif	/* !NO_ANSI_KEYWORDS */
+#endif	/* !__CC_SUPPORTS___INLINE */
+#endif	/* !(__STDC__ || __cplusplus) */
+
+/*
+ * Compiler-dependent macros to help declare dead (non-returning) and
+ * pure (no side effects) functions, and unused variables.  They are
+ * null except for versions of gcc that are known to support the features
+ * properly (old versions of gcc-2 supported the dead and pure features
+ * in a different (wrong) way).  If we do not provide an implementation
+ * for a given compiler, let the compile fail if it is told to use
+ * a feature that we cannot live without.
+ */
+#ifdef lint
+#define	__dead2
+#define	__pure2
+#define	__unused
+#define	__packed
+#define	__aligned(x)
+#define	__section(x)
+#else
+#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
+#define	__dead2
+#define	__pure2
+#define	__unused
+#endif
+#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
+#define	__dead2		__attribute__((__noreturn__))
+#define	__pure2		__attribute__((__const__))
+#define	__unused
+/* XXX Find out what to do for __packed, __aligned and __section */
+#endif
+#if __GNUC_PREREQ__(2, 7)
+#define	__dead2		__attribute__((__noreturn__))
+#define	__pure2		__attribute__((__const__))
+#define	__unused	__attribute__((__unused__))
+#define	__used		__attribute__((__used__))
+#define	__packed	__attribute__((__packed__))
+#define	__aligned(x)	__attribute__((__aligned__(x)))
+#define	__section(x)	__attribute__((__section__(x)))
+#endif
+#if defined(__INTEL_COMPILER)
+#define __dead2		__attribute__((__noreturn__))
+#define __pure2		__attribute__((__const__))
+#define __unused	__attribute__((__unused__))
+#define __used		__attribute__((__used__))
+#define __packed	__attribute__((__packed__))
+#define __aligned(x)	__attribute__((__aligned__(x)))
+#define __section(x)	__attribute__((__section__(x)))
+#endif
+#endif
+
+#if __GNUC_PREREQ__(2, 96)
+#define	__malloc_like	__attribute__((__malloc__))
+#define	__pure		__attribute__((__pure__))
+#else
+#define	__malloc_like
+#define	__pure
+#endif
+
+#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
+#define	__always_inline	__attribute__((__always_inline__))
+#else
+#define	__always_inline
+#endif
+
+#if __GNUC_PREREQ__(3, 1)
+#define	__noinline	__attribute__ ((__noinline__))
+#else
+#define	__noinline
+#endif
+
+#if __GNUC_PREREQ__(3, 3)
+#define __nonnull(x)	__attribute__((__nonnull__(x)))
+#else
+#define __nonnull(x)
+#endif
+
+/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
+#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
+#define	__func__	NULL
+#endif
+
+#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
+#define	__LONG_LONG_SUPPORTED
+#endif
+
+/*
+ * GCC 2.95 provides `__restrict' as an extension to C90 to support the
+ * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
+ * a way to define the `restrict' type qualifier without disturbing older
+ * software that is unaware of C99 keywords.
+ */
+#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
+#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
+#define	__restrict
+#else
+#define	__restrict	restrict
+#endif
+#endif
+
+/*
+ * GNU C version 2.96 adds explicit branch prediction so that
+ * the CPU back-end can hint the processor and also so that
+ * code blocks can be reordered such that the predicted path
+ * sees a more linear flow, thus improving cache behavior, etc.
+ *
+ * The following two macros provide us with a way to utilize this
+ * compiler feature.  Use __predict_true() if you expect the expression
+ * to evaluate to true, and __predict_false() if you expect the
+ * expression to evaluate to false.
+ *
+ * A few notes about usage:
+ *
+ *	* Generally, __predict_false() error condition checks (unless
+ *	  you have some _strong_ reason to do otherwise, in which case
+ *	  document it), and/or __predict_true() `no-error' condition
+ *	  checks, assuming you want to optimize for the no-error case.
+ *
+ *	* Other than that, if you don't know the likelihood of a test
+ *	  succeeding from empirical or other `hard' evidence, don't
+ *	  make predictions.
+ *
+ *	* These are meant to be used in places that are run `a lot'.
+ *	  It is wasteful to make predictions in code that is run
+ *	  seldomly (e.g. at subsystem initialization time) as the
+ *	  basic block reordering that this affects can often generate
+ *	  larger code.
+ */
+#if __GNUC_PREREQ__(2, 96)
+#define __predict_true(exp)     __builtin_expect((exp), 1)
+#define __predict_false(exp)    __builtin_expect((exp), 0)
+#else
+#define __predict_true(exp)     (exp)
+#define __predict_false(exp)    (exp)
+#endif
+
+#if __GNUC_PREREQ__(4, 2)
+#define	__hidden	__attribute__((__visibility__("hidden")))
+#define	__exported	__attribute__((__visibility__("default")))
+#else
+#define	__hidden
+#define	__exported
+#endif
+
+/*
+ * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
+ * require it.
+ */
+#if __GNUC_PREREQ__(4, 1)
+#define __offsetof(type, field)	 __builtin_offsetof(type, field)
+#else
+#ifndef __cplusplus
+#define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
+#else
+#define __offsetof(type, field)					\
+  (__offsetof__ (reinterpret_cast <size_t>			\
+                 (&reinterpret_cast <const volatile char &>	\
+                  (static_cast<type *> (0)->field))))
+#endif
+#endif
+#define	__rangeof(type, start, end) \
+	(__offsetof(type, end) - __offsetof(type, start))
+
+/*
+ * Compiler-dependent macros to declare that functions take printf-like
+ * or scanf-like arguments.  They are null except for versions of gcc
+ * that are known to support the features properly (old versions of gcc-2
+ * didn't permit keeping the keywords out of the application namespace).
+ */
+#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
+#define	__printflike(fmtarg, firstvararg)
+#define	__scanflike(fmtarg, firstvararg)
+#define	__format_arg(fmtarg)
+#else
+#define	__printflike(fmtarg, firstvararg) \
+	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+#define	__scanflike(fmtarg, firstvararg) \
+	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
+#define	__format_arg(fmtarg)	__attribute__((__format_arg__ (fmtarg)))
+#endif
+
+/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
+#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#define	__printf0like(fmtarg, firstvararg) \
+	    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
+#else
+#define	__printf0like(fmtarg, firstvararg)
+#endif
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+#ifndef __INTEL_COMPILER
+#define	__strong_reference(sym,aliassym)	\
+	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
+#endif
+#ifdef __STDC__
+#define	__weak_reference(sym,alias)	\
+	__asm__(".weak " #alias);	\
+	__asm__(".equ "  #alias ", " #sym)
+#define	__warn_references(sym,msg)	\
+	__asm__(".section .gnu.warning." #sym);	\
+	__asm__(".asciz \"" msg "\"");	\
+	__asm__(".previous")
+#define	__sym_compat(sym,impl,verid)	\
+	__asm__(".symver " #impl ", " #sym "@" #verid)
+#define	__sym_default(sym,impl,verid)	\
+	__asm__(".symver " #impl ", " #sym "@@" #verid)
+#else
+#define	__weak_reference(sym,alias)	\
+	__asm__(".weak alias");		\
+	__asm__(".equ alias, sym")
+#define	__warn_references(sym,msg)	\
+	__asm__(".section .gnu.warning.sym"); \
+	__asm__(".asciz \"msg\"");	\
+	__asm__(".previous")
+#define	__sym_compat(sym,impl,verid)	\
+	__asm__(".symver impl, sym@verid")
+#define	__sym_default(impl,sym,verid)	\
+	__asm__(".symver impl, sym@@verid")
+#endif	/* __STDC__ */
+#endif	/* __GNUC__ || __INTEL_COMPILER */
+
+#define	__GLOBL1(sym)	__asm__(".globl " #sym)
+#define	__GLOBL(sym)	__GLOBL1(sym)
+
+#if defined(__GNUC__) || defined(__INTEL_COMPILER)
+#define	__IDSTRING(name,string)	__asm__(".ident\t\"" string "\"")
+#else
+/*
+ * The following definition might not work well if used in header files,
+ * but it should be better than nothing.  If you want a "do nothing"
+ * version, then it should generate some harmless declaration, such as:
+ *    #define __IDSTRING(name,string)	struct __hack
+ */
+#define	__IDSTRING(name,string)	static const char name[] __unused = string
+#endif
+
+/*
+ * Embed the rcs id of a source file in the resulting library.  Note that in
+ * more recent ELF binutils, we use .ident allowing the ID to be stripped.
+ * Usage:
+ *	__FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $");
+ */
+#ifndef	__FBSDID
+#if !defined(lint) && !defined(STRIP_FBSDID)
+#define	__FBSDID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
+#else
+#define	__FBSDID(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__RCSID
+#ifndef	NO__RCSID
+#define	__RCSID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
+#else
+#define	__RCSID(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__RCSID_SOURCE
+#ifndef	NO__RCSID_SOURCE
+#define	__RCSID_SOURCE(s)	__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
+#else
+#define	__RCSID_SOURCE(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__SCCSID
+#ifndef	NO__SCCSID
+#define	__SCCSID(s)	__IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
+#else
+#define	__SCCSID(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__COPYRIGHT
+#ifndef	NO__COPYRIGHT
+#define	__COPYRIGHT(s)	__IDSTRING(__CONCAT(__copyright_,__LINE__),s)
+#else
+#define	__COPYRIGHT(s)	struct __hack
+#endif
+#endif
+
+#ifndef	__DECONST
+#define	__DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
+#endif
+
+#ifndef	__DEVOLATILE
+#define	__DEVOLATILE(type, var)	((type)(uintptr_t)(volatile void *)(var))
+#endif
+
+#ifndef	__DEQUALIFY
+#define	__DEQUALIFY(type, var)	((type)(uintptr_t)(const volatile void *)(var))
+#endif
+
+/*-
+ * The following definitions are an extension of the behavior originally
+ * implemented in <sys/_posix.h>, but with a different level of granularity.
+ * POSIX.1 requires that the macros we test be defined before any standard
+ * header file is included.
+ *
+ * Here's a quick run-down of the versions:
+ *  defined(_POSIX_SOURCE)		1003.1-1988
+ *  _POSIX_C_SOURCE == 1		1003.1-1990
+ *  _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option
+ *  _POSIX_C_SOURCE == 199309		1003.1b-1993
+ *  _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995,
+ *					and the omnibus ISO/IEC 9945-1: 1996
+ *  _POSIX_C_SOURCE == 200112		1003.1-2001
+ *  _POSIX_C_SOURCE == 200809		1003.1-2008
+ *
+ * In addition, the X/Open Portability Guide, which is now the Single UNIX
+ * Specification, defines a feature-test macro which indicates the version of
+ * that specification, and which subsumes _POSIX_C_SOURCE.
+ *
+ * Our macros begin with two underscores to avoid namespace screwage.
+ */
+
+/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
+#undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */
+#define	_POSIX_C_SOURCE		199009
+#endif
+
+/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		199209
+#endif
+
+/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
+#ifdef _XOPEN_SOURCE
+#if _XOPEN_SOURCE - 0 >= 700
+#define	__XSI_VISIBLE		700
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		200809
+#elif _XOPEN_SOURCE - 0 >= 600
+#define	__XSI_VISIBLE		600
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		200112
+#elif _XOPEN_SOURCE - 0 >= 500
+#define	__XSI_VISIBLE		500
+#undef _POSIX_C_SOURCE
+#define	_POSIX_C_SOURCE		199506
+#endif
+#endif
+
+/*
+ * Deal with all versions of POSIX.  The ordering relative to the tests above is
+ * important.
+ */
+#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
+#define	_POSIX_C_SOURCE		198808
+#endif
+#ifdef _POSIX_C_SOURCE
+#if _POSIX_C_SOURCE >= 200809
+#define	__POSIX_VISIBLE		200809
+#define	__ISO_C_VISIBLE		1999
+#elif _POSIX_C_SOURCE >= 200112
+#define	__POSIX_VISIBLE		200112
+#define	__ISO_C_VISIBLE		1999
+#elif _POSIX_C_SOURCE >= 199506
+#define	__POSIX_VISIBLE		199506
+#define	__ISO_C_VISIBLE		1990
+#elif _POSIX_C_SOURCE >= 199309
+#define	__POSIX_VISIBLE		199309
+#define	__ISO_C_VISIBLE		1990
+#elif _POSIX_C_SOURCE >= 199209
+#define	__POSIX_VISIBLE		199209
+#define	__ISO_C_VISIBLE		1990
+#elif _POSIX_C_SOURCE >= 199009
+#define	__POSIX_VISIBLE		199009
+#define	__ISO_C_VISIBLE		1990
+#else
+#define	__POSIX_VISIBLE		198808
+#define	__ISO_C_VISIBLE		0
+#endif /* _POSIX_C_SOURCE */
+#else
+/*-
+ * Deal with _ANSI_SOURCE:
+ * If it is defined, and no other compilation environment is explicitly
+ * requested, then define our internal feature-test macros to zero.  This
+ * makes no difference to the preprocessor (undefined symbols in preprocessing
+ * expressions are defined to have value zero), but makes it more convenient for
+ * a test program to print out the values.
+ *
+ * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
+ * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
+ * environment (and in fact we will never get here).
+ */
+#if defined(_ANSI_SOURCE)	/* Hide almost everything. */
+#define	__POSIX_VISIBLE		0
+#define	__XSI_VISIBLE		0
+#define	__BSD_VISIBLE		0
+#define	__ISO_C_VISIBLE		1990
+#elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */
+#define	__POSIX_VISIBLE		0
+#define	__XSI_VISIBLE		0
+#define	__BSD_VISIBLE		0
+#define	__ISO_C_VISIBLE		1999
+#else				/* Default environment: show everything. */
+#define	__POSIX_VISIBLE		200809
+#define	__XSI_VISIBLE		700
+#define	__BSD_VISIBLE		1
+#define	__ISO_C_VISIBLE		1999
+#endif
+#endif
+
+#endif /* !_SYS_CDEFS_H_ */

+ 3 - 3
i387/e_exp.S

@@ -33,10 +33,10 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
-//__FBSDID("$FreeBSD: src/lib/msun/i387/e_exp.S,v 1.14 2011/01/07 16:13:12 kib Exp $")
+#include <i387/bsd_asm.h>
 
 /* e^x = 2^(x * log2(e)) */
+
 ENTRY(exp)
 	/*
 	 * If x is +-Inf, then the subtraction would give Inf-Inf = NaN.
@@ -97,4 +97,4 @@ x_not_minus_Inf:
 	ret
 END(exp)
 
-	.section .note.GNU-stack,"",%progbits
+    //

+ 2 - 2
i387/e_fmod.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_fmod.S,v 1.11 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(fmod)
@@ -47,4 +47,4 @@ ENTRY(fmod)
 	ret
 END(fmod)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_log.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_log.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(log)
@@ -43,4 +43,4 @@ ENTRY(log)
 	ret
 END(log)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_log10.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_log10.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(log10)
@@ -43,4 +43,4 @@ ENTRY(log10)
 	ret
 END(log10)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_log10f.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_log10f.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: e_log10f.S,v 1.1 1996/07/03 16:50:22 jtc Exp $") */
@@ -15,4 +15,4 @@ ENTRY(log10f)
 	ret
 END(log10f)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_logf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_logf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: e_logf.S,v 1.2 1996/07/06 00:15:45 jtc Exp $") */
@@ -14,4 +14,4 @@ ENTRY(logf)
 	fyl2x
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_remainder.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_remainder.S,v 1.11 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(remainder)
@@ -47,4 +47,4 @@ ENTRY(remainder)
 	ret
 END(remainder)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_remainderf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_remainderf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $") */
@@ -19,4 +19,4 @@ ENTRY(remainderf)
 	ret
 END(remainderf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_remainderl.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_remainderl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
 
@@ -47,4 +47,4 @@ ENTRY(remainderl)
 	fstp	%st(1)
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_sqrt.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrt.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(sqrt)
@@ -42,4 +42,4 @@ ENTRY(sqrt)
 	ret
 END(sqrt)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_sqrtf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrtf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: e_sqrtf.S,v 1.2 1995/05/08 23:50:14 jtc Exp $") */
@@ -14,4 +14,4 @@ ENTRY(sqrtf)
 	ret
 END(sqrtf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/e_sqrtl.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrtl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(sqrtl)
@@ -41,4 +41,4 @@ ENTRY(sqrtl)
 	fsqrt
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 408 - 0
i387/osx_asm.h

@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * @OSF_COPYRIGHT@
+ */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+#ifndef	_I386_ASM_H_
+#define	_I386_ASM_H_
+
+#ifdef _KERNEL
+#include <gprof.h>
+#endif	/* _KERNEL */
+
+#ifdef MACH_KERNEL
+#include <mach_kdb.h>
+#else	/* !MACH_KERNEL */
+#define	MACH_KDB 0
+#endif	/* !MACH_KERNEL */
+
+
+#if	defined(MACH_KERNEL) || defined(_KERNEL)
+#include <gprof.h>
+#endif	/* MACH_KERNEL || _KERNEL */
+
+#if defined(__i386__)
+
+#define S_PC	 (%esp)
+#define S_ARG0	 4(%esp)
+#define S_ARG1	 8(%esp)
+#define S_ARG2	12(%esp)
+#define S_ARG3	16(%esp)
+#define S_ARG4	20(%esp)
+
+#define FRAME	pushl %ebp; movl %esp, %ebp
+#define EMARF	leave
+
+#define B_LINK	 (%ebp)
+#define B_PC	 4(%ebp)
+#define B_ARG0	 8(%ebp)
+#define B_ARG1	12(%ebp)
+#define B_ARG2	16(%ebp)
+#define B_ARG3	20(%ebp)
+
+#elif defined(__x86_64__)
+
+#define S_PC	 (%rsp)
+
+#define FRAME	pushq %rbp; movq %rsp, %rbp
+#define EMARF	leave
+
+#define B_LINK	 (%rbp)
+#define B_PC	 8(%rbp)
+
+#else
+#error unsupported architecture
+#endif
+
+/* There is another definition of ALIGN for .c sources */
+#ifdef ASSEMBLER
+#define ALIGN 4,0x90
+#endif /* ASSEMBLER */
+
+#ifndef FALIGN
+#define FALIGN ALIGN
+#endif
+
+#define LB(x,n) n
+#if	__STDC__
+#ifndef __NO_UNDERSCORES__
+#define	LCL(x)	L ## x
+#define EXT(x) _ ## x
+#define LEXT(x) _ ## x ## :
+#else
+#define	LCL(x)	.L ## x
+#define EXT(x) x
+#define LEXT(x) x ## :
+#endif
+#define LBc(x,n) n ## :
+#define LBb(x,n) n ## b
+#define LBf(x,n) n ## f
+#else /* __STDC__ */
+#ifndef __NO_UNDERSCORES__
+#define LCL(x) L/**/x
+#define EXT(x) _/**/x
+#define LEXT(x) _/**/x/**/:
+#else /* __NO_UNDERSCORES__ */
+#define	LCL(x)	.L/**/x
+#define EXT(x) x
+#define LEXT(x) x/**/:
+#endif /* __NO_UNDERSCORES__ */
+#define LBc(x,n) n/**/:
+#define LBb(x,n) n/**/b
+#define LBf(x,n) n/**/f
+#endif /* __STDC__ */
+
+#define SVC .byte 0x9a; .long 0; .word 0x7
+
+#define RPC_SVC .byte 0x9a; .long 0; .word 0xf
+
+#define String	.asciz
+#define Value	.word
+#define Times(a,b) (a*b)
+#define Divide(a,b) (a/b)
+
+#define INB	inb	%dx, %al
+#define OUTB	outb	%al, %dx
+#define INL	inl	%dx, %eax
+#define OUTL	outl	%eax, %dx
+
+#define data16	.byte 0x66
+#define addr16	.byte 0x67
+
+#if !GPROF
+#define MCOUNT
+
+#elif defined(__SHARED__)
+#define MCOUNT		; .data;\
+            .align ALIGN;\
+            LBc(x, 8) .long 0;\
+            .text;\
+            Gpush;\
+            Gload;\
+            leal Gotoff(LBb(x,8)),%edx;\
+            Egaddr(%eax,_mcount_ptr);\
+            Gpop;\
+            call *(%eax);
+
+#else	/* !GPROF, !__SHARED__ */
+#define MCOUNT		; call mcount;
+#endif /* GPROF */
+
+#ifdef __ELF__
+#define ELF_FUNC(x)	.type x,@function
+#define ELF_DATA(x)	.type x,@object
+#define ELF_SIZE(x,s)	.size x,s
+#else
+#define ELF_FUNC(x)
+#define ELF_DATA(x)
+#define ELF_SIZE(x,s)
+#endif
+
+#define	Entry(x)	.globl EXT(x); ELF_FUNC(EXT(x)); .align FALIGN; LEXT(x)
+#define	ENTRY(x)	Entry(x) MCOUNT
+#define	ENTRY2(x,y)	.globl EXT(x); .globl EXT(y); \
+            ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \
+            .align FALIGN; LEXT(x); LEXT(y) \
+            MCOUNT
+#if __STDC__
+#define	ASENTRY(x) 	.globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT
+#else
+#define	ASENTRY(x) 	.globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT
+#endif /* __STDC__ */
+
+#define	DATA(x)		.globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)
+
+#define End(x)		ELF_SIZE(x,.-x)
+#define END(x)		End(EXT(x))
+#define ENDDATA(x)	END(x)
+#define Enddata(x)	End(x)
+
+/*
+ * ELF shared library accessor macros.
+ * Gpush saves the %ebx register used for the GOT address
+ * Gpop pops %ebx if we need a GOT
+ * Gload loads %ebx with the GOT address if shared libraries are used
+ * Gcall calls an external function.
+ * Gotoff allows you to reference local labels.
+ * Gotoff2 allows you to reference local labels with an index reg.
+ * Gotoff3 allows you to reference local labels with an index reg & size.
+ * Gaddr loads up a register with an address of an external item.
+ * Gstack is the number of bytes that Gpush pushes on the stack.
+ *
+ * Varients of the above with E or L prefixes do EXT(name) or LCL(name)
+ * respectively.
+ */
+
+#ifndef __SHARED__
+#define Gpush
+#define Gpop
+#define Gload
+#define Gcall(func)		call func
+#define Gotoff(lab)		lab
+#define Gotoff2(l,r)		l(r)
+#define Gotoff3(l,r,s)		l(,r,s)
+#define Gaddr(to,lab)		movl $lab,to
+#define Gcmp(lab,reg)		cmpl $lab,reg
+#define Gmemload(lab,reg)	movl lab,reg
+#define Gmemstore(reg,lab,tmp)	movl reg,lab
+#define Gstack			0
+
+#else
+#ifdef __ELF__			/* ELF shared libraries */
+#define Gpush			pushl %ebx
+#define Gpop			popl %ebx
+#define Gload			call 9f; 9: popl %ebx; addl $_GLOBAL_OFFSET_TABLE_+[.-9b],%ebx
+#define Gcall(func)		call EXT(func)@PLT
+#define Gotoff(lab)		lab@GOTOFF(%ebx)
+#define Gotoff2(l,r)		l@GOTOFF(%ebx,r)
+#define Gotoff3(l,r,s)		l@GOTOFF(%ebx,r,s)
+#define Gaddr(to,lab)		movl lab@GOT(%ebx),to
+#define Gcmp(lab,reg)		cmpl reg,lab@GOT(%ebx)
+#define Gmemload(lab,reg)	movl lab@GOT(%ebx),reg; movl (reg),reg
+#define Gmemstore(reg,lab,tmp)	movl lab@GOT(%ebx),tmp; movl reg,(tmp)
+#define Gstack			4
+
+#else				/* ROSE shared libraries */
+#define Gpush
+#define Gpop
+#define Gload
+#define Gcall(func)		call *9f; .data; .align ALIGN; 9: .long func; .text
+#define Gotoff(lab)		lab
+#define Gotoff2(l,r)		l(r)
+#define Gotoff3(l,r,s)		l(,r,s)
+#define Gaddr(to,lab)		movl 9f,to; .data; .align ALIGN; 9: .long lab; .text
+#define Gcmp(lab,reg)		cmpl reg,9f; .data; .align ALIGN; 9: .long lab; .text
+#define Gmemload(lab,reg)	movl 9f,reg; movl (reg),reg; .data; .align ALIGN; 9: .long lab; .text
+#define Gmemstore(reg,lab,tmp)	movl 9f,tmp; movl reg,(tmp); .data; .align ALIGN; 9: .long lab; .text
+#define Gstack			0
+#endif	/* __ELF__ */
+#endif	/* __SHARED__ */
+
+/* Egotoff is not provided, since external symbols should not use @GOTOFF
+   relocations.  */
+#define Egcall(func)		Gcall(EXT(func))
+#define Egaddr(to,lab)		Gaddr(to,EXT(lab))
+#define Egcmp(lab,reg)		Gcmp(EXT(lab),reg)
+#define Egmemload(lab,reg)	Gmemload(EXT(lab),reg)
+#define Egmemstore(reg,lab,tmp)	Gmemstore(reg,EXT(lab),tmp)
+
+#define Lgotoff(lab)		Gotoff(LCL(lab))
+#define Lgotoff2(l,r)		Gotoff2(LCL(l),r)
+#define Lgotoff3(l,r,s)		Gotoff3(LCL(l),r,s)
+#define Lgcmp(lab,reg)		Gcmp(LCL(lab),reg)
+#define Lgmemload(lab,reg)	movl Lgotoff(lab),reg
+#define Lgmemstore(reg,lab,tmp)	movl reg,Lgotoff(lab)
+
+#ifdef ASSEMBLER
+#if	MACH_KDB
+#include <ddb/stab.h>
+/*
+ * This pseudo-assembler line is added so that there will be at least
+ *	one N_SO entry in the symbol stable to define the current file name.
+ */
+#endif	/* MACH_KDB */
+
+#else /* NOT ASSEMBLER */
+
+/* These defines are here for .c files that wish to reference global symbols
+ * within __asm__ statements.
+ */
+#ifndef __NO_UNDERSCORES__
+#define CC_SYM_PREFIX "_"
+#else
+#define CC_SYM_PREFIX ""
+#endif /* __NO_UNDERSCORES__ */
+#endif /* ASSEMBLER */
+
+/*
+ * The following macros make calls into C code.
+ * They dynamically align the stack to 16 bytes.
+ */
+#if defined(__i386__)
+/*
+ * Arguments are moved (not pushed) onto the correctly aligned stack.
+ * NOTE: ESI is destroyed in the process, and hence cannot
+ * be directly used as a parameter. Users of this macro must
+ * independently preserve ESI (a non-volatile) if the routine is
+ * intended to be called from C, for instance.
+ */
+
+#define CCALL(fn)			\
+    movl	%esp, %esi		;\
+    andl	$0xFFFFFFF0, %esp	;\
+    call	EXT(fn)			;\
+    movl	%esi, %esp
+
+#define CCALL1(fn, arg1)		\
+    movl	%esp, %esi		;\
+    subl	$4, %esp		;\
+    andl	$0xFFFFFFF0, %esp	;\
+    movl	arg1, (%esp)		;\
+    call	EXT(fn)			;\
+    movl	%esi, %esp
+
+#define CCALL2(fn, arg1, arg2)		\
+    movl	%esp, %esi		;\
+    subl	$8, %esp		;\
+    andl	$0xFFFFFFF0, %esp	;\
+    movl	arg2, 4(%esp)		;\
+    movl	arg1, (%esp)		;\
+    call	EXT(fn)			;\
+    movl	%esi, %esp
+
+/* This variant exists to permit adjustment of the stack by "dtrace" */
+#define CCALL1WITHSP(fn, arg1)		\
+    movl	%esp, %esi		;\
+    subl	$12, %esp		;\
+    andl	$0xFFFFFFF0, %esp	;\
+    movl	%esi, 8(%esp)		;\
+    leal	8(%esp), %esi		;\
+    movl	%esi, 4(%esp)		;\
+    movl	arg1, (%esp)		;\
+    call	EXT(fn)			;\
+    movl	8(%esp), %esp
+
+/*
+ * CCALL5 is used for callee functions with 3 arguments but
+ * where arg2 (a3:a2) and arg3 (a5:a4) are 64-bit values.
+ */
+#define CCALL5(fn, a1, a2, a3, a4, a5)	\
+    movl	%esp, %esi		;\
+    subl	$20, %esp		;\
+    andl	$0xFFFFFFF0, %esp	;\
+    movl	a5, 16(%esp)		;\
+    movl	a4, 12(%esp)		;\
+    movl	a3,  8(%esp)		;\
+    movl	a2,  4(%esp)		;\
+    movl	a1,  (%esp)		;\
+    call	EXT(fn)			;\
+    movl	%esi, %esp
+
+#elif defined(__x86_64__)
+
+/* This variant exists to permit adjustment of the stack by "dtrace" */
+#define CCALLWITHSP(fn)				 \
+    mov	%rsp, %r12			;\
+    sub	$8, %rsp			;\
+    and	$0xFFFFFFFFFFFFFFF0, %rsp	;\
+    mov	%r12, (%rsp)			;\
+    leaq	(%rsp), %rsi			;\
+    call	EXT(fn)				;\
+    mov	(%rsp), %rsp
+
+#define CCALL(fn)				 \
+    mov	%rsp, %r12			;\
+    and	$0xFFFFFFFFFFFFFFF0, %rsp	;\
+    call	EXT(fn)				;\
+    mov	%r12, %rsp
+
+#define CCALL1(fn, arg1) 			 \
+    mov	arg1, %rdi 			;\
+    CCALL(fn)
+
+#define CCALL2(fn, arg1, arg2)		 	 \
+    mov	arg1, %rdi 			;\
+    CCALL(fn)
+
+#define CCALL3(fn, arg1, arg2, arg3) 		 \
+    mov	arg1, %rdi 			;\
+    mov	arg2, %rsi 			;\
+    mov	arg3, %rdx 			;\
+    CCALL(fn)
+
+#else
+#error unsupported architecture
+#endif
+
+#endif /* _I386_ASM_H_ */

+ 3 - 4
i387/s_ceil.S

@@ -33,11 +33,10 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
-//__FBSDID("$FreeBSD: src/lib/msun/i387/s_ceil.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
+#include <i387/bsd_asm.h>
 
 ENTRY(ceil)
-	pushl	%ebp
+    pushl   %ebp
 	movl	%esp,%ebp
 	subl	$8,%esp
 
@@ -57,4 +56,4 @@ ENTRY(ceil)
 	ret
 END(ceil)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_ceilf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_ceilf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") */
@@ -29,4 +29,4 @@ ENTRY(ceilf)
 	ret
 END(ceilf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_ceill.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 	
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_ceill.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(ceill)
@@ -27,4 +27,4 @@ ENTRY(ceill)
 	ret
 END(ceill)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_copysign.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_copysign.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(copysign)
@@ -47,4 +47,4 @@ ENTRY(copysign)
 	ret
 END(copysign)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_copysignf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_copysignf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $") */
@@ -19,4 +19,4 @@ ENTRY(copysignf)
 	ret
 END(copysignf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_copysignl.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_copysignl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(copysignl)
@@ -17,4 +17,4 @@ ENTRY(copysignl)
 	ret
 END(copysignl)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_cos.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_cos.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(cos)
@@ -55,4 +55,4 @@ ENTRY(cos)
 	ret
 END(cos)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_finite.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_finite.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(finite)
@@ -45,4 +45,4 @@ ENTRY(finite)
 	ret
 END(finite)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_floor.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_floor.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(floor)
@@ -57,4 +57,4 @@ ENTRY(floor)
 	ret
 END(floor)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_floorf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_floorf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") */
@@ -29,4 +29,4 @@ ENTRY(floorf)
 	ret
 END(floorf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_floorl.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_floorl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(floorl)
@@ -27,4 +27,4 @@ ENTRY(floorl)
 	ret
 END(floorl)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_llrint.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_llrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(llrint)
@@ -36,4 +36,4 @@ ENTRY(llrint)
 	ret
 END(llrint)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_llrintf.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_llrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 	
 ENTRY(llrintf)
@@ -36,4 +36,4 @@ ENTRY(llrintf)
 	ret
 END(llrintf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_llrintl.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_llrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(llrintl)
@@ -35,4 +35,4 @@ ENTRY(llrintl)
 	popl	%edx
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_logb.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_logb.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(logb)
@@ -43,4 +43,4 @@ ENTRY(logb)
 	ret
 END(logb)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_logbf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_logbf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $") */
@@ -15,4 +15,4 @@ ENTRY(logbf)
 	ret
 END(logbf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_logbl.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_logbl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(logbl)
@@ -42,4 +42,4 @@ ENTRY(logbl)
 	fstp	%st
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_lrint.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_lrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(lrint)
@@ -35,4 +35,4 @@ ENTRY(lrint)
 	ret
 END(lrint)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_lrintf.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_lrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 	
 ENTRY(lrintf)
@@ -35,4 +35,4 @@ ENTRY(lrintf)
 	ret
 END(lrintf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_lrintl.S

@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_lrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(lrintl)
@@ -34,4 +34,4 @@ ENTRY(lrintl)
 	popl	%eax
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_remquo.S

@@ -28,7 +28,7 @@
  * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_remquo.S,v 1.3 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(remquo)
@@ -62,4 +62,4 @@ ENTRY(remquo)
 	ret
 END(remquo)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_remquof.S

@@ -28,7 +28,7 @@
  * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_remquof.S,v 1.3 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(remquof)
@@ -62,4 +62,4 @@ ENTRY(remquof)
 	ret
 END(remquof)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_remquol.S

@@ -28,7 +28,7 @@
  * Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_remquol.S,v 1.2 2011/01/07 16:13:12 kib Exp $"); 
 	
 ENTRY(remquol)
@@ -62,4 +62,4 @@ ENTRY(remquol)
 	movl	%eax,(%ecx)
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_rint.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_rint.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(rint)
@@ -42,4 +42,4 @@ ENTRY(rint)
 	ret
 END(rint)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_rintf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_rintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $") */
@@ -14,4 +14,4 @@ ENTRY(rintf)
 	ret
 END(rintf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_rintl.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_rintl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(rintl)
@@ -41,4 +41,4 @@ ENTRY(rintl)
 	frndint
 	ret
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_scalbn.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_scalbn.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(scalbn)
@@ -44,4 +44,4 @@ ENTRY(scalbn)
 	ret
 END(scalbn)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_scalbnf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_scalbnf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
@@ -19,4 +19,4 @@ END(scalbnf)
 .globl CNAME(ldexpf)
 .set	CNAME(ldexpf),CNAME(scalbnf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_scalbnl.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_scalbnl.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
@@ -19,4 +19,4 @@ END(scalbnl)
 .globl CNAME(ldexpl)
 .set	CNAME(ldexpl),CNAME(scalbnl)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_significand.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_significand.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(significand)
@@ -43,4 +43,4 @@ ENTRY(significand)
 	ret
 END(significand)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_significandf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_significandf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
 /* RCSID("$NetBSD: s_significandf.S,v 1.3 1995/05/09 00:24:07 jtc Exp $") */
@@ -15,4 +15,4 @@ ENTRY(significandf)
 	ret
 END(significandf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_sin.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_sin.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(sin)
@@ -55,4 +55,4 @@ ENTRY(sin)
 	ret
 END(sin)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_tan.S

@@ -33,7 +33,7 @@
  *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_tan.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(tan)
@@ -57,4 +57,4 @@ ENTRY(tan)
 	ret
 END(tan)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_trunc.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_trunc.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(trunc)
@@ -26,4 +26,4 @@ ENTRY(trunc)
 	ret
 END(trunc)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_truncf.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_truncf.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(truncf)
@@ -26,4 +26,4 @@ ENTRY(truncf)
 	ret
 END(truncf)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
i387/s_truncl.S

@@ -3,7 +3,7 @@
  * Public domain.
  */
 
-#include <machine/asm.h>
+#include <i387/bsd_asm.h>
 //__FBSDID("$FreeBSD: src/lib/msun/i387/s_truncl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
 
 ENTRY(truncl)
@@ -26,4 +26,4 @@ ENTRY(truncl)
 	ret
 END(truncl)
 
-	.section .note.GNU-stack,"",%progbits
+	

+ 2 - 2
ld128/Makefile

@@ -1,5 +1,5 @@
 include ../Make.inc
 
-SRCS=	invtrig.o k_cosl.o k_sinl.o k_tanl.o # s_nanl.o s_exp2l.o 
+SRCS = invtrig.c k_cosl.c k_sinl.c k_tanl.c # s_nanl.c s_exp2l.c 
 
-all: $(SRCS)
+all: $(patsubst %.c,%.c.o,$(SRCS))

+ 48 - 48
src/Makefile

@@ -1,58 +1,58 @@
 include ../Make.inc
 
 SRCS= \
-	e_acos.o e_acosf.o e_acosh.o e_acoshf.o e_asin.o e_asinf.o \
-	e_atan2.o e_atan2f.o e_atanh.o e_atanhf.o e_cosh.o e_coshf.o e_exp.o \
-	e_expf.o e_fmod.o e_fmodf.o e_gamma.o e_gamma_r.o e_gammaf.o \
-	e_gammaf_r.o e_hypot.o e_hypotf.o e_j0.o e_j0f.o e_j1.o e_j1f.o \
-	e_jn.o e_jnf.o e_lgamma.o e_lgamma_r.o e_lgammaf.o e_lgammaf_r.o \
-	e_log.o e_log10.o e_log10f.o e_log2.o e_log2f.o e_logf.o \
-	e_pow.o e_powf.o e_remainder.o e_remainderf.o e_scalb.o e_scalbf.o \
-	e_rem_pio2.o e_rem_pio2f.o \
-	e_sinh.o e_sinhf.o e_sqrt.o e_sqrtf.o \
-	k_cos.o k_exp.o k_expf.o k_rem_pio2.o k_sin.o k_tan.o \
-	k_cosf.o k_sinf.o k_tanf.o \
-	s_asinh.o s_asinhf.o s_atan.o s_atanf.o s_carg.o s_cargf.o s_cargl.o \
-	s_cbrt.o s_cbrtf.o s_ceil.o s_ceilf.o \
-	s_copysign.o s_copysignf.o s_cos.o s_cosf.o \
-	s_csqrt.o s_csqrtf.o s_erf.o s_erff.o \
-	s_exp2.o s_exp2f.o s_expm1.o s_expm1f.o s_fabs.o s_fabsf.o s_fdim.o \
-	s_finite.o s_finitef.o \
-	s_floor.o s_floorf.o s_fma.o s_fmaf.o \
-	s_fmax.o s_fmaxf.o s_fmaxl.o s_fmin.o \
-	s_fminf.o s_fminl.o s_fpclassify.o \
-	s_frexp.o s_frexpf.o s_ilogb.o s_ilogbf.o \
-	s_ilogbl.o s_isinf.o s_isfinite.o s_isnormal.o s_isnan.o \
-	s_llrint.o s_llrintf.o s_llround.o s_llroundf.o s_llroundl.o \
-	s_log1p.o s_log1pf.o s_logb.o s_logbf.o s_lrint.o s_lrintf.o \
-	s_lround.o s_lroundf.o s_lroundl.o s_modf.o s_modff.o \
-	s_nan.o s_nearbyint.o s_nextafter.o s_nextafterf.o \
-	s_nexttowardf.o s_remquo.o s_remquof.o \
-	s_rint.o s_rintf.o s_round.o s_roundf.o s_roundl.o \
-	s_scalbln.o s_scalbn.o s_scalbnf.o s_signbit.o \
-	s_signgam.o s_significand.o s_significandf.o s_sin.o s_sinf.o \
-	s_tan.o s_tanf.o s_tanh.o s_tanhf.o s_tgammaf.o s_trunc.o s_truncf.o \
-	w_cabs.o w_cabsf.o w_drem.o w_dremf.o
+        e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \
+        e_atan2.c e_atan2f.c e_atanh.c e_atanhf.c e_cosh.c e_coshf.c e_exp.c \
+        e_expf.c e_fmod.c e_fmodf.c e_gamma.c e_gamma_r.c e_gammaf.c \
+        e_gammaf_r.c e_hypot.c e_hypotf.c e_j0.c e_j0f.c e_j1.c e_j1f.c \
+        e_jn.c e_jnf.c e_lgamma.c e_lgamma_r.c e_lgammaf.c e_lgammaf_r.c \
+        e_log.c e_log10.c e_log10f.c e_log2.c e_log2f.c e_logf.c \
+        e_pow.c e_powf.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \
+        e_rem_pio2.c e_rem_pio2f.c \
+        e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \
+        k_cos.c k_exp.c k_expf.c k_rem_pio2.c k_sin.c k_tan.c \
+        k_cosf.c k_sinf.c k_tanf.c \
+        s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_carg.c s_cargf.c s_cargl.c \
+        s_cbrt.c s_cbrtf.c s_ceil.c s_ceilf.c \
+        s_copysign.c s_copysignf.c s_cos.c s_cosf.c \
+        s_csqrt.c s_csqrtf.c s_erf.c s_erff.c \
+        s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabs.c s_fabsf.c s_fdim.c \
+        s_finite.c s_finitef.c \
+        s_floor.c s_floorf.c s_fma.c s_fmaf.c \
+        s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c \
+        s_fminf.c s_fminl.c s_fpclassify.c \
+        s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \
+        s_ilogbl.c s_isinf.c s_isfinite.c s_isnormal.c s_isnan.c \
+        s_llrint.c s_llrintf.c s_llround.c s_llroundf.c s_llroundl.c \
+        s_log1p.c s_log1pf.c s_logb.c s_logbf.c s_lrint.c s_lrintf.c \
+        s_lround.c s_lroundf.c s_lroundl.c s_modf.c s_modff.c \
+        s_nan.c s_nearbyint.c s_nextafter.c s_nextafterf.c \
+        s_nexttowardf.c s_remquo.c s_remquof.c \
+        s_rint.c s_rintf.c s_round.c s_roundf.c s_roundl.c \
+        s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \
+        s_signgam.c s_significand.c s_significandf.c s_sin.c s_sinf.c \
+        s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_tgammaf.c s_trunc.c s_truncf.c \
+        w_cabs.c w_cabsf.c w_drem.c w_dremf.c
 
 # C99 long double functions
-SRCS+=	s_copysignl.o s_fabsl.o s_llrintl.o s_lrintl.o s_modfl.o
+SRCS+=	s_copysignl.c s_fabsl.c s_llrintl.c s_lrintl.c s_modfl.c
 
 # If long double != double use these; otherwise, we alias the double versions.
-SRCS+=	e_acosl.o e_asinl.o e_atan2l.o e_fmodl.o \
-	e_hypotl.o e_remainderl.o e_sqrtl.o \
-	s_atanl.o s_ceill.o s_cosl.o s_cprojl.o \
-	s_csqrtl.o s_floorl.o s_fmal.o \
-	s_frexpl.o s_logbl.o s_nexttoward.o \
-	s_remquol.o \
-	s_sinl.o s_tanl.o s_truncl.o w_cabsl.o \
-	s_nextafterl.o s_rintl.o s_scalbnl.o 
-#	s_cbrtl.o
+SRCS+=	e_acosl.c e_asinl.c e_atan2l.c e_fmodl.c \
+        e_hypotl.c e_remainderl.c e_sqrtl.c \
+        s_atanl.c s_ceill.c s_cosl.c s_cprojl.c \
+        s_csqrtl.c s_floorl.c s_fmal.c \
+        s_frexpl.c s_logbl.c s_nexttoward.c \
+        s_remquol.c \
+        s_sinl.c s_tanl.c s_truncl.c w_cabsl.c \
+        s_nextafterl.c s_rintl.c s_scalbnl.c
+#	s_cbrtl.c
 
 # C99 complex functions
-SRCS+=	s_ccosh.o s_ccoshf.o s_cexp.o s_cexpf.o \
-	s_cimag.o s_cimagf.o s_cimagl.o \
-	s_conj.o s_conjf.o s_conjl.o \
-	s_cproj.o s_cprojf.o s_creal.o s_crealf.o s_creall.o \
-	s_csinh.o s_csinhf.o s_ctanh.o s_ctanhf.o
+SRCS+=	s_ccosh.c s_ccoshf.c s_cexp.c s_cexpf.c \
+        s_cimag.c s_cimagf.c s_cimagl.c \
+        s_conj.c s_conjf.c s_conjl.c \
+        s_cproj.c s_cprojf.c s_creal.c s_crealf.c s_creall.c \
+        s_csinh.c s_csinhf.c s_ctanh.c s_ctanhf.c
 
-all: $(SRCS)
+all: $(patsubst %.c,%.c.o,$(SRCS))