From 168df7fc251b3f6d8c618b0b264c50a3087a198b Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 26 Jan 2021 14:11:51 -0800 Subject: Delete dead code (#47452) --- src/coreclr/ilasm/assem.cpp | 2 - src/coreclr/ilasm/assembler.h | 2 - src/coreclr/ilasm/main.cpp | 31 ------------- src/coreclr/ilasm/writer.cpp | 41 ++++------------- src/coreclr/ilasm/writer_enc.cpp | 99 +--------------------------------------- 5 files changed, 12 insertions(+), 163 deletions(-) (limited to 'src/coreclr/ilasm') diff --git a/src/coreclr/ilasm/assem.cpp b/src/coreclr/ilasm/assem.cpp index 473ec42cda9..db89a880a0e 100644 --- a/src/coreclr/ilasm/assem.cpp +++ b/src/coreclr/ilasm/assem.cpp @@ -30,8 +30,6 @@ Assembler::Assembler() m_pEmitter = NULL; m_pImporter = NULL; - m_fCPlusPlus = FALSE; - m_fWindowsCE = FALSE; char* pszFQN = new char[16]; strcpy_s(pszFQN,16,""); m_pModuleClass = new Class(pszFQN); diff --git a/src/coreclr/ilasm/assembler.h b/src/coreclr/ilasm/assembler.h index e220a6ce711..b5dfd4d35dc 100644 --- a/src/coreclr/ilasm/assembler.h +++ b/src/coreclr/ilasm/assembler.h @@ -803,8 +803,6 @@ public: // moved to Class //MethodList m_MethodList; - BOOL m_fCPlusPlus; - BOOL m_fWindowsCE; BOOL m_fDLL; BOOL m_fOBJ; BOOL m_fEntryPointPresent; diff --git a/src/coreclr/ilasm/main.cpp b/src/coreclr/ilasm/main.cpp index f27e7af825c..2e8f68beada 100644 --- a/src/coreclr/ilasm/main.cpp +++ b/src/coreclr/ilasm/main.cpp @@ -676,8 +676,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv) if(pAsm->m_fReportProgress) { pParser->msg("\nAssembling '%s' ", szInputFilename); - if(pAsm->m_fCPlusPlus) pParser->msg(" C++"); - if(pAsm->m_fWindowsCE) pParser->msg(" WINCE"); if(!pAsm->m_fAutoInheritFromObject) pParser->msg(" NOAUTOINHERIT"); pParser->msg(IsDLL ? " to DLL" : (IsOBJ? " to OBJ" : " to EXE")); //====================================================================== @@ -778,8 +776,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv) if(pAsm->m_fReportProgress) { pParser->msg("\nAssembling delta '%s' ", szInputFilename); - if(pAsm->m_fCPlusPlus) pParser->msg(" C++"); - if(pAsm->m_fWindowsCE) pParser->msg(" WINCE"); if(!pAsm->m_fAutoInheritFromObject) pParser->msg(" NOAUTOINHERIT"); pParser->msg(" to DMETA,DIL"); //====================================================================== @@ -823,33 +819,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv) pParser->msg("%d methods folded\n",pAsm->m_dwMethodsFolded); if(pParser->Success()) exitval = 0; else pParser->msg("Output delta files contain errors\n"); - -#ifdef GENERATE_SUMMARY_PE_FILE - if(pAsm->OnErrGo) exitval = 0; - - //if(FAILED(hr=pAsm->CreatePEFile(wzOutputFilename))) - // pParser->msg("Could not create output file, error code=0x%08X\n",hr); - //else - { - if(pAsm->m_fReportProgress) pParser->msg("Writing %s file\n", pAsm->m_fOBJ ? "COFF" : "PE"); - // Generate the file - if (FAILED(hr = pAsm->m_pCeeFileGen->GenerateCeeFile(pAsm->m_pCeeFile))) - { - exitval = 1; - pParser->msg("Failed to write output file, error code=0x%08X\n",hr); - } - else if (pAsm->m_pManifest->m_sStrongName.m_fFullSign) - { - // Strong name sign the resultant assembly. - if(pAsm->m_fReportProgress) pParser->msg("Signing file with strong name\n"); - if (FAILED(hr=pAsm->StrongNameSign())) - { - exitval = 1; - pParser->msg("Failed to strong name sign output file, error code=0x%08X\n",hr); - } - } - } -#endif } } // end if (pParser->Success() || pAsm->OnErrGo) } //end if (SUCCEEDED(pAsm->InitMetaDataForENC())) diff --git a/src/coreclr/ilasm/writer.cpp b/src/coreclr/ilasm/writer.cpp index 0628263367f..f2a890201ea 100644 --- a/src/coreclr/ilasm/writer.cpp +++ b/src/coreclr/ilasm/writer.cpp @@ -1402,29 +1402,20 @@ HRESULT Assembler::CreatePEFile(__in __nullterminated WCHAR *pwzOutputFilename) if (m_dwCeeFileFlags & ICEE_CREATE_MACHINE_I386) COR_SET_32BIT_REQUIRED(m_dwComImageFlags); } - if (m_fWindowsCE) - { - if (FAILED(hr=m_pCeeFileGen->SetSubsystem(m_pCeeFile, IMAGE_SUBSYSTEM_WINDOWS_CE_GUI, 2, 10))) goto exit; - if (FAILED(hr=m_pCeeFileGen->SetImageBase(m_pCeeFile, 0x10000))) goto exit; - } - else + if (m_dwCeeFileFlags & ICEE_CREATE_MACHINE_ARM || m_fAppContainer) { - if (m_dwCeeFileFlags & ICEE_CREATE_MACHINE_ARM || m_fAppContainer) - { - // For AppContainer and ARM, you must have a minimum subsystem version of 6.02 - m_wSSVersionMajor = (m_wSSVersionMajor < 6) ? 6 : m_wSSVersionMajor; - m_wSSVersionMinor = (m_wSSVersionMinor < 2 && m_wSSVersionMajor <= 6) ? 2 : m_wSSVersionMinor; - - } + // For AppContainer and ARM, you must have a minimum subsystem version of 6.02 + m_wSSVersionMajor = (m_wSSVersionMajor < 6) ? 6 : m_wSSVersionMajor; + m_wSSVersionMinor = (m_wSSVersionMinor < 2 && m_wSSVersionMajor <= 6) ? 2 : m_wSSVersionMinor; + } - // Default the subsystem, instead the user doesn't set it to GUI or CUI - if (m_dwSubsystem == (DWORD)-1) - // The default for ILAsm previously was CUI, so that should be the default behavior... - m_dwSubsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI; + // Default the subsystem, instead the user doesn't set it to GUI or CUI + if (m_dwSubsystem == (DWORD)-1) + // The default for ILAsm previously was CUI, so that should be the default behavior... + m_dwSubsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI; - if (FAILED(hr=m_pCeeFileGen->SetSubsystem(m_pCeeFile, m_dwSubsystem, m_wSSVersionMajor, m_wSSVersionMinor))) goto exit; - } + if (FAILED(hr=m_pCeeFileGen->SetSubsystem(m_pCeeFile, m_dwSubsystem, m_wSSVersionMajor, m_wSSVersionMinor))) goto exit; if (FAILED(hr=m_pCeeFileGen->ClearComImageFlags(m_pCeeFile, COMIMAGE_FLAGS_ILONLY))) goto exit; if (FAILED(hr=m_pCeeFileGen->SetComImageFlags(m_pCeeFile, m_dwComImageFlags))) goto exit; @@ -1605,18 +1596,6 @@ HRESULT Assembler::CreatePEFile(__in __nullterminated WCHAR *pwzOutputFilename) goto exit; } } - /* - if((m_wRTVmajor < 0xFFFF)&&(m_wRTVminor < 0xFFFF)) - { - IMAGE_COR20_HEADER* pCorH; - if(FAILED(hr=m_pCeeFileGen->GetCorHeader(m_pCeeFile,&pCorH))) goto exit; - pCorH->MajorRuntimeVersion = VAL16(m_wRTVmajor); - pCorH->MinorRuntimeVersion = VAL16(m_wRTVminor); - } - */ - // Generate the file -- moved to main - //if (FAILED(hr=m_pCeeFileGen->GenerateCeeFile(m_pCeeFile))) goto exit; - hr = S_OK; diff --git a/src/coreclr/ilasm/writer_enc.cpp b/src/coreclr/ilasm/writer_enc.cpp index d99b02bea20..a6670d03ce1 100644 --- a/src/coreclr/ilasm/writer_enc.cpp +++ b/src/coreclr/ilasm/writer_enc.cpp @@ -9,9 +9,6 @@ #include "assembler.h" -int ist=0; -#define REPT_STEP //printf("Step %d\n",++ist); - HRESULT Assembler::InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileName, BOOL generatePdb) { HRESULT hr = E_FAIL; @@ -223,7 +220,7 @@ HRESULT Assembler::CreateDeltaFiles(__in __nullterminated WCHAR *pwzOutputFilena printf("Error: Cannot create a PE file with no metadata\n"); return E_FAIL; } -REPT_STEP + if(m_pManifest) { hr = S_OK; @@ -279,7 +276,6 @@ REPT_STEP } } } -REPT_STEP // All ref'ed items def'ed in this file are emitted, resolve member refs to member defs: hr = ResolveLocalMemberRefs(); @@ -316,7 +312,7 @@ REPT_STEP if(!OnErrGo) return E_FAIL; } } -REPT_STEP + // Emit the rest of the metadata hr = S_OK; if(m_pManifest) @@ -325,7 +321,6 @@ REPT_STEP } ResolveLocalMemberRefs(); // in case CAs added some EmitUnresolvedCustomAttributes(); -REPT_STEP hr = DoLocalMemberRefFixups(); if(FAILED(hr) &&(!OnErrGo)) goto exit; @@ -384,12 +379,6 @@ REPT_STEP *pEnd = 0; } -REPT_STEP - - //if (DoGlobalFixups() == FALSE) - // return E_FAIL; - - //if (FAILED(hr=m_pCeeFileGen->SetOutputFileName(m_pCeeFile, pwzOutputFilename))) goto exit; // Emit the meta-data to a separate file IMetaDataEmit2* pENCEmitter; @@ -446,8 +435,6 @@ REPT_STEP return S_OK; -REPT_STEP - // set managed resource entry, if any if(m_pManifest && m_pManifest->m_dwMResSizeTotal) { @@ -457,87 +444,10 @@ REPT_STEP sizeof(DWORD), (void**) &mresourceData))) goto exit; if (FAILED(hr=m_pCeeFileGen->SetManifestEntry(m_pCeeFile, mresourceSize, 0))) goto exit; } -REPT_STEP - /* - if (m_fWindowsCE) - { - if (FAILED(hr=m_pCeeFileGen->SetSubsystem(m_pCeeFile, IMAGE_SUBSYSTEM_WINDOWS_CE_GUI, 2, 10))) goto exit; - - if (FAILED(hr=m_pCeeFileGen->SetImageBase(m_pCeeFile, 0x10000))) goto exit; - } - else if(m_dwSubsystem != (DWORD)-1) - { - if (FAILED(hr=m_pCeeFileGen->SetSubsystem(m_pCeeFile, m_dwSubsystem, 4, 0))) goto exit; - } - - if (FAILED(hr=m_pCeeFileGen->ClearComImageFlags(m_pCeeFile, COMIMAGE_FLAGS_ILONLY))) goto exit; - if (FAILED(hr=m_pCeeFileGen->SetComImageFlags(m_pCeeFile, m_dwComImageFlags & ~COMIMAGE_FLAGS_STRONGNAMESIGNED))) goto exit; - if(m_dwFileAlignment) - { - if(FAILED(hr=m_pCeeFileGen->SetFileAlignment(m_pCeeFile, m_dwFileAlignment))) goto exit; - } - if(m_stBaseAddress) - { - if(FAILED(hr=m_pCeeFileGen->SetImageBase(m_pCeeFile, m_stBaseAddress))) goto exit; - } - */ -REPT_STEP //Compute all the RVAs if (FAILED(hr=m_pCeeFileGen->LinkCeeFile(m_pCeeFile))) goto exit; -REPT_STEP - // Fix up any fields that have RVA associated with them -/* - if (m_fHaveFieldsWithRvas) { - hr = S_OK; - ULONG dataSectionRVA; - if (FAILED(hr=m_pCeeFileGen->GetSectionRVA(m_pGlobalDataSection, &dataSectionRVA))) goto exit; - - ULONG tlsSectionRVA; - if (FAILED(hr=m_pCeeFileGen->GetSectionRVA(m_pTLSSection, &tlsSectionRVA))) goto exit; - - FieldDescriptor* pListFD; - Class* pClass; - for(int i=0; (pClass = m_lstClass.PEEK(i)); i++) - { - for(int j=0; (pListFD = pClass->m_FieldDList.PEEK(j)); j++) - { - if (pListFD->m_rvaLabel != 0) - { - DWORD rva; - if(*(pListFD->m_rvaLabel)=='@') - { - rva = (DWORD)atoi(pListFD->m_rvaLabel + 1); - } - else - { - GlobalLabel *pLabel = FindGlobalLabel(pListFD->m_rvaLabel); - if (pLabel == 0) - { - report->msg("Error:Could not find label '%s' for the field '%s'\n", pListFD->m_rvaLabel, pListFD->m_szName); - hr = E_FAIL; - continue; - } - - rva = pLabel->m_GlobalOffset; - if (pLabel->m_Section == m_pTLSSection) - rva += tlsSectionRVA; - else { - _ASSERTE(pLabel->m_Section == m_pGlobalDataSection); - rva += dataSectionRVA; - } - } - if (FAILED(m_pEmitter->SetFieldRVA(pListFD->m_fdFieldTok, rva))) goto exit; - } - } - } - if (FAILED(hr)) goto exit; - } -REPT_STEP -*/ - -REPT_STEP // actually output the resources if(mresourceSize && mresourceData) { @@ -583,11 +493,6 @@ REPT_STEP goto exit; } } -REPT_STEP - - // Generate the file -- moved to main - //if (FAILED(hr=m_pCeeFileGen->GenerateCeeFile(m_pCeeFile))) goto exit; - hr = S_OK; -- cgit v1.2.3