summaryrefslogtreecommitdiff
path: root/lang/gcc48/files/values.c
blob: e043d948b6cd6fbcb402a347b4123e48aa797244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#if 0 /* $NetBSD: values.c,v 1.1 2013/04/01 21:06:16 wiz Exp $ */
#
# This is Solaris x86 specific GCC run-time environment patch, which
# makes it possible to reliably deploy .init snippets. Trouble is that
# Solaris linker erroneously pads .init segment with zeros [instead of
# nops], which is bound to SEGV early upon program start-up. This bug
# was recognized by GCC team [it is mentioned in source code], but
# workaround apparently and obviously erroneously slipped away in some
# newer GCC release. This patch compensates for this mishap by dropping
# modified values-X*.o into GCC installation tree. Object modules in
# question are normally provided by Sun and linked prior crtbegin.o.
# Modified versions are additionally crafted with custom .init segment,
# which does some magic:-)
#						<appro@fy.chalmers.se>
set -e
gcc=gcc
if [[ "x$1" = x*gcc ]]; then
	gcc=$1; shift
fi
gcc_dir=`${gcc} "$@" -print-libgcc-file-name`
gcc_dir=${gcc_dir%/*}	#*/
set -x 
${gcc} "$@" -c -o $gcc_dir/values-Xa.o -DXa $0
${gcc} "$@" -c -o $gcc_dir/values-Xc.o -DXc $0
${gcc} "$@" -c -o $gcc_dir/values-Xt.o -DXt $0
exit
#endif

#include <math.h>

#if defined(Xa)
const enum version _lib_version = ansi_1;
#elif defined(Xc)
const enum version _lib_version = strict_ansi;
#elif defined(Xt)
const enum version _lib_version = c_issue_4;
#else
#error "compile by issuing 'ksh -f values.c [gcc] [-m64]'"
#endif

#if defined(__x86_64__)
asm("\n"
".section	.init\n"
".align	1\n"
"	leaq	1f(%rip),%rax\n"
"1:	cmpl	$0,2f-1b(%rax)\n"
"	jne	2f\n"
"	jmp	2f+5\n"
"	.skip	9\n"	/* pad up to 0x1b bytes */
"2:\n"
);
#else
asm("\n"
".section	.init\n"
".align	1\n"
"	call	1f\n"
"1:	popl	%eax\n"
"	cmpl	$0,2f-1b(%eax)\n"
"	jne	2f\n"
"	jmp	2f+5\n"
"	.skip	10\n"	/* pad up to 0x1b bytes */
"2:\n"
);
#endif