OLD | NEW |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
3 /****************************************************************************** | 3 /****************************************************************************** |
4 * Copyright (C) 2009-2016, International Business Machines | 4 * Copyright (C) 2009-2016, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 ******************************************************************************* | 6 ******************************************************************************* |
7 */ | 7 */ |
8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
9 | 9 |
10 #if U_PLATFORM_HAS_WIN32_API | 10 #if U_PLATFORM_HAS_WIN32_API |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 /* set defaults */ | 680 /* set defaults */ |
681 #ifdef U_ELF | 681 #ifdef U_ELF |
682 /* set EM_386 because elf.h does not provide better defaults */ | 682 /* set EM_386 because elf.h does not provide better defaults */ |
683 *pCPU=EM_386; | 683 *pCPU=EM_386; |
684 *pBits=32; | 684 *pBits=32; |
685 *pIsBigEndian=(UBool)(U_IS_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB); | 685 *pIsBigEndian=(UBool)(U_IS_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB); |
686 #elif U_PLATFORM_HAS_WIN32_API | 686 #elif U_PLATFORM_HAS_WIN32_API |
687 /* _M_IA64 should be defined in windows.h */ | 687 /* _M_IA64 should be defined in windows.h */ |
688 # if defined(_M_IA64) | 688 # if defined(_M_IA64) |
689 *pCPU=IMAGE_FILE_MACHINE_IA64; | 689 *pCPU=IMAGE_FILE_MACHINE_IA64; |
| 690 *pBits = 64; |
690 # elif defined(_M_AMD64) | 691 # elif defined(_M_AMD64) |
691 *pCPU=IMAGE_FILE_MACHINE_AMD64; | 692 // link.exe does not really care about the .obj machine type and this will |
| 693 // allow us to build a dll for both ARM & x64 with an amd64 built tool |
| 694 // ARM is same as x64 except for first 2 bytes of object file |
| 695 *pCPU = IMAGE_FILE_MACHINE_UNKNOWN; |
| 696 // *pCPU = IMAGE_FILE_MACHINE_ARMNT; // If we wanted to be explicit |
| 697 // *pCPU = IMAGE_FILE_MACHINE_AMD64; // We would use one of these name
s |
| 698 *pBits = 64; // Doesn't seem to be used for an
ything interesting? |
692 # else | 699 # else |
693 *pCPU=IMAGE_FILE_MACHINE_I386; | 700 *pCPU=IMAGE_FILE_MACHINE_I386; // We would use one of these names |
| 701 *pBits = 32; |
694 # endif | 702 # endif |
695 *pBits= *pCPU==IMAGE_FILE_MACHINE_I386 ? 32 : 64; | |
696 *pIsBigEndian=FALSE; | 703 *pIsBigEndian=FALSE; |
697 #else | 704 #else |
698 # error "Unknown platform for CAN_GENERATE_OBJECTS." | 705 # error "Unknown platform for CAN_GENERATE_OBJECTS." |
699 #endif | 706 #endif |
700 return; | 707 return; |
701 } | 708 } |
702 | 709 |
703 in=T_FileStream_open(filename, "rb"); | 710 in=T_FileStream_open(filename, "rb"); |
704 if(in==NULL) { | 711 if(in==NULL) { |
705 fprintf(stderr, "genccode: unable to open match-arch file %s\n", filenam
e); | 712 fprintf(stderr, "genccode: unable to open match-arch file %s\n", filenam
e); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 */ | 1030 */ |
1024 entry[0]='_'; | 1031 entry[0]='_'; |
1025 | 1032 |
1026 newSuffix=".obj"; | 1033 newSuffix=".obj"; |
1027 #else | 1034 #else |
1028 # error "Unknown platform for CAN_GENERATE_OBJECTS." | 1035 # error "Unknown platform for CAN_GENERATE_OBJECTS." |
1029 #endif | 1036 #endif |
1030 | 1037 |
1031 /* deal with options, files and the entry point name */ | 1038 /* deal with options, files and the entry point name */ |
1032 getArchitecture(&cpu, &bits, &makeBigEndian, optMatchArch); | 1039 getArchitecture(&cpu, &bits, &makeBigEndian, optMatchArch); |
1033 printf("genccode: --match-arch cpu=%hu bits=%hu big-endian=%d\n", cpu, bits,
makeBigEndian); | 1040 if (optMatchArch) |
| 1041 { |
| 1042 printf("genccode: --match-arch cpu=%hu bits=%hu big-endian=%d\n", cpu, b
its, makeBigEndian); |
| 1043 } |
| 1044 else |
| 1045 { |
| 1046 printf("genccode: using architecture cpu=%hu bits=%hu big-endian=%d\n",
cpu, bits, makeBigEndian); |
| 1047 } |
1034 #if U_PLATFORM_HAS_WIN32_API | 1048 #if U_PLATFORM_HAS_WIN32_API |
1035 if(cpu==IMAGE_FILE_MACHINE_I386) { | 1049 if(cpu==IMAGE_FILE_MACHINE_I386) { |
1036 entryOffset=1; | 1050 entryOffset=1; |
1037 } | 1051 } |
1038 #endif | 1052 #endif |
1039 | 1053 |
1040 in=T_FileStream_open(filename, "rb"); | 1054 in=T_FileStream_open(filename, "rb"); |
1041 if(in==NULL) { | 1055 if(in==NULL) { |
1042 fprintf(stderr, "genccode: unable to open input file %s\n", filename); | 1056 fprintf(stderr, "genccode: unable to open input file %s\n", filename); |
1043 exit(U_FILE_ACCESS_ERROR); | 1057 exit(U_FILE_ACCESS_ERROR); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 | 1204 |
1191 if(T_FileStream_error(out)) { | 1205 if(T_FileStream_error(out)) { |
1192 fprintf(stderr, "genccode: file write error while generating from file %
s\n", filename); | 1206 fprintf(stderr, "genccode: file write error while generating from file %
s\n", filename); |
1193 exit(U_FILE_ACCESS_ERROR); | 1207 exit(U_FILE_ACCESS_ERROR); |
1194 } | 1208 } |
1195 | 1209 |
1196 T_FileStream_close(out); | 1210 T_FileStream_close(out); |
1197 T_FileStream_close(in); | 1211 T_FileStream_close(in); |
1198 } | 1212 } |
1199 #endif | 1213 #endif |
OLD | NEW |