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

feat(arc): add optional arg for filename in gscobj header #153

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion include/xsk/arc/assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class assembler

public:
assembler(context const* ctx);
auto assemble(assembly const& data) -> buffer;
auto assemble(assembly const& data, std::string const& string = "") -> buffer;
Copy link
Contributor

@diamante0018 diamante0018 Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty string should be initialized with empty braces rather than "" due to clang bug that was discovered by me and some other people.

llvm/llvm-project#64535
llvm/llvm-project#64536


private:
auto assemble_function(function& func) -> void;
Expand Down
6 changes: 3 additions & 3 deletions src/arc/assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ assembler::assembler(context const* ctx) : ctx_{ ctx }, script_{ ctx->endian() =
{
}

auto assembler::assemble(assembly const& data) -> buffer
auto assembler::assemble(assembly const& data, std::string const& filename) -> buffer
{
assembly_ = &data;
script_.clear();
Expand All @@ -26,7 +26,7 @@ auto assembler::assemble(assembly const& data) -> buffer
auto head = header{};

script_.pos((ctx_->props() & props::headerxx) ? 0 : (ctx_->props() & props::header72) ? 72 : 64);
process_string("");
process_string(filename);

for (auto const& func : assembly_->functions)
{
Expand Down Expand Up @@ -183,7 +183,7 @@ auto assembler::assemble(assembly const& data) -> buffer
head.profile_count = 0;

head.flags = 0;
head.name = resolve_string("");
head.name = resolve_string(filename);

auto endpos = script_.pos();

Expand Down