diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2022-11-12 10:21:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-12 10:21:01 +0300 |
commit | b117dbcc0bbbd2c9ba13f7aa668d10c9a225273c (patch) | |
tree | 5412a156154d090f86a25fea44d3ee80e98d1c4b | |
parent | 3db8d68195c17386557f1a258312bbae4051dc05 (diff) |
Do not indiscriminately create text section (#312)objwriter/12.x
If we ended up with nothing in the text section, this line would error LLVM out in:
https://github.com/dotnet/llvm-project/blob/3db8d68195c17386557f1a258312bbae4051dc05/llvm/lib/MC/ELFObjectWriter.cpp#L1458-L1459
Because we generate a reference to the empty text section in the `aranges` section.
I double checked and debugging on Linux still works fine without this. `SetCodeSectionAttribute` is an objwriter API and we have access to it from the managed side. We should be calling it from there if it's needed for something that I didn't realize (we do call it from the managed side for the `.managed` section, but that one actually has debug information generated, unlike `.text`).
-rw-r--r-- | llvm/tools/objwriter/objwriter.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/llvm/tools/objwriter/objwriter.cpp b/llvm/tools/objwriter/objwriter.cpp index 6e3346150b56..91d252140ce6 100644 --- a/llvm/tools/objwriter/objwriter.cpp +++ b/llvm/tools/objwriter/objwriter.cpp @@ -140,8 +140,6 @@ bool ObjectWriter::Init(llvm::StringRef ObjectFilePath, const char* tripleName) FrameOpened = false; FuncId = 1; - SetCodeSectionAttribute("text", CustomSectionAttributes_Executable, nullptr); - if (ObjFileInfo->getObjectFileType() == ObjFileInfo->IsCOFF) { TypeBuilder.reset(new UserDefinedCodeViewTypesBuilder()); } else { |