Changeset 96367 in vbox
- Timestamp:
- Aug 19, 2022 10:12:14 PM (2 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r96354 r96367 1744 1744 $$(call MSG_GENERATE,$(target),$$@,) 1745 1745 $$(QUIET)$$(MKDIR) -p -- "$$($(target)_0_OUTDIR)/genalias/" 1746 $$(QUIET)$$(VBOX_GENALIAS) -f $$(if-expr "$(bld_trg)" == "win",coff ,$$(if-expr "$(bld_trg)" == "darwin",macho,omf)) \1746 $$(QUIET)$$(VBOX_GENALIAS) -f $$(if-expr "$(bld_trg)" == "win",coff.$(bld_trg_arch),$$(if-expr "$(bld_trg)" == "darwin",macho,omf)) \ 1747 1747 -D "$$($(target)_0_OUTDIR)/genalias/" $$($(target)_2_VBOX_NOCRT_ALIASES) \ 1748 1748 $$($(target)_VBOX_NOCRT_ALIASES) \ -
trunk/src/bldprogs/genalias.cpp
r96041 r96367 29 29 #include <assert.h> 30 30 31 #define GENALIAS_UNDERSCORED 0 31 32 /********************************************************************************************************************************* 33 * Defined Constants And Macros * 34 *********************************************************************************************************************************/ 35 #if defined(RT_OS_DARWIN) || (defined(RT_ARCH_X86) && (defined(RT_OS_WINDOWS) || defined(RT_OS_OS2))) 36 # define GENALIAS_UNDERSCORED 1 37 #else 38 # define GENALIAS_UNDERSCORED 0 39 #endif 32 40 33 41 … … 128 136 } 129 137 130 static int WriteAliasObjectCOFF(FILE *pOutput, const char *pszAlias, const char *pszReal )138 static int WriteAliasObjectCOFF(FILE *pOutput, const char *pszAlias, const char *pszReal, bool fUnderscored) 131 139 { 132 140 #pragma pack(1) … … 143 151 struct CoffShdr 144 152 { 145 char Name[8];153 char Name[8]; 146 154 uint32_t VirtualSize; 147 155 uint32_t VirtualAddress; … … 222 230 /* The alias symbol. */ 223 231 memset(&Sym, 0, sizeof(Sym)); 224 Sym.u.s.Offset = GENALIAS_UNDERSCORED+ cchReal + 1 + 4;232 Sym.u.s.Offset = fUnderscored + cchReal + 1 + 4; 225 233 Sym.SectionNumber = IMAGE_SYM_UNDEFINED; 226 234 Sym.Type = IMAGE_SYM_TYPE_NULL; … … 238 246 239 247 /* the string table. */ 240 u32 = 4 + cchReal + 1 + cchAlias + 1 + GENALIAS_UNDERSCORED* 2;248 u32 = 4 + cchReal + 1 + cchAlias + 1 + fUnderscored * 2; 241 249 if (fwrite(&u32, 4, 1, pOutput) != 1) 242 250 return -2; 243 #if GENALIAS_UNDERSCORED 244 if (fputc('_', pOutput) == EOF) 245 return -2; 246 #endif 251 if (fUnderscored) 252 if (fputc('_', pOutput) == EOF) 253 return -2; 247 254 if (fwrite(pszReal, cchReal + 1, 1, pOutput) != 1) 248 255 return -2; 249 #if GENALIAS_UNDERSCORED 250 if (fputc('_', pOutput) == EOF) 251 return -2; 252 #endif 256 if (fUnderscored) 257 if (fputc('_', pOutput) == EOF) 258 return -2; 253 259 if (fwrite(pszAlias, cchAlias + 1, 1, pOutput) != 1) 254 260 return -2; 255 261 return 0; 256 262 } 263 264 static int WriteAliasObjectTargetCOFF(FILE *pOutput, const char *pszAlias, const char *pszReal) 265 { 266 return WriteAliasObjectCOFF(pOutput, pszAlias, pszReal, GENALIAS_UNDERSCORED); 267 } 268 269 static int WriteAliasObjectX86COFF(FILE *pOutput, const char *pszAlias, const char *pszReal) 270 { 271 return WriteAliasObjectCOFF(pOutput, pszAlias, pszReal, true /*fUnderscored*/); 272 } 273 274 static int WriteAliasObjectAmd64COFF(FILE *pOutput, const char *pszAlias, const char *pszReal) 275 { 276 return WriteAliasObjectCOFF(pOutput, pszAlias, pszReal, false /*fUnderscored*/); 277 } 278 257 279 258 280 static int WriteAliasObjectELF(FILE *pOutput, const char *pszAlias, const char *pszReal) … … 388 410 pfnWriter = WriteAliasObjectAOUT; 389 411 else if (!strcmp(argv[2], "coff")) 390 pfnWriter = WriteAliasObjectCOFF; 412 pfnWriter = WriteAliasObjectTargetCOFF; 413 else if (!strcmp(argv[2], "coff.x86")) 414 pfnWriter = WriteAliasObjectX86COFF; 415 else if (!strcmp(argv[2], "coff.amd64")) 416 pfnWriter = WriteAliasObjectAmd64COFF; 391 417 else if (!strcmp(argv[2], "elf")) 392 418 pfnWriter = WriteAliasObjectELF;
Note:
See TracChangeset
for help on using the changeset viewer.