@@ -142,14 +142,6 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
142
142
}
143
143
144
144
// Exception Handling.
145
- EHFrameSection =
146
- Ctx->getMachOSection (" __TEXT" , " __eh_frame" ,
147
- MCSectionMachO::S_COALESCED |
148
- MCSectionMachO::S_ATTR_NO_TOC |
149
- MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
150
- MCSectionMachO::S_ATTR_LIVE_SUPPORT,
151
- SectionKind::getReadOnly ());
152
-
153
145
LSDASection = Ctx->getMachOSection (" __TEXT" , " __gcc_except_tab" , 0 ,
154
146
SectionKind::getReadOnlyWithRel ());
155
147
@@ -347,17 +339,6 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
347
339
348
340
// Exception Handling Sections.
349
341
350
- // Solaris requires different flags for .eh_frame to seemingly every other
351
- // platform.
352
- unsigned EHSectionFlags = ELF::SHF_ALLOC;
353
- if (T.getOS () == Triple::Solaris)
354
- EHSectionFlags |= ELF::SHF_WRITE;
355
-
356
- EHFrameSection =
357
- Ctx->getELFSection (" .eh_frame" , ELF::SHT_PROGBITS,
358
- EHSectionFlags,
359
- SectionKind::getDataRel ());
360
-
361
342
// FIXME: We're emitting LSDA info into a readonly section on ELF, even though
362
343
// it contains relocatable pointers. In PIC mode, this is probably a big
363
344
// runtime hit for C++ apps. Either the contents of the LSDA need to be
@@ -434,13 +415,6 @@ void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
434
415
COFF::IMAGE_SCN_MEM_WRITE,
435
416
SectionKind::getDataRel ());
436
417
437
- EHFrameSection =
438
- Ctx->getCOFFSection (" .eh_frame" ,
439
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
440
- COFF::IMAGE_SCN_MEM_READ |
441
- COFF::IMAGE_SCN_MEM_WRITE,
442
- SectionKind::getDataRel ());
443
-
444
418
// FIXME: We're emitting LSDA info into a readonly section on COFF, even
445
419
// though it contains relocatable pointers. In PIC mode, this is probably a
446
420
// big runtime hit for C++ apps. Either the contents of the LSDA need to be
@@ -573,3 +547,25 @@ void MCObjectFileInfo::InitMCObjectFileInfo(StringRef TT, Reloc::Model relocm,
573
547
}
574
548
}
575
549
550
+ void MCObjectFileInfo::InitEHFrameSection () {
551
+ if (Env == IsMachO)
552
+ EHFrameSection =
553
+ Ctx->getMachOSection (" __TEXT" , " __eh_frame" ,
554
+ MCSectionMachO::S_COALESCED |
555
+ MCSectionMachO::S_ATTR_NO_TOC |
556
+ MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
557
+ MCSectionMachO::S_ATTR_LIVE_SUPPORT,
558
+ SectionKind::getReadOnly ());
559
+ else if (Env == IsELF)
560
+ EHFrameSection =
561
+ Ctx->getELFSection (" .eh_frame" , ELF::SHT_PROGBITS,
562
+ ELF::SHF_ALLOC,
563
+ SectionKind::getDataRel ());
564
+ else
565
+ EHFrameSection =
566
+ Ctx->getCOFFSection (" .eh_frame" ,
567
+ COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
568
+ COFF::IMAGE_SCN_MEM_READ |
569
+ COFF::IMAGE_SCN_MEM_WRITE,
570
+ SectionKind::getDataRel ());
571
+ }
0 commit comments