ICU-22210 toolutil: Add NASM generator

This commit is contained in:
L. E. Segovia 2022-11-20 14:07:55 -03:00 committed by Markus Scherer
parent 2c46fb7f61
commit 167f8855a2

View file

@ -228,6 +228,16 @@ static const struct AssemblyType {
},
/* align 16 bytes */
/* http://msdn.microsoft.com/en-us/library/dwa9fwef.aspx */
{"nasm",
"global %s\n"
#if defined(_WIN32)
"section .rdata align=16\n"
#else
"section .rodata align=16\n"
#endif
"%s:\n",
" dd ","",HEX_0X
},
{ "masm",
"\tTITLE %s\n"
"; generated by genccode\n"
@ -294,6 +304,17 @@ writeAssemblyCode(
exit(U_FILE_ACCESS_ERROR);
}
const char* newSuffix = nullptr;
if (uprv_strcmp(assemblyHeader[assemblyHeaderIndex].name, "masm") == 0) {
newSuffix = ".masm";
}
else if (uprv_strcmp(assemblyHeader[assemblyHeaderIndex].name, "nasm") == 0) {
newSuffix = ".asm";
} else {
newSuffix = ".S";
}
getOutFilename(
filename,
destdir,
@ -301,7 +322,7 @@ writeAssemblyCode(
sizeof(buffer.chars),
entry,
sizeof(entry),
".S",
newSuffix,
optFilename);
out=T_FileStream_open(buffer.chars, "w");
if(out==nullptr) {