VirtualBox

Ignore:
Timestamp:
Mar 10, 2025 9:18:27 PM (2 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167898
Message:

bldprogs/VBoxEditElf: Experiment with creating stub linker libraries, bugref:10874 [committed too much]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/VBoxDef2LazyLoad.cpp

    r108509 r108510  
    12331233                    "___LazyLoad___%s:\n"
    12341234                    "    adrp    x9, PAGE(g_sz%s)\n"
    1235                     "#ifndef ASM_FORMAT_ELF\n"
    12361235                    "    add     x9, x9, PAGEOFF(g_sz%s)\n"
    1237                     "#else\n"
    1238                     "    ldr     x9, [x9, PAGEOFF(g_sz%s)]\n"
    1239                     "#endif\n"
    12401236                    "    adrp    x10, PAGE(NAME(%s%s))\n"
    1241                     "#ifndef ASM_FORMAT_ELF\n"
    12421237                    "    add     x10, x10, PAGEOFF(NAME(%s%s))\n"
    1243                     "#else\n"
    1244                     "    ldr     x10, [x10, PAGEOFF(NAME(%s%s))]\n"
    1245                     "#endif\n"
    12461238                    "    mov     x16, x30\n"
    12471239                    "    bl      LazyLoadResolver\n"
    12481240                    "    mov     x30, x16\n"
    12491241                    , pExp->pszExportedNm,
    1250                     pExp->pszExportedNm, pExp->pszExportedNm, pExp->pszExportedNm,
    1251                     !pExp->fData ? "g_pfn" : "g_LazyPtr_", pExp->pszExportedNm,
     1242                    pExp->pszExportedNm, pExp->pszExportedNm,
    12521243                    !pExp->fData ? "g_pfn" : "g_LazyPtr_", pExp->pszExportedNm,
    12531244                    !pExp->fData ? "g_pfn" : "g_LazyPtr_", pExp->pszExportedNm);
     
    12571248                    "    movk    w9, #%u\n"
    12581249                    "    adrp    x10, PAGE(NAME(%s%s))\n"
    1259                     "#ifndef ASM_FORMAT_ELF\n"
    12601250                    "    add     x10, x10, PAGEOFF(NAME(%s%s))\n"
    1261                     "#else\n"
    1262                     "    ldr     x10, [x10, PAGEOFF(NAME(%s%s))]\n"
    1263                     "#endif\n"
    12641251                    , pExp->pszExportedNm,
    12651252                    pExp->uOrdinal,
    1266                     !pExp->fData ? "g_pfn" : "g_LazyPtr_", pExp->pszExportedNm,
    12671253                    !pExp->fData ? "g_pfn" : "g_LazyPtr_", pExp->pszExportedNm,
    12681254                    !pExp->fData ? "g_pfn" : "g_LazyPtr_", pExp->pszExportedNm);
     
    13611347            "    mov     x3, x0\n"
    13621348            "    adrp    x2, PAGE(g_szLibrary)\n"
    1363             "#ifndef ASM_FORMAT_ELF\n"
    13641349            "    add     x2, x2, PAGEOFF(g_szLibrary)\n"
    1365             "#else\n"
    1366             "    ldr     x2, [x2, PAGEOFF(g_szLibrary)]\n"
    1367             "#endif\n"
    13681350            "    mov     x1, x19\n"
    13691351            "    adrp    x0, PAGE(g_szFailLoadFmt)\n"
    1370             "#ifndef ASM_FORMAT_ELF\n"
    13711352            "    add     x0, x0, PAGEOFF(g_szFailLoadFmt)\n"
    1372             "#else\n"
    1373             "    ldr     x0, [x0, PAGEOFF(g_szFailLoadFmt)]\n"
    1374             "#endif\n"
    13751353            "    stp     x1, x2, [sp]\n"
    13761354            "    str     x3,     [sp, #16]\n"
     
    14401418                "    mov     x2, #0\n"
    14411419                "    adrp    x1, PAGE(g_hMod)\n"
    1442                 "#ifndef ASM_FORMAT_ELF\n"
    14431420                "    add     x1, x1, PAGEOFF(g_hMod)\n"
    1444                 "#else\n"
    1445                 "    ldr     x1, [x1, PAGEOFF(g_hMod)]\n"
    1446                 "#endif\n"
    14471421                "    adrp    x0, PAGE(g_szLibrary)\n"
    1448                 "#ifndef ASM_FORMAT_ELF\n"
    14491422                "    add     x0, x0, PAGEOFF(g_szLibrary)\n"
    1450                 "#else\n"
    1451                 "    ldr     x0, [x0, PAGEOFF(g_szLibrary)]\n"
    1452                 "#endif\n"
    14531423                "    bl      NAME(SUPR3HardenedLdrLoadAppPriv)\n");
    14541424    else
     
    14561426                "    /* Call RTLdrLoadSystem(const char *pszFilename, bool fNoUnload, PRTLDRMOD phLdrMod); */\n"
    14571427                "    adrp    x2, PAGE(g_hMod)\n"
    1458                 "#ifndef ASM_FORMAT_ELF\n"
    14591428                "    add     x2, x2, PAGEOFF(g_hMod)\n"
    1460                 "#else\n"
    1461                 "    ldr     x2, [x2, PAGEOFF(g_hMod)]\n"
    1462                 "#endif\n"
    14631429                "    mov     x1, #1\n"
    14641430                "    adrp    x0, PAGE(g_szLibrary)\n"
    1465                 "#ifndef ASM_FORMAT_ELF\n"
    14661431                "    add     x0, x0, PAGEOFF(g_szLibrary)\n"
    1467                 "#else\n"
    1468                 "    ldr     x0, [x0, PAGEOFF(g_szLibrary)]\n"
    1469                 "#endif\n"
    14701432                "    bl      NAME(RTLdrLoadSystem)\n");
    14711433
     
    14771439            "    mov     x2, x0\n"
    14781440            "    adrp    x1, PAGE(g_szLibrary)\n"
    1479             "#ifndef ASM_FORMAT_ELF\n"
    14801441            "    add     x1, x1, PAGEOFF(g_szLibrary)\n"
    1481             "#else\n"
    1482             "    ldr     x1, [x1, PAGEOFF(g_szLibrary)]\n"
    1483             "#endif\n"
    14841442            "    adrp    x0, PAGE(g_szFailResolveFmt)\n"
    1485             "#ifndef ASM_FORMAT_ELF\n"
    14861443            "    add     x0, x0, PAGEOFF(g_szFailResolveFmt)\n"
    1487             "#else\n"
    1488             "    ldr     x0, [x0, PAGEOFF(g_szFailResolveFmt)]\n"
    1489             "#endif\n"
    14901444            "    stp     x1, x2, [sp]\n"
    14911445            "    bl      NAME(RTAssertMsg2Weak)\n"
     
    15611515                    "    mov     x2, #0\n"
    15621516                    "    adrp    x1, PAGE(g_hMod)\n"
    1563                     "#ifndef ASM_FORMAT_ELF\n"
    15641517                    "    add     x1, x1, PAGEOFF(g_hMod)\n"
    1565                     "#else\n"
    1566                     "    ldr     x1, [x1, PAGEOFF(g_hMod)]\n"
    1567                     "#endif\n"
    15681518                    "    adrp    x0, PAGE(g_szLibrary)\n"
    1569                     "#ifndef ASM_FORMAT_ELF\n"
    15701519                    "    add     x0, x0, PAGEOFF(g_szLibrary)\n"
    1571                     "#else\n"
    1572                     "    ldr     x0, [x0, PAGEOFF(g_szLibrary)]\n"
    1573                     "#endif\n"
    15741520                    "    bl      NAME(SUPR3HardenedLdrLoadAppPriv)\n");
    15751521        else
     
    15771523                    "    /* Call RTLdrLoadSystem(const char *pszFilename, bool fNoUnload, PRTLDRMOD phLdrMod); */\n"
    15781524                    "    adrp    x2, PAGE(g_hMod)\n"
    1579                     "#ifndef ASM_FORMAT_ELF\n"
    15801525                    "    add     x2, x2, PAGEOFF(g_hMod)\n"
    1581                     "#else\n"
    1582                     "    ldr     x2, [x2, PAGEOFF(g_hMod)]\n"
    1583                     "#endif\n"
    15841526                    "    mov     x1, #1\n"
    15851527                    "    adrp    x0, PAGE(g_szLibrary)\n"
    1586                     "#ifndef ASM_FORMAT_ELF\n"
    15871528                    "    add     x0, x0, PAGEOFF(g_szLibrary)\n"
    1588                     "#else\n"
    1589                     "    ldr     x0, [x0, PAGEOFF(g_szLibrary)]\n"
    1590                     "#endif\n"
    15911529                    "    bl      NAME(RTLdrLoadSystem)\n");
    15921530        fprintf(pOutput,
     
    16041542                "\n"
    16051543                "    adrp     x22, PAGE(g_szzNames)\n"
    1606                 "#ifndef ASM_FORMAT_ELF\n"
    16071544                "    add      x22, x22, PAGEOFF(g_szzNames)\n"
    1608                 "#else\n"
    1609                 "    ldr      x22, [x22, PAGEOFF(g_szzNames)]\n"
    1610                 "#endif\n"
    16111545                "    adrp     x23, PAGE(g_apfnImports)\n"
    1612                 "#ifndef ASM_FORMAT_ELF\n"
    16131546                "    add      x23, x23, PAGEOFF(g_apfnImports)\n"
    1614                 "#else\n"
    1615                 "    ldr      x23, [x23, PAGEOFF(g_apfnImports)]\n"
    1616                 "#endif\n"
    16171547                "Lexplicit_load_next_import:\n"
    16181548                "    ldr     x0, [x23]\n"
Note: See TracChangeset for help on using the changeset viewer.

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