Skip to content
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: 0 additions & 8 deletions deps/LIEF/lief.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,7 @@
'cflags': [
'-fPIC'
],
# We need c++17 to compile without std::format and avoid conflicts with spdlog.
'msvs_settings': {
'VCCLCompilerTool': {
'LanguageStandard': 'stdcpp17',
},
},
'cflags_cc': [
'-std=gnu++17',
'-fPIC',
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
Expand All @@ -474,7 +467,6 @@
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'-std=gnu++17',
'-fPIC',
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
Expand Down
38 changes: 21 additions & 17 deletions deps/LIEF/src/PE/Section.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ void Section::clear(uint8_t c) {
}

std::ostream& operator<<(std::ostream& os, const Section& section) {
using namespace fmt;
static constexpr auto WIDTH = 24;
const auto& list = section.characteristics_list();
std::vector<std::string> list_str;
Expand All @@ -138,29 +137,34 @@ std::ostream& operator<<(std::ostream& os, const Section& section) {
fullname_hex.reserve(section.name().size());
std::transform(section.fullname().begin(), section.fullname().end(),
std::back_inserter(fullname_hex),
[] (const char c) { return format("{:02x}", c); });
[] (const char c) { return fmt::format("{:02x}", c); });

const std::string fullname_hex_joined =
fmt::format("{}", fmt::join(fullname_hex, " "));
const std::string characteristics_joined =
fmt::format("{}", fmt::join(list_str, ", "));

if (const COFF::String* coff_str = section.coff_string()) {
os << format("{:{}} {} ({}, {})\n", "Name:", WIDTH, section.name(),
join(fullname_hex, " "), coff_str->str());
os << fmt::format("{:{}} {} ({}, {})\n", "Name:", WIDTH, section.name(),
fullname_hex_joined, coff_str->str());
} else {
os << format("{:{}} {} ({})\n", "Name:", WIDTH, section.name(),
join(fullname_hex, " "));
os << fmt::format("{:{}} {} ({})\n", "Name:", WIDTH, section.name(),
fullname_hex_joined);
}

os << format("{:{}} 0x{:x}\n", "Virtual Size", WIDTH, section.virtual_size())
<< format("{:{}} 0x{:x}\n", "Virtual Address", WIDTH, section.virtual_address())
<< format("{:{}} [0x{:08x}, 0x{:08x}]\n", "Range", WIDTH,
os << fmt::format("{:{}} 0x{:x}\n", "Virtual Size", WIDTH, section.virtual_size())
<< fmt::format("{:{}} 0x{:x}\n", "Virtual Address", WIDTH, section.virtual_address())
<< fmt::format("{:{}} [0x{:08x}, 0x{:08x}]\n", "Range", WIDTH,
section.virtual_address(), section.virtual_address() + section.virtual_size())
<< format("{:{}} 0x{:x}\n", "Size of raw data", WIDTH, section.sizeof_raw_data())
<< format("{:{}} 0x{:x}\n", "Pointer to raw data", WIDTH, section.pointerto_raw_data())
<< format("{:{}} [0x{:08x}, 0x{:08x}]\n", "Range", WIDTH,
<< fmt::format("{:{}} 0x{:x}\n", "Size of raw data", WIDTH, section.sizeof_raw_data())
<< fmt::format("{:{}} 0x{:x}\n", "Pointer to raw data", WIDTH, section.pointerto_raw_data())
<< fmt::format("{:{}} [0x{:08x}, 0x{:08x}]\n", "Range", WIDTH,
section.pointerto_raw_data(), section.pointerto_raw_data() + section.sizeof_raw_data())
<< format("{:{}} 0x{:x}\n", "Pointer to relocations", WIDTH, section.pointerto_relocation())
<< format("{:{}} 0x{:x}\n", "Pointer to line numbers", WIDTH, section.pointerto_line_numbers())
<< format("{:{}} 0x{:x}\n", "Number of relocations", WIDTH, section.numberof_relocations())
<< format("{:{}} 0x{:x}\n", "Number of lines", WIDTH, section.numberof_line_numbers())
<< format("{:{}} {}", "Characteristics", WIDTH, join(list_str, ", "));
<< fmt::format("{:{}} 0x{:x}\n", "Pointer to relocations", WIDTH, section.pointerto_relocation())
<< fmt::format("{:{}} 0x{:x}\n", "Pointer to line numbers", WIDTH, section.pointerto_line_numbers())
<< fmt::format("{:{}} 0x{:x}\n", "Number of relocations", WIDTH, section.numberof_relocations())
<< fmt::format("{:{}} 0x{:x}\n", "Number of lines", WIDTH, section.numberof_line_numbers())
<< fmt::format("{:{}} {}", "Characteristics", WIDTH, characteristics_joined);
return os;
}

Expand Down