Skip to content

Commit

Permalink
Add ObjWriter API to set DWARF version
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalStrehovsky committed Jan 19, 2022
1 parent 340aa3d commit 0960aa8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/tools/objwriter/objwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ void ObjectWriter::Finish() {
Streamer->Finish();
}

void ObjectWriter::SetDwarfVersion(uint16_t v) {
Streamer->getContext().setDwarfVersion(5);
}

void ObjectWriter::SwitchSection(const char *SectionName,
CustomSectionAttributes attributes,
const char *ComdatName) {
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/objwriter/objwriter.exports
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
InitObjWriter
FinishObjWriter
SetDwarfVersion
SwitchSection
SetCodeSectionAttribute
EmitAlignment
Expand Down
6 changes: 6 additions & 0 deletions llvm/tools/objwriter/objwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ObjectWriter {
bool Init(StringRef FunctionName, const char* tripleName = nullptr);
void Finish();

void SetDwarfVersion(uint16_t v);
void SwitchSection(const char *SectionName,
CustomSectionAttributes attributes,
const char *ComdatName);
Expand Down Expand Up @@ -213,6 +214,11 @@ DLL_EXPORT STDMETHODCALLTYPE void FinishObjWriter(ObjectWriter *OW) {
delete OW;
}

DLL_EXPORT STDMETHODCALLTYPE void SetDwarfVersion(ObjectWriter *OW, uint16_t v) {
assert(OW && "ObjWriter is null");
OW->SetDwarfVersion(v);
}

DLL_EXPORT STDMETHODCALLTYPE void SwitchSection(ObjectWriter *OW, const char *SectionName,
CustomSectionAttributes attributes,
const char *ComdatName) {
Expand Down

0 comments on commit 0960aa8

Please sign in to comment.