Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: source/tools/toolutil/pkg_genc.c

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/tools/toolutil/package.cpp ('k') | source/tools/toolutil/pkg_icu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /****************************************************************************** 1 /******************************************************************************
2 * Copyright (C) 2009-2013, International Business Machines 2 * Copyright (C) 2009-2014, International Business Machines
3 * Corporation and others. All Rights Reserved. 3 * Corporation and others. All Rights Reserved.
4 ******************************************************************************* 4 *******************************************************************************
5 */ 5 */
6 #include "unicode/utypes.h" 6 #include "unicode/utypes.h"
7 7
8 #if U_PLATFORM_HAS_WIN32_API 8 #if U_PLATFORM_HAS_WIN32_API
9 # define VC_EXTRALEAN 9 # define VC_EXTRALEAN
10 # define WIN32_LEAN_AND_MEAN 10 # define WIN32_LEAN_AND_MEAN
11 # define NOUSER 11 # define NOUSER
12 # define NOSERVICE 12 # define NOSERVICE
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 where the name is the compiler or platform that you used in this 105 where the name is the compiler or platform that you used in this
106 assemblyHeader data structure. 106 assemblyHeader data structure.
107 */ 107 */
108 static const struct AssemblyType { 108 static const struct AssemblyType {
109 const char *name; 109 const char *name;
110 const char *header; 110 const char *header;
111 const char *beginLine; 111 const char *beginLine;
112 const char *footer; 112 const char *footer;
113 int8_t hexType; /* HEX_0X or HEX_0h */ 113 int8_t hexType; /* HEX_0X or HEX_0h */
114 } assemblyHeader[] = { 114 } assemblyHeader[] = {
115 // For gcc assemblers, the meaning of .align changes depending on the 115 /* For gcc assemblers, the meaning of .align changes depending on the */
116 // hardware, so we use .balign 16 which always means 16 bytes. 116 /* hardware, so we use .balign 16 which always means 16 bytes. */
117 // https://sourceware.org/binutils/docs/as/Pseudo-Ops.html 117 /* https://sourceware.org/binutils/docs/as/Pseudo-Ops.html */
118 {"gcc", 118 {"gcc",
119 ".globl %s\n" 119 ".globl %s\n"
120 "\t.section .note.GNU-stack,\"\",%%progbits\n" 120 "\t.section .note.GNU-stack,\"\",%%progbits\n"
121 "\t.section .rodata\n" 121 "\t.section .rodata\n"
122 "\t.balign 16\n" 122 "\t.balign 16\n"
123 /* The 3 lines below are added for Chrome. */
124 "#ifdef U_HIDE_DATA_SYMBOL\n"
125 "\t.hidden %s\n"
126 "#endif\n"
127 "\t.type %s,%%object\n" 123 "\t.type %s,%%object\n"
128 "%s:\n\n", 124 "%s:\n\n",
129 125
130 ".long ","",HEX_0X 126 ".long ","",HEX_0X
131 }, 127 },
132 {"gcc-darwin", 128 {"gcc-darwin",
133 /*"\t.section __TEXT,__text,regular,pure_instructions\n" 129 /*"\t.section __TEXT,__text,regular,pure_instructions\n"
134 "\t.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32\n" */ 130 "\t.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32\n" */
135 ".globl _%s\n" 131 ".globl _%s\n"
136 /* The 3 lines below are added for Chrome. */
137 "#ifdef U_HIDE_DATA_SYMBOL\n"
138 "\t.private_extern _%s\n"
139 "#endif\n"
140 "\t.data\n" 132 "\t.data\n"
141 "\t.const\n" 133 "\t.const\n"
142 "\t.balign 16\n" 134 "\t.balign 16\n"
143 "_%s:\n\n", 135 "_%s:\n\n",
144 136
145 ".long ","",HEX_0X 137 ".long ","",HEX_0X
146 }, 138 },
147 {"gcc-cygwin", 139 {"gcc-cygwin",
148 ".globl _%s\n" 140 ".globl _%s\n"
149 "\t.section .rodata\n" 141 "\t.section .rodata\n"
150 "\t.balign 16\n" 142 "\t.balign 16\n"
151 "_%s:\n\n", 143 "_%s:\n\n",
152 144
153 ".long ","",HEX_0X 145 ".long ","",HEX_0X
154 }, 146 },
155 {"gcc-mingw64", 147 {"gcc-mingw64",
156 ".globl %s\n" 148 ".globl %s\n"
157 "\t.section .rodata\n" 149 "\t.section .rodata\n"
158 "\t.balign 16\n" 150 "\t.balign 16\n"
159 "%s:\n\n", 151 "%s:\n\n",
160 152
161 ".long ","",HEX_0X 153 ".long ","",HEX_0X
162 }, 154 },
163 // 16 bytes alignment. 155 /* 16 bytes alignment. */
164 // http://docs.oracle.com/cd/E19641-01/802-1947/802-1947.pdf 156 /* http://docs.oracle.com/cd/E19641-01/802-1947/802-1947.pdf */
165 {"sun", 157 {"sun",
166 "\t.section \".rodata\"\n" 158 "\t.section \".rodata\"\n"
167 "\t.align 16\n" 159 "\t.align 16\n"
168 ".globl %s\n" 160 ".globl %s\n"
169 "%s:\n", 161 "%s:\n",
170 162
171 ".word ","",HEX_0X 163 ".word ","",HEX_0X
172 }, 164 },
173 // 16 bytes alignment for sun-x86. 165 /* 16 bytes alignment for sun-x86. */
174 // http://docs.oracle.com/cd/E19963-01/html/821-1608/eoiyg.html 166 /* http://docs.oracle.com/cd/E19963-01/html/821-1608/eoiyg.html */
175 {"sun-x86", 167 {"sun-x86",
176 "Drodata.rodata:\n" 168 "Drodata.rodata:\n"
177 "\t.type Drodata.rodata,@object\n" 169 "\t.type Drodata.rodata,@object\n"
178 "\t.size Drodata.rodata,0\n" 170 "\t.size Drodata.rodata,0\n"
179 "\t.globl %s\n" 171 "\t.globl %s\n"
180 "\t.align 16\n" 172 "\t.align 16\n"
181 "%s:\n", 173 "%s:\n",
182 174
183 ".4byte ","",HEX_0X 175 ".4byte ","",HEX_0X
184 }, 176 },
185 // 1<<4 bit alignment for aix. 177 /* 1<<4 bit alignment for aix. */
186 // http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.aix assem%2Fdoc%2Falangref%2Fidalangref_csect_pseudoop.htm 178 /* http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.aix assem%2Fdoc%2Falangref%2Fidalangref_csect_pseudoop.htm */
187 {"xlc", 179 {"xlc",
188 ".globl %s{RO}\n" 180 ".globl %s{RO}\n"
189 "\t.toc\n" 181 "\t.toc\n"
190 "%s:\n" 182 "%s:\n"
191 "\t.csect %s{RO}, 4\n", 183 "\t.csect %s{RO}, 4\n",
192 184
193 ".long ","",HEX_0X 185 ".long ","",HEX_0X
194 }, 186 },
195 {"aCC-ia64", 187 {"aCC-ia64",
196 "\t.file \"%s.s\"\n" 188 "\t.file \"%s.s\"\n"
197 "\t.type %s,@object\n" 189 "\t.type %s,@object\n"
198 "\t.global %s\n" 190 "\t.global %s\n"
199 "\t.secalias .abe$0.rodata, \".rodata\"\n" 191 "\t.secalias .abe$0.rodata, \".rodata\"\n"
200 "\t.section .abe$0.rodata = \"a\", \"progbits\"\n" 192 "\t.section .abe$0.rodata = \"a\", \"progbits\"\n"
201 "\t.align 16\n" 193 "\t.align 16\n"
202 "%s::\t", 194 "%s::\t",
203 195
204 "data4 ","",HEX_0X 196 "data4 ","",HEX_0X
205 }, 197 },
206 {"aCC-parisc", 198 {"aCC-parisc",
207 "\t.SPACE $TEXT$\n" 199 "\t.SPACE $TEXT$\n"
208 "\t.SUBSPA $LIT$\n" 200 "\t.SUBSPA $LIT$\n"
209 "%s\n" 201 "%s\n"
210 "\t.EXPORT %s\n" 202 "\t.EXPORT %s\n"
211 "\t.ALIGN 16\n", 203 "\t.ALIGN 16\n",
212 204
213 ".WORD ","",HEX_0X 205 ".WORD ","",HEX_0X
214 }, 206 },
215 // align 16 bytes 207 /* align 16 bytes */
216 // http://msdn.microsoft.com/en-us/library/dwa9fwef.aspx 208 /* http://msdn.microsoft.com/en-us/library/dwa9fwef.aspx */
217 { "masm", 209 { "masm",
218 "\tTITLE %s\n" 210 "\tTITLE %s\n"
219 "; generated by genccode\n" 211 "; generated by genccode\n"
220 ".386\n" 212 ".386\n"
221 ".model flat\n" 213 ".model flat\n"
222 "\tPUBLIC _%s\n" 214 "\tPUBLIC _%s\n"
223 "ICUDATA_%s\tSEGMENT READONLY PARA PUBLIC FLAT 'DATA'\n" 215 "ICUDATA_%s\tSEGMENT READONLY PARA PUBLIC FLAT 'DATA'\n"
224 "\tALIGN 16\n" 216 "\tALIGN 16\n"
225 "_%s\tLABEL DWORD\n", 217 "_%s\tLABEL DWORD\n",
226 "\tDWORD ","\nICUDATA_%s\tENDS\n\tEND\n",HEX_0H 218 "\tDWORD ","\nICUDATA_%s\tENDS\n\tEND\n",HEX_0H
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 char *bufferStr = (char *)buffer; 257 char *bufferStr = (char *)buffer;
266 FileStream *in, *out; 258 FileStream *in, *out;
267 size_t i, length; 259 size_t i, length;
268 260
269 in=T_FileStream_open(filename, "rb"); 261 in=T_FileStream_open(filename, "rb");
270 if(in==NULL) { 262 if(in==NULL) {
271 fprintf(stderr, "genccode: unable to open input file %s\n", filename); 263 fprintf(stderr, "genccode: unable to open input file %s\n", filename);
272 exit(U_FILE_ACCESS_ERROR); 264 exit(U_FILE_ACCESS_ERROR);
273 } 265 }
274 266
275 getOutFilename(filename, destdir, bufferStr, entry, ".S", optFilename); 267 getOutFilename(filename, destdir, bufferStr, entry, ".s", optFilename);
276 out=T_FileStream_open(bufferStr, "w"); 268 out=T_FileStream_open(bufferStr, "w");
277 if(out==NULL) { 269 if(out==NULL) {
278 fprintf(stderr, "genccode: unable to open output file %s\n", bufferStr); 270 fprintf(stderr, "genccode: unable to open output file %s\n", bufferStr);
279 exit(U_FILE_ACCESS_ERROR); 271 exit(U_FILE_ACCESS_ERROR);
280 } 272 }
281 273
282 if (outFilePath != NULL) { 274 if (outFilePath != NULL) {
283 uprv_strcpy(outFilePath, bufferStr); 275 uprv_strcpy(outFilePath, bufferStr);
284 } 276 }
285 277
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 #else 754 #else
763 # error "Unknown platform for CAN_GENERATE_OBJECTS." 755 # error "Unknown platform for CAN_GENERATE_OBJECTS."
764 #endif 756 #endif
765 757
766 T_FileStream_close(in); 758 T_FileStream_close(in);
767 } 759 }
768 760
769 U_CAPI void U_EXPORT2 761 U_CAPI void U_EXPORT2
770 writeObjectCode(const char *filename, const char *destdir, const char *optEntryP oint, const char *optMatchArch, const char *optFilename, char *outFilePath) { 762 writeObjectCode(const char *filename, const char *destdir, const char *optEntryP oint, const char *optMatchArch, const char *optFilename, char *outFilePath) {
771 /* common variables */ 763 /* common variables */
772 char buffer[4096], entry[40]={ 0 }; 764 char buffer[4096], entry[96]={ 0 };
773 FileStream *in, *out; 765 FileStream *in, *out;
774 const char *newSuffix; 766 const char *newSuffix;
775 int32_t i, entryLength, length, size, entryOffset=0, entryLengthOffset=0; 767 int32_t i, entryLength, length, size, entryOffset=0, entryLengthOffset=0;
776 768
777 uint16_t cpu, bits; 769 uint16_t cpu, bits;
778 UBool makeBigEndian; 770 UBool makeBigEndian;
779 771
780 /* platform-specific variables and initialization code */ 772 /* platform-specific variables and initialization code */
781 #ifdef U_ELF 773 #ifdef U_ELF
782 /* 32-bit Elf file header */ 774 /* 32-bit Elf file header */
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 1182
1191 if(T_FileStream_error(out)) { 1183 if(T_FileStream_error(out)) {
1192 fprintf(stderr, "genccode: file write error while generating from file % s\n", filename); 1184 fprintf(stderr, "genccode: file write error while generating from file % s\n", filename);
1193 exit(U_FILE_ACCESS_ERROR); 1185 exit(U_FILE_ACCESS_ERROR);
1194 } 1186 }
1195 1187
1196 T_FileStream_close(out); 1188 T_FileStream_close(out);
1197 T_FileStream_close(in); 1189 T_FileStream_close(in);
1198 } 1190 }
1199 #endif 1191 #endif
OLDNEW
« no previous file with comments | « source/tools/toolutil/package.cpp ('k') | source/tools/toolutil/pkg_icu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698