9596 Initial xsave xstate_bv should not include all features
[unleashed.git] / usr / src / cmd / sgs / libconv / common / bld_vernote.ksh
blob6f83eb93930fc9eba2a75f19c7984a5f17e7166c
1 #! /usr/bin/ksh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
24 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
28 usage()
30 echo "usage: bld_vernote -R <revision> -r <release> -o <outfile.s>"
33 pad_notestring()
35 extra=$1
36 len=$(( ${#notestring} + $extra ))
37 padlen=$(( $len % 4 ))
38 while [[ $(( $len % 4)) != 0 ]]
40 notestring="${notestring}\0"
41 len=$(( $len + 1 ))
42 done
46 build_sparcnote()
48 notestring="Solaris Link Editors: $release-$revision (illumos)\0"
50 # The 'adjustment' is for the '\0'
52 pad_notestring -1
54 cat > $notefile <<EOF
55 .section ".note"
57 #include <sgs.h>
59 .align 4
60 .word .endname - .startname /* note name size */
61 .word 0 /* note desc size */
62 .word 0 /* note type */
63 .startname:
64 .ascii "$notestring"
65 .endname:
67 .section ".rodata", #alloc
68 .global link_ver_string
69 link_ver_string:
70 .type link_ver_string, #object
71 .ascii "${release}-${revision} (illumos)\0"
72 .size link_ver_string, .-link_ver_string
73 EOF
76 build_i386note()
78 notestring="Solaris Link Editors: $release-$revision (illumos)"
80 # The 'adjustment' is for the the fact that the x86/amd64
81 # assembler automatically append a '\0' at the end of a string.
83 pad_notestring -1
84 cat > $notefile <<EOF
85 .section .note
87 #include <sgs.h>
89 .align 4
90 .long .endname - .startname /* note name size */
91 .long 0 /* note desc size */
92 .long 0 /* note type */
93 .startname:
94 .string "$notestring"
95 .endname:
97 .section .rodata, "a"
98 .globl link_ver_string
99 link_ver_string:
100 .type link_ver_string,@object
101 .string "${release}-${revision} (illumos)\0"
102 .size link_ver_string, .-link_ver_string
107 notefile=""
108 release=""
109 revision=""
111 while getopts R:o:r: c
113 case $c in
115 notefile=$OPTARG
118 release=$OPTARG
121 revision=$OPTARG
124 usage
125 exit 1
127 esac
128 done
130 if [[ ( -z $notefile ) || ( -z $release ) || ( -z $revision ) ]]; then
131 usage
132 exit 1
136 if [[ $MACH = "sparc" ]]; then
137 build_sparcnote
138 elif [[ $MACH = "i386" ]]; then
139 build_i386note
140 else
141 echo "I don't know how to build a vernote.s for ${MACH}, so sorry"
142 exit 1