Avoid bextr in dump_constants am: dbb8948ebe am: 9b078e1268
Change-Id: I0e845f62eac284e1a2c54965bd43b2fef998f252
diff --git a/dump_constants.cc b/dump_constants.cc
index 80c8664..f3d7074 100644
--- a/dump_constants.cc
+++ b/dump_constants.cc
@@ -15,10 +15,12 @@
#include "libsyscalls.h"
int main() {
+ // Numeric values are passed to std::cout via std::to_string() to avoid
+ // the use of 'bextr' asm instruction (when compiled with -march=bdver4).
std::cout << "{\n";
- std::cout << " \"arch_nr\": " << MINIJAIL_ARCH_NR << ",\n";
+ std::cout << " \"arch_nr\": " << std::to_string(MINIJAIL_ARCH_NR) << ",\n";
std::cout << " \"arch_name\": \"" << MINIJAIL_ARCH_NAME << "\",\n";
- std::cout << " \"bits\": " << MINIJAIL_ARCH_BITS << ",\n";
+ std::cout << " \"bits\": " << std::to_string(MINIJAIL_ARCH_BITS) << ",\n";
std::cout << " \"syscalls\": {\n";
bool first = true;
for (const struct syscall_entry* entry = syscall_table; entry->name;
@@ -27,7 +29,7 @@
first = false;
else
std::cout << ",\n";
- std::cout << " \"" << entry->name << "\": " << entry->nr;
+ std::cout << " \"" << entry->name << "\": " << std::to_string(entry->nr);
}
std::cout << "\n },\n";
std::cout << " \"constants\": {\n";
@@ -38,7 +40,8 @@
first = false;
else
std::cout << ",\n";
- std::cout << " \"" << entry->name << "\": " << entry->value;
+ std::cout << " \"" << entry->name << "\": "
+ << std::to_string(entry->value);
}
std::cout << "\n }\n";
std::cout << "}\n";