forked from OSchip/llvm-project
[PECOFF] Emit Load Configuration and SEH Table for x86.
If all input files are compatible with Structured Exception Handling, linker is supposed to create an exectuable with a table for SEH handlers. The table consists of exception handlers entry point addresses. The basic idea of SEH in x86 Microsoft ABI is to list all valid entry points of exception handlers in an read-only memory, so that an attacker cannot override the addresses in it. In x86 ABI, data for exception handling is mostly on stack, so it's volnerable to stack overflow attack. In order to protect against it, Windows runtime uses the table to check a return address, to ensure that the address is really an valid entry point for an exception handler. Compiler emits a list of exception handler functions to .sxdata section. It also emits a marker symbol "@feat.00" to indicate that the object is compatible with SEH. SEH is a relatively new feature for COFF, and mixing SEH-compatible and SEH-incompatible objects will result in an invalid executable, so is the marker. If all input files are compatible with SEH, LLD emits a SEH table. SEH table needs to be pointed by Load Configuration strucutre, so when emitting a SEH table LLD emits it too. The address of a Load Configuration will be stored to the file header. llvm-svn: 202248
This commit is contained in:
parent
286d87ed38
commit
2e09d93f74
|
@ -1,6 +1,7 @@
|
|||
add_lld_library(lldPECOFF
|
||||
EdataPass.cpp
|
||||
IdataPass.cpp
|
||||
LoadConfigPass.cpp
|
||||
PECOFFLinkingContext.cpp
|
||||
Pass.cpp
|
||||
ReaderCOFF.cpp
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
//===- lib/ReaderWriter/PECOFF/LoadConfigPass.cpp -------------------------===//
|
||||
//
|
||||
// The LLVM Linker
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// A Load Configuration is a data structure for x86 containing an address of the
|
||||
// SEH handler table. The Data Directory in the file header points to a load
|
||||
// configuration. Technically that indirection is not needed but exists for
|
||||
// historical reasons.
|
||||
//
|
||||
// If the file being handled has .sxdata section containing SEH handler table,
|
||||
// this pass will create a Load Configuration atom.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Pass.h"
|
||||
#include "LoadConfigPass.h"
|
||||
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/Pass.h"
|
||||
#include "lld/ReaderWriter/Simple.h"
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
||||
#include <climits>
|
||||
#include <ctime>
|
||||
#include <utility>
|
||||
|
||||
using llvm::object::coff_load_configuration32;
|
||||
|
||||
namespace lld {
|
||||
namespace pecoff {
|
||||
namespace loadcfg {
|
||||
|
||||
LoadConfigAtom::LoadConfigAtom(VirtualFile &file, const DefinedAtom *sxdata,
|
||||
int count)
|
||||
: COFFLinkerInternalAtom(
|
||||
file, file.getNextOrdinal(),
|
||||
std::vector<uint8_t>(sizeof(coff_load_configuration32))) {
|
||||
addDir32Reloc(this, sxdata, offsetof(llvm::object::coff_load_configuration32,
|
||||
SEHandlerTable));
|
||||
auto *data = getContents<llvm::object::coff_load_configuration32>();
|
||||
data->SEHandlerCount = count;
|
||||
}
|
||||
|
||||
} // namespace loadcfg
|
||||
|
||||
void LoadConfigPass::perform(std::unique_ptr<MutableFile> &file) {
|
||||
if (_ctx.noSEH())
|
||||
return;
|
||||
|
||||
// Find the first atom in .sxdata section.
|
||||
const DefinedAtom *sxdata = nullptr;
|
||||
int sectionSize = 0;
|
||||
for (const DefinedAtom *atom : file->defined()) {
|
||||
if (atom->customSectionName() == ".sxdata") {
|
||||
if (!sxdata)
|
||||
sxdata = atom;
|
||||
sectionSize += sxdata->size();
|
||||
}
|
||||
}
|
||||
if (!sxdata)
|
||||
return;
|
||||
|
||||
auto *loadcfg = new (_alloc)
|
||||
loadcfg::LoadConfigAtom(_file, sxdata, sectionSize / sizeof(uint32_t));
|
||||
file->addAtom(*loadcfg);
|
||||
}
|
||||
|
||||
} // namespace pecoff
|
||||
} // namespace lld
|
|
@ -0,0 +1,65 @@
|
|||
//===- lib/ReaderWriter/PECOFF/LoadConfigPass.h ---------------------------===//
|
||||
//
|
||||
// The LLVM Linker
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file \brief This linker pass creates an atom for Load Configuration
|
||||
/// structure.
|
||||
///
|
||||
/// For the details of the Load Configuration structure, see Microsoft PE/COFF
|
||||
/// Specification section 5.8. The Load Configuration Structure (Image Only).
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLD_READER_WRITER_PE_COFF_LOAD_CONFIG_PASS_H
|
||||
#define LLD_READER_WRITER_PE_COFF_LOAD_CONFIG_PASS_H
|
||||
|
||||
#include "Atoms.h"
|
||||
|
||||
#include "lld/Core/File.h"
|
||||
#include "lld/Core/Pass.h"
|
||||
#include "lld/ReaderWriter/PECOFFLinkingContext.h"
|
||||
#include "lld/ReaderWriter/Simple.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace lld {
|
||||
namespace pecoff {
|
||||
namespace loadcfg {
|
||||
|
||||
class LoadConfigAtom : public COFFLinkerInternalAtom {
|
||||
public:
|
||||
LoadConfigAtom(VirtualFile &file, const DefinedAtom *sxdata, int count);
|
||||
|
||||
virtual SectionChoice sectionChoice() const { return sectionCustomRequired; }
|
||||
virtual StringRef customSectionName() const { return ".loadcfg"; }
|
||||
virtual ContentType contentType() const { return typeData; }
|
||||
virtual ContentPermissions permissions() const { return permR__; }
|
||||
|
||||
template <typename T> T *getContents() const {
|
||||
return (T *)rawContent().data();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace loadcfg
|
||||
|
||||
class LoadConfigPass : public lld::Pass {
|
||||
public:
|
||||
LoadConfigPass(PECOFFLinkingContext &ctx) : _ctx(ctx), _file(ctx) {}
|
||||
|
||||
virtual void perform(std::unique_ptr<MutableFile> &file);
|
||||
|
||||
private:
|
||||
PECOFFLinkingContext &_ctx;
|
||||
VirtualFile _file;
|
||||
mutable llvm::BumpPtrAllocator _alloc;
|
||||
};
|
||||
|
||||
} // namespace pecoff
|
||||
} // namespace lld
|
||||
|
||||
#endif
|
|
@ -12,6 +12,7 @@
|
|||
#include "GroupedSectionsPass.h"
|
||||
#include "IdataPass.h"
|
||||
#include "LinkerGeneratedSymbolFile.h"
|
||||
#include "LoadConfigPass.h"
|
||||
#include "SetSubsystemPass.h"
|
||||
|
||||
#include "lld/Core/PassManager.h"
|
||||
|
@ -263,6 +264,7 @@ void PECOFFLinkingContext::addPasses(PassManager &pm) {
|
|||
pm.add(std::unique_ptr<Pass>(new pecoff::EdataPass(*this)));
|
||||
pm.add(std::unique_ptr<Pass>(new pecoff::IdataPass(*this)));
|
||||
pm.add(std::unique_ptr<Pass>(new LayoutPass(registry())));
|
||||
pm.add(std::unique_ptr<Pass>(new pecoff::LoadConfigPass(*this)));
|
||||
pm.add(std::unique_ptr<Pass>(new pecoff::GroupedSectionsPass()));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FileOutputBuffer.h"
|
||||
#include "llvm/Support/FileUtilities.h"
|
||||
|
@ -48,6 +49,7 @@ using llvm::object::coff_aux_weak_external;
|
|||
using llvm::object::coff_relocation;
|
||||
using llvm::object::coff_section;
|
||||
using llvm::object::coff_symbol;
|
||||
using llvm::support::ulittle32_t;
|
||||
|
||||
using namespace lld;
|
||||
|
||||
|
@ -100,6 +102,7 @@ private:
|
|||
vector<const DefinedAtom *> &result);
|
||||
|
||||
error_code cacheSectionAttributes();
|
||||
error_code maybeCreateSXDataAtoms();
|
||||
|
||||
error_code
|
||||
AtomizeDefinedSymbolsInSection(const coff_section *section,
|
||||
|
@ -277,11 +280,11 @@ FileCOFF::FileCOFF(std::unique_ptr<MemoryBuffer> mb, error_code &ec)
|
|||
bin.take();
|
||||
|
||||
// Read .drectve section if exists.
|
||||
ArrayRef<uint8_t> contents;
|
||||
if ((ec = getSectionContents(".drectve", contents)))
|
||||
ArrayRef<uint8_t> directives;
|
||||
if ((ec = getSectionContents(".drectve", directives)))
|
||||
return;
|
||||
if (!contents.empty())
|
||||
_directives = ArrayRefToString(contents);
|
||||
if (!directives.empty())
|
||||
_directives = ArrayRefToString(directives);
|
||||
}
|
||||
|
||||
error_code FileCOFF::parse(StringMap &altNames) {
|
||||
|
@ -302,6 +305,8 @@ error_code FileCOFF::parse(StringMap &altNames) {
|
|||
return ec;
|
||||
if (error_code ec = addRelocationReferenceToAtoms())
|
||||
return ec;
|
||||
if (error_code ec = maybeCreateSXDataAtoms())
|
||||
return ec;
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
|
@ -789,6 +794,51 @@ error_code FileCOFF::addRelocationReferenceToAtoms() {
|
|||
return error_code::success();
|
||||
}
|
||||
|
||||
// Read .sxdata section if exists. .sxdata is a x86-only section that contains a
|
||||
// vector of symbol offsets. The symbols pointed by this section are SEH handler
|
||||
// functions contained in the same object file. The linker needs to construct a
|
||||
// SEH table and emit it to executable.
|
||||
//
|
||||
// On x86, exception handler addresses are in stack, so they are vulnerable to
|
||||
// stack overflow attack. In order to protect against it, Windows runtime uses
|
||||
// the SEH table to check if a SEH handler address in stack is a real address of
|
||||
// a handler created by compiler.
|
||||
//
|
||||
// What we want to emit from the linker is a vector of SEH handler VAs, but here
|
||||
// we have a vector of offsets to the symbol table. So we convert the latter to
|
||||
// the former.
|
||||
error_code FileCOFF::maybeCreateSXDataAtoms() {
|
||||
ArrayRef<uint8_t> sxdata;
|
||||
if (error_code ec = getSectionContents(".sxdata", sxdata))
|
||||
return ec;
|
||||
if (sxdata.empty())
|
||||
return error_code::success();
|
||||
|
||||
std::vector<uint8_t> atomContent =
|
||||
*new (_alloc) std::vector<uint8_t>((size_t)sxdata.size());
|
||||
auto *atom = new (_alloc) COFFDefinedAtom(
|
||||
*this, "", ".sxdata", Atom::scopeTranslationUnit, DefinedAtom::typeData,
|
||||
false /*isComdat*/, DefinedAtom::permR__, DefinedAtom::mergeNo,
|
||||
atomContent, _ordinal++);
|
||||
|
||||
const ulittle32_t *symbolIndex =
|
||||
reinterpret_cast<const ulittle32_t *>(sxdata.data());
|
||||
int numSymbols = sxdata.size() / sizeof(uint32_t);
|
||||
|
||||
for (int i = 0; i < numSymbols; ++i) {
|
||||
Atom *handlerFunc;
|
||||
if (error_code ec = getAtomBySymbolIndex(symbolIndex[i], handlerFunc))
|
||||
return ec;
|
||||
int offsetInAtom = i * sizeof(uint32_t);
|
||||
atom->addReference(std::unique_ptr<COFFReference>(new COFFReference(
|
||||
handlerFunc, offsetInAtom, llvm::COFF::IMAGE_REL_I386_DIR32,
|
||||
Reference::KindNamespace::COFF, _referenceArch)));
|
||||
}
|
||||
|
||||
_definedAtoms._atoms.push_back(atom);
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
/// Find a section by name.
|
||||
error_code FileCOFF::findSection(StringRef name, const coff_section *&result) {
|
||||
for (auto si = _obj->section_begin(), se = _obj->section_end(); si != se;
|
||||
|
@ -975,6 +1025,11 @@ public:
|
|||
return llvm::object::object_error::parse_failed;
|
||||
}
|
||||
|
||||
// In order to emit SEH table, all input files need to be compatible with
|
||||
// SEH. Disable SEH if the file being read is not compatible.
|
||||
if (!file->isCompatibleWithSEH())
|
||||
_context.setSafeSEH(false);
|
||||
|
||||
result.push_back(std::move(file));
|
||||
return error_code::success();
|
||||
}
|
||||
|
|
|
@ -985,6 +985,9 @@ void PECOFFWriter::build(const File &linkedFile) {
|
|||
if (section->getSectionName() == ".edata")
|
||||
dataDirectory->setField(DataDirectoryIndex::EXPORT_TABLE,
|
||||
section->getVirtualAddress(), section->size());
|
||||
if (section->getSectionName() == ".loadcfg")
|
||||
dataDirectory->setField(DataDirectoryIndex::LOAD_CONFIG_TABLE,
|
||||
section->getVirtualAddress(), section->size());
|
||||
}
|
||||
|
||||
// Now that we know the size and file offset of sections. Set the file
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
__declspec(noinline) void triggerSEH() {
|
||||
volatile int *p = 0;
|
||||
*p = 1;
|
||||
}
|
||||
|
||||
int main() {
|
||||
__try {
|
||||
triggerSEH();
|
||||
} __except(1) {
|
||||
return 42;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,343 @@
|
|||
---
|
||||
header:
|
||||
Machine: IMAGE_FILE_MACHINE_I386
|
||||
Characteristics: [ ]
|
||||
sections:
|
||||
- Name: .drectve
|
||||
Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
|
||||
Alignment: 1
|
||||
SectionData: 2020202F44454641554C544C49423A22757569642E6C696222202F44454641554C544C49423A22757569642E6C696222202F4641494C49464D49534D415443483A225F4D53435F5645523D3138303022202F4641494C49464D49534D415443483A225F4954455241544F525F44454255475F4C4556454C3D3022202F4641494C49464D49534D415443483A2252756E74696D654C6962726172793D4D445F44796E616D696352656C6561736522202F44454641554C544C49423A226D73766370727422202F44454641554C544C49423A224D535643525422202F44454641554C544C49423A224F4C444E414D45532220
|
||||
- Name: '.debug$S'
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 1
|
||||
SectionData: 04000000F1000000600000002200011100000000433A5C63796777696E5C686F6D655C727569755C7365682E6F626A003A003C11012200000700120000000D520100120000000D5201004D6963726F736F667420285229204F7074696D697A696E6720436F6D70696C657200
|
||||
- Name: .rdata
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 1
|
||||
SectionData: 00
|
||||
- Name: .rdata
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 1
|
||||
SectionData: 01
|
||||
- Name: .rdata
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 4
|
||||
SectionData: 54726967676572696E672053454820657863657074696F6E0D0A0000457865637574696E6720534548205F5F65786365707420626C6F636B20696E20666F6F0D0A000000457865637574696E6720534548205F5F65786365707420626C6F636B0D0A00
|
||||
- Name: '.text$mn'
|
||||
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 16
|
||||
SectionData: 558BEC516800000000FF150000000083C404C745FC000000008B45FCC700140000008BE55DC3CCCCCCCCCCCCCCCCCCCC558BEC51E8000000008D4DFFE8000000008BE55DC3CCCCCCCCCCCCCCCCCCCCCC558BEC6AFE6800000000680000000064A1000000005083EC08535657A1000000003145F833C5508D45F064A3000000008965E8C745FC00000000E800000000C745FCFEFFFFFFEB1EB801000000C38B65E86800000000FF150000000083C404C745FCFEFFFFFF8B4DF064890D00000000595F5E5B8BE55DC3CCCCCCCCCCCCCCCC558BEC6AFE6800000000680000000064A1000000005083EC08535657A1000000003145F833C5508D45F064A3000000008965E8C745FC00000000E800000000E800000000C745FCFEFFFFFFEB1EB801000000C38B65E86800000000FF150000000083C404C745FCFEFFFFFF33C08B4DF064890D00000000595F5E5B8BE55DC3
|
||||
Relocations:
|
||||
- VirtualAddress: 5
|
||||
SymbolName: '$SG73531'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 11
|
||||
SymbolName: __imp__printf
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 53
|
||||
SymbolName: '?TestCPPEX@@YAXXZ'
|
||||
Type: IMAGE_REL_I386_REL32
|
||||
- VirtualAddress: 61
|
||||
SymbolName: '??1TestClass@@QAE@XZ'
|
||||
Type: IMAGE_REL_I386_REL32
|
||||
- VirtualAddress: 86
|
||||
SymbolName: '__sehtable$?foo@@YAXXZ'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 91
|
||||
SymbolName: __except_handler4
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 109
|
||||
SymbolName: ___security_cookie
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 139
|
||||
SymbolName: '?TestExceptions@@YAXXZ'
|
||||
Type: IMAGE_REL_I386_REL32
|
||||
- VirtualAddress: 162
|
||||
SymbolName: '$SG73539'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 168
|
||||
SymbolName: __imp__printf
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 214
|
||||
SymbolName: '__sehtable$_main'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 219
|
||||
SymbolName: __except_handler4
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 237
|
||||
SymbolName: ___security_cookie
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 267
|
||||
SymbolName: '?foo@@YAXXZ'
|
||||
Type: IMAGE_REL_I386_REL32
|
||||
- VirtualAddress: 272
|
||||
SymbolName: '?TestExceptions@@YAXXZ'
|
||||
Type: IMAGE_REL_I386_REL32
|
||||
- VirtualAddress: 295
|
||||
SymbolName: '$SG73543'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 301
|
||||
SymbolName: __imp__printf
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- Name: '.text$mn'
|
||||
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 16
|
||||
SectionData: 558BEC51894DFC6800000000FF150000000083C4048BE55DC3
|
||||
Relocations:
|
||||
- VirtualAddress: 8
|
||||
SymbolName: '??_C@_0BI@BBHGNMOG@Destroying?5TestClass?$CB?$AN?6?$AA@'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 14
|
||||
SymbolName: __imp__printf
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- Name: '.xdata$x'
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 8
|
||||
SectionData: FEFFFFFF00000000D8FFFFFF00000000FEFFFFFF000000000000000000000000FEFFFFFF00000000D8FFFFFF00000000FEFFFFFF0000000000000000
|
||||
Relocations:
|
||||
- VirtualAddress: 20
|
||||
SymbolName: '$LN5'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 24
|
||||
SymbolName: '$LN6'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 52
|
||||
SymbolName: '$LN5'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- VirtualAddress: 56
|
||||
SymbolName: '$LN6'
|
||||
Type: IMAGE_REL_I386_DIR32
|
||||
- Name: .rdata
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 4
|
||||
SectionData: 44657374726F79696E672054657374436C617373210D0A00
|
||||
- Name: .sxdata
|
||||
Characteristics: [ IMAGE_SCN_LNK_INFO ]
|
||||
Alignment: 4
|
||||
SectionData: 1B000000
|
||||
symbols:
|
||||
- Name: '@comp.id'
|
||||
Value: 14766605
|
||||
SectionNumber: 65535
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: '@feat.00'
|
||||
Value: 2147484049
|
||||
SectionNumber: 65535
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: .drectve
|
||||
Value: 0
|
||||
SectionNumber: 1
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: F00000000000000000000000000000000000
|
||||
- Name: '.debug$S'
|
||||
Value: 0
|
||||
SectionNumber: 2
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 6C0000000000000000000000000000000000
|
||||
- Name: .rdata
|
||||
Value: 0
|
||||
SectionNumber: 3
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 010000000000000000000000000002000000
|
||||
- Name: '?value@?$integral_constant@_N$0A@@std@@2_NB'
|
||||
Value: 0
|
||||
SectionNumber: 3
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: .rdata
|
||||
Value: 0
|
||||
SectionNumber: 4
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 010000000000000096300777000002000000
|
||||
- Name: '?value@?$integral_constant@_N$00@std@@2_NB'
|
||||
Value: 0
|
||||
SectionNumber: 4
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: .rdata
|
||||
Value: 0
|
||||
SectionNumber: 5
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 63000000000000004E69FDA6000000000000
|
||||
- Name: '$SG73531'
|
||||
Value: 0
|
||||
SectionNumber: 5
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: '$SG73539'
|
||||
Value: 28
|
||||
SectionNumber: 5
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: '$SG73543'
|
||||
Value: 68
|
||||
SectionNumber: 5
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: '.text$mn'
|
||||
Value: 0
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 4F01000011000000394E4F94000000000000
|
||||
- Name: '.text$mn'
|
||||
Value: 0
|
||||
SectionNumber: 7
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 19000000020000002DFF8C0C000002000000
|
||||
- Name: __imp__printf
|
||||
Value: 0
|
||||
SectionNumber: 0
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: '??1TestClass@@QAE@XZ'
|
||||
Value: 0
|
||||
SectionNumber: 7
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: '?TestCPPEX@@YAXXZ'
|
||||
Value: 0
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: '?TestExceptions@@YAXXZ'
|
||||
Value: 48
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: '?foo@@YAXXZ'
|
||||
Value: 80
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: _main
|
||||
Value: 208
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: __except_handler4
|
||||
Value: 0
|
||||
SectionNumber: 0
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: '$LN5'
|
||||
Value: 152
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_LABEL
|
||||
- Name: '$LN7'
|
||||
Value: 157
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_LABEL
|
||||
- Name: '$LN6'
|
||||
Value: 158
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_LABEL
|
||||
- Name: '$LN5'
|
||||
Value: 285
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_LABEL
|
||||
- Name: '$LN7'
|
||||
Value: 290
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_LABEL
|
||||
- Name: '$LN6'
|
||||
Value: 291
|
||||
SectionNumber: 6
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_LABEL
|
||||
- Name: '.xdata$x'
|
||||
Value: 0
|
||||
SectionNumber: 8
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 3C00000004000000E076DCAC000000000000
|
||||
- Name: '__sehtable$?foo@@YAXXZ'
|
||||
Value: 32
|
||||
SectionNumber: 8
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: '__sehtable$_main'
|
||||
Value: 0
|
||||
SectionNumber: 8
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
- Name: .rdata
|
||||
Value: 0
|
||||
SectionNumber: 9
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 180000000000000039E9484D000002000000
|
||||
- Name: '??_C@_0BI@BBHGNMOG@Destroying?5TestClass?$CB?$AN?6?$AA@'
|
||||
Value: 0
|
||||
SectionNumber: 9
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: ___security_cookie
|
||||
Value: 0
|
||||
SectionNumber: 0
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
||||
- Name: .sxdata
|
||||
Value: 0
|
||||
SectionNumber: 10
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
NumberOfAuxSymbols: 1
|
||||
AuxiliaryData: 040000000000000000000000000000000000
|
||||
...
|
|
@ -0,0 +1,25 @@
|
|||
# RUN: yaml2obj %p/Inputs/seh.obj.yaml > %t.obj
|
||||
#
|
||||
# RUN: lld -flavor link /out:%t.exe /subsystem:console /force /nodefaultlib \
|
||||
# RUN: -- %t.obj
|
||||
# RUN: llvm-objdump -private-headers %t.exe | FileCheck %s
|
||||
|
||||
CHECK: Load configuration:
|
||||
CHECK: Timestamp: 0
|
||||
CHECK: Major Version: 0
|
||||
CHECK: Minor Version: 0
|
||||
CHECK: GlobalFlags Clear: 0
|
||||
CHECK: GlobalFlags Set: 0
|
||||
CHECK: Critical Section Default Timeout: 0
|
||||
CHECK: Decommit Free Block Threshold: 0
|
||||
CHECK: Decommit Total Free Threshold: 0
|
||||
CHECK: Lock Prefix Table: 0
|
||||
CHECK: Maximum Allocation Size: 0
|
||||
CHECK: Virtual Memory Threshold: 0
|
||||
CHECK: Process Affinity Mask: 0
|
||||
CHECK: Process Heap Flags: 0
|
||||
CHECK: CSD Version: 0
|
||||
CHECK: Security Cookie: 0
|
||||
CHECK: SEH Table: 4210688
|
||||
CHECK: SEH Count: 1
|
||||
CHECK: SEH Table: 0x{{[0-9a-f]+}}
|
|
@ -48,8 +48,9 @@ FILE-NEXT: MinorSubsystemVersion: 11
|
|||
FILE-NEXT: SizeOfImage: 8192
|
||||
FILE-NEXT: SizeOfHeaders: 512
|
||||
FILE-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
|
||||
FILE-NEXT: Subsystem [ (0x8140)
|
||||
FILE-NEXT: Subsystem [ (0x8540)
|
||||
FILE-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
|
||||
FILE-NEXT: IMAGE_DLL_CHARACTERISTICS_NO_SEH (0x400)
|
||||
FILE-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
|
||||
FILE-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
|
||||
FILE-NEXT: ]
|
||||
|
|
Loading…
Reference in New Issue