mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
[WinEH] Emit .safeseh directives for all 32-bit exception handlers
Use a "safeseh" string attribute to do this. You would think we chould just accumulate the set of personalities like we do on dwarf, but this fails to account for the LSDA-loading thunks we use for __CxxFrameHandler3. Each of those needs to make it into .sxdata as well. The string attribute seemed like the most straightforward approach. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -60,7 +60,7 @@ public:
|
||||
private:
|
||||
void emitExceptionRegistrationRecord(Function *F);
|
||||
|
||||
void linkExceptionRegistration(IRBuilder<> &Builder, Value *Handler);
|
||||
void linkExceptionRegistration(IRBuilder<> &Builder, Function *Handler);
|
||||
void unlinkExceptionRegistration(IRBuilder<> &Builder);
|
||||
void addCXXStateStores(Function &F, MachineModuleInfo &MMI);
|
||||
void addSEHStateStores(Function &F, MachineModuleInfo &MMI);
|
||||
@@ -365,11 +365,14 @@ Function *WinEHStatePass::generateLSDAInEAXThunk(Function *ParentFunc) {
|
||||
}
|
||||
|
||||
void WinEHStatePass::linkExceptionRegistration(IRBuilder<> &Builder,
|
||||
Value *Handler) {
|
||||
Function *Handler) {
|
||||
// Emit the .safeseh directive for this function.
|
||||
Handler->addFnAttr("safeseh");
|
||||
|
||||
Type *LinkTy = getEHLinkRegistrationType();
|
||||
// Handler = Handler
|
||||
Handler = Builder.CreateBitCast(Handler, Builder.getInt8PtrTy());
|
||||
Builder.CreateStore(Handler, Builder.CreateStructGEP(LinkTy, Link, 1));
|
||||
Value *HandlerI8 = Builder.CreateBitCast(Handler, Builder.getInt8PtrTy());
|
||||
Builder.CreateStore(HandlerI8, Builder.CreateStructGEP(LinkTy, Link, 1));
|
||||
// Next = [fs:00]
|
||||
Constant *FSZero =
|
||||
Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));
|
||||
|
Reference in New Issue
Block a user