summaryrefslogtreecommitdiff
path: root/src/bldprogs/VBoxTpG.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/bldprogs/VBoxTpG.cpp
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/bldprogs/VBoxTpG.cpp')
-rw-r--r--src/bldprogs/VBoxTpG.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/bldprogs/VBoxTpG.cpp b/src/bldprogs/VBoxTpG.cpp
index 9c0d851a..d7a71c5b 100644
--- a/src/bldprogs/VBoxTpG.cpp
+++ b/src/bldprogs/VBoxTpG.cpp
@@ -483,11 +483,15 @@ static RTEXITCODE generateAssembly(PSCMSTREAM pStrm)
" [section __VTG __VTGObj align=16]\n"
"VTG_GLOBAL g_aVTGObj_LinkerPleaseNoticeMe, data\n"
" [section __VTG __VTGPrLc.Begin align=16]\n"
+ " dq 0, 0 ; Paranoia, related to the fudge below.\n"
"VTG_GLOBAL g_aVTGPrLc, data\n"
" [section __VTG __VTGPrLc align=16]\n"
"VTG_GLOBAL g_aVTGPrLc_LinkerPleaseNoticeMe, data\n"
" [section __VTG __VTGPrLc.End align=16]\n"
"VTG_GLOBAL g_aVTGPrLc_End, data\n"
+ " dq 0, 0 ; Fudge to work around unidentified linker where it would otherwise generate\n"
+ " ; a fix up of the first dword in __VTGPrLc.Begin despite the fact that it were\n"
+ " ; an empty section with nothing whatsoever to fix up.\n"
" %%endif\n"
" [section __VTG __VTGObj]\n"
"\n"
@@ -782,22 +786,21 @@ static RTEXITCODE generateAssembly(PSCMSTREAM pStrm)
* Emit code for the stub functions.
*/
bool const fWin64 = g_cBits == 64 && (!strcmp(g_pszAssemblerFmtVal, "win64") || !strcmp(g_pszAssemblerFmtVal, "pe64"));
- bool const fMachO64 = g_cBits == 64 && !strcmp(g_pszAssemblerFmtVal, "macho64");
- bool const fMachO32 = g_cBits == 32 && !strcmp(g_pszAssemblerFmtVal, "macho32");
+ bool const fElf = !strcmp(g_pszAssemblerFmtVal, "elf32") || !strcmp(g_pszAssemblerFmtVal, "elf64");
ScmStreamPrintf(pStrm,
"\n"
";\n"
"; Prob stubs.\n"
";\n"
"BEGINCODE\n"
- "extern %sNAME(%s)\n",
- g_fProbeFnImported ? "IMP" : "",
- g_pszProbeFnName);
- if (fMachO64 && g_fProbeFnImported && !g_fPic)
+ );
+ if (g_fProbeFnImported)
ScmStreamPrintf(pStrm,
- "g_pfnVtgProbeFn:\n"
- " dq NAME(%s)\n",
+ "EXTERN_IMP2 %s\n"
+ "BEGINCODE ; EXTERN_IMP2 changes section\n",
g_pszProbeFnName);
+ else
+ ScmStreamPrintf(pStrm, "extern NAME(%s)\n", g_pszProbeFnName);
RTListForEach(&g_ProviderHead, pProvider, VTGPROVIDER, ListEntry)
{
@@ -835,7 +838,7 @@ static RTEXITCODE generateAssembly(PSCMSTREAM pStrm)
* Jump to the fire-probe function.
*/
if (g_cBits == 32)
- ScmStreamPrintf(pStrm, g_fPic ?
+ ScmStreamPrintf(pStrm, g_fPic && fElf ?
" jmp %s wrt ..plt\n"
: g_fProbeFnImported ?
" mov ecx, IMP2(%s)\n"
@@ -843,22 +846,11 @@ static RTEXITCODE generateAssembly(PSCMSTREAM pStrm)
:
" jmp NAME(%s)\n"
, g_pszProbeFnName);
- else if (fWin64)
- ScmStreamPrintf(pStrm, g_fProbeFnImported ?
- " mov rax, IMP2(%s)\n"
- " jmp rax\n"
- :
- " jmp NAME(%s)\n"
- , g_pszProbeFnName);
- else if (fMachO64 && g_fProbeFnImported)
- ScmStreamPrintf(pStrm,
- " jmp [g_pfnVtgProbeFn wrt rip]\n");
else
- ScmStreamPrintf(pStrm, g_fPic ?
+ ScmStreamPrintf(pStrm, g_fPic && fElf ?
" jmp [rel %s wrt ..got]\n"
: g_fProbeFnImported ?
- " lea rax, [IMP2(%s)]\n"
- " jmp rax\n"
+ " jmp IMP2(%s)\n"
:
" jmp NAME(%s)\n"
, g_pszProbeFnName);
@@ -2320,7 +2312,7 @@ static RTEXITCODE parseArguments(int argc, char **argv)
case 'V':
{
/* The following is assuming that svn does it's job here. */
- static const char s_szRev[] = "$Revision: 80390 $";
+ static const char s_szRev[] = "$Revision: 87697 $";
const char *psz = RTStrStripL(strchr(s_szRev, ' '));
RTPrintf("r%.*s\n", strchr(psz, ' ') - psz, psz);
return RTEXITCODE_SUCCESS;