If this fails, then investigate the SectionRef vs SectionDef rules in BeCOFFObject::MarkSectionUsed
| 2793 | |
| 2794 | // If this fails, then investigate the SectionRef vs SectionDef rules in BeCOFFObject::MarkSectionUsed |
| 2795 | void BlContext::WriteDLLLib(const StringImpl& libName) |
| 2796 | { |
| 2797 | FileStream fs; |
| 2798 | if (!fs.Open(libName, "wb")) |
| 2799 | { |
| 2800 | Fail(StrFormat("Unable to create file \"%s\"", libName.c_str())); |
| 2801 | return; |
| 2802 | } |
| 2803 | |
| 2804 | //mExports.clear(); |
| 2805 | |
| 2806 | struct _LibSym |
| 2807 | { |
| 2808 | int mOfsIdx; |
| 2809 | int mDataPos; |
| 2810 | BlExport* mExport; |
| 2811 | String mName; |
| 2812 | String mExportName; |
| 2813 | _LibSym* mImp; |
| 2814 | void* mData; |
| 2815 | int mDataSize; |
| 2816 | |
| 2817 | _LibSym() |
| 2818 | { |
| 2819 | mOfsIdx = -1; |
| 2820 | mDataPos = -1; |
| 2821 | mExport = NULL; |
| 2822 | mImp = NULL; |
| 2823 | mData = NULL; |
| 2824 | mDataSize = 0; |
| 2825 | } |
| 2826 | }; |
| 2827 | |
| 2828 | OwnedVector<_LibSym> libSyms; |
| 2829 | |
| 2830 | String dllName = GetFileName(mOutName); |
| 2831 | String baseName = dllName.Substring(0, dllName.length() - 4); |
| 2832 | |
| 2833 | auto _CreateDebugSect = [] (BeCOFFObject& coffObject) |
| 2834 | { |
| 2835 | // Not actually needed |
| 2836 | return; |
| 2837 | |
| 2838 | /*auto debugSect = coffObject.CreateSect(".debug$S", IMAGE_SCN_ALIGN_1BYTES | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_DISCARDABLE, false); |
| 2839 | unsigned char hexData[66] = { |
| 2840 | 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x54, 0x65, 0x73, |
| 2841 | 0x74, 0x44, 0x6C, 0x6C, 0x32, 0x2E, 0x64, 0x6C, 0x6C, 0x27, 0x00, 0x13, 0x10, 0x07, 0x00, 0x00, |
| 2842 | 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x97, 0x5E, 0x12, |
| 2843 | 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x4C, 0x49, |
| 2844 | 0x4E, 0x4B |
| 2845 | }; |
| 2846 | debugSect->mData.Write(hexData, 0x42);*/ |
| 2847 | }; |
| 2848 | |
| 2849 | String importDescriptorName = "__IMPORT_DESCRIPTOR_" + baseName; |
| 2850 | String nullImportDescriptorName = "__NULL_IMPORT_DESCRIPTOR"; |
| 2851 | String nullThunkDataName = "\x7F"; |
| 2852 | nullThunkDataName += baseName; |
nothing calls this directly
no test coverage detected