VirtualBox

Changeset 96367 in vbox


Ignore:
Timestamp:
Aug 19, 2022 10:12:14 PM (2 years ago)
Author:
vboxsync
Message:

bldprogs/genalias,IPRT/Makefile.kmk: Adjustments for targeting win.x86 on a win.amd64 host. bugref:10261

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r96354 r96367  
    17441744        $$(call MSG_GENERATE,$(target),$$@,)
    17451745        $$(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)) \
    17471747                -D "$$($(target)_0_OUTDIR)/genalias/" $$($(target)_2_VBOX_NOCRT_ALIASES) \
    17481748                $$($(target)_VBOX_NOCRT_ALIASES) \
  • trunk/src/bldprogs/genalias.cpp

    r96041 r96367  
    2929#include <assert.h>
    3030
    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
    3240
    3341
     
    128136}
    129137
    130 static int WriteAliasObjectCOFF(FILE *pOutput, const char *pszAlias, const char *pszReal)
     138static int WriteAliasObjectCOFF(FILE *pOutput, const char *pszAlias, const char *pszReal, bool fUnderscored)
    131139{
    132140#pragma pack(1)
     
    143151    struct CoffShdr
    144152    {
    145         char    Name[8];
     153        char        Name[8];
    146154        uint32_t    VirtualSize;
    147155        uint32_t    VirtualAddress;
     
    222230    /* The alias symbol. */
    223231    memset(&Sym, 0, sizeof(Sym));
    224     Sym.u.s.Offset = GENALIAS_UNDERSCORED + cchReal + 1 + 4;
     232    Sym.u.s.Offset = fUnderscored + cchReal + 1 + 4;
    225233    Sym.SectionNumber = IMAGE_SYM_UNDEFINED;
    226234    Sym.Type = IMAGE_SYM_TYPE_NULL;
     
    238246
    239247    /* the string table. */
    240     u32 = 4 + cchReal + 1 + cchAlias + 1 + GENALIAS_UNDERSCORED * 2;
     248    u32 = 4 + cchReal + 1 + cchAlias + 1 + fUnderscored * 2;
    241249    if (fwrite(&u32, 4, 1, pOutput) != 1)
    242250        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;
    247254    if (fwrite(pszReal, cchReal + 1, 1, pOutput) != 1)
    248255        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;
    253259    if (fwrite(pszAlias, cchAlias + 1, 1, pOutput) != 1)
    254260        return -2;
    255261    return 0;
    256262}
     263
     264static int WriteAliasObjectTargetCOFF(FILE *pOutput, const char *pszAlias, const char *pszReal)
     265{
     266    return WriteAliasObjectCOFF(pOutput, pszAlias, pszReal, GENALIAS_UNDERSCORED);
     267}
     268
     269static int WriteAliasObjectX86COFF(FILE *pOutput, const char *pszAlias, const char *pszReal)
     270{
     271    return WriteAliasObjectCOFF(pOutput, pszAlias, pszReal, true  /*fUnderscored*/);
     272}
     273
     274static int WriteAliasObjectAmd64COFF(FILE *pOutput, const char *pszAlias, const char *pszReal)
     275{
     276    return WriteAliasObjectCOFF(pOutput, pszAlias, pszReal, false /*fUnderscored*/);
     277}
     278
    257279
    258280static int WriteAliasObjectELF(FILE *pOutput, const char *pszAlias, const char *pszReal)
     
    388410        pfnWriter = WriteAliasObjectAOUT;
    389411    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;
    391417    else if (!strcmp(argv[2], "elf"))
    392418        pfnWriter = WriteAliasObjectELF;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette