Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Make the contracts generated with --allow-names usable. #1071

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion tools/external/wabt/src/tools/postpass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ static void ParseOptions(int argc, char** argv) {
s_outfile = argument;
ConvertBackslashToSlash(&s_outfile);
});
parser.AddOption(
'n', "allow-names",
"Preserve the name section",
[]() {
s_write_binary_options.write_debug_names = true;
});
parser.AddArgument("filename", OptionParser::ArgumentCount::One,
[](const char* argument) {
s_infile = argument;
Expand Down Expand Up @@ -145,7 +151,7 @@ int ProgramMain(int argc, char** argv) {
Module module;
const bool kStopOnFirstError = true;
ReadBinaryOptions options(s_features, s_log_stream_s.get(),
stub, kStopOnFirstError,
s_write_binary_options.write_debug_names, kStopOnFirstError,
stub);
result = ReadBinaryIr(s_infile.c_str(), file_data.data(),
file_data.size(), &options, &error_handler, &module);
Expand Down
1 change: 0 additions & 1 deletion tools/include/compiler_options.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ static Options CreateOptions(bool add_defaults=true) {
if (fquery_client_opt)
ldopts.emplace_back("-fquery-client");
if (allow_names_opt) {
ldopts.emplace_back("-fno-post-pass");
ldopts.emplace_back("--allow-names");
}
#endif
Expand Down
8 changes: 6 additions & 2 deletions tools/ld/eosio-ld.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ int main(int argc, const char **argv) {
std::cerr << "Error: eosio.pp not found! (Try reinstalling eosio.cdt)" << std::endl;
return -1;
}

if (!eosio::cdt::environment::exec_subprogram("eosio-pp", {opts.output_fn})) {
std::vector<std::string> pp_opts;
if(allow_names_opt) {
pp_opts.push_back("--allow-names");
}
pp_opts.push_back(opts.output_fn);
if (!eosio::cdt::environment::exec_subprogram("eosio-pp", pp_opts)) {
std::cerr << "eosio-pp failed" << std::endl;
return -1;
}
Expand Down