Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ObjWriter API to set DWARF version #161

Merged
merged 2 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(v);
}

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