mirror of
https://github.com/rui314/mold.git
synced 2024-09-11 13:06:59 +03:00
temporary
This commit is contained in:
parent
e155d5ea3d
commit
af7a2a1544
31
mapfile.cc
31
mapfile.cc
@ -1,8 +1,7 @@
|
||||
#include "mold.h"
|
||||
|
||||
#include "llvm/Support/Format.h"
|
||||
|
||||
using namespace llvm;
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
|
||||
void print_map() {
|
||||
// Construct a section-to-symbol map.
|
||||
@ -12,30 +11,28 @@ void print_map() {
|
||||
if (sym->file == file && sym->input_section)
|
||||
map.insert({sym->input_section, sym});
|
||||
|
||||
llvm::outs() << " VMA Size Align Out In Symbol\n";
|
||||
std::cout << " VMA Size Align Out In Symbol\n";
|
||||
for (OutputChunk *osec : out::chunks) {
|
||||
llvm::outs() << format("%16llx %8llx %5lld ",
|
||||
(u64)osec->shdr.sh_addr,
|
||||
(u64)osec->shdr.sh_size,
|
||||
(u64)osec->shdr.sh_addralign)
|
||||
<< osec->name << "\n";
|
||||
std::cout << std::setw(16) << (u64)osec->shdr.sh_addr
|
||||
<< std::setw(8) << (u64)osec->shdr.sh_size
|
||||
<< std::setw(5) << (u64)osec->shdr.sh_addralign
|
||||
<< " " << osec->name << "\n";
|
||||
|
||||
if (osec->kind != OutputChunk::REGULAR)
|
||||
continue;
|
||||
|
||||
for (InputChunk *mem : ((OutputSection *)osec)->members) {
|
||||
llvm::outs() << format("%16llx %8llx %5lld ",
|
||||
osec->shdr.sh_addr + mem->offset,
|
||||
(u64)mem->shdr.sh_size,
|
||||
(u64)mem->shdr.sh_addralign)
|
||||
<< toString(mem) << "\n";
|
||||
std::cout << std::setw(16) << (osec->shdr.sh_addr + mem->offset)
|
||||
<< std::setw(8) << (u64)mem->shdr.sh_size
|
||||
<< std::setw(5) << (u64)mem->shdr.sh_addralign
|
||||
<< " " << toString(mem) << "\n";
|
||||
|
||||
auto range = map.equal_range(mem);
|
||||
for (auto it = range.first; it != range.second; ++it) {
|
||||
Symbol *sym = it->second;
|
||||
llvm::outs()
|
||||
<< format("%16llx %8llx %5lld ", sym->get_addr(), 0, 0)
|
||||
<< sym->name << "\n";
|
||||
std::cout << std::setw(16) << sym->get_addr()
|
||||
<< " 0 0 "
|
||||
<< sym->name << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
mold.h
5
mold.h
@ -19,6 +19,7 @@
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <span>
|
||||
#include <string>
|
||||
@ -73,7 +74,7 @@ inline Config config;
|
||||
[[noreturn]] inline void error(std::string msg) {
|
||||
static std::mutex mu;
|
||||
std::lock_guard lock(mu);
|
||||
llvm::errs() << msg << "\n";
|
||||
std::cerr << msg << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -1149,7 +1150,7 @@ inline Symbol *_edata;
|
||||
inline void message(std::string msg) {
|
||||
static std::mutex mu;
|
||||
std::lock_guard lock(mu);
|
||||
llvm::outs() << msg << "\n";
|
||||
std::cout << msg << "\n";
|
||||
}
|
||||
|
||||
inline std::string toString(Symbol sym) {
|
||||
|
5
perf.cc
5
perf.cc
@ -1,5 +1,8 @@
|
||||
#include "mold.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
std::vector<Counter *> Counter::instances;
|
||||
@ -15,5 +18,5 @@ void Counter::print() {
|
||||
});
|
||||
|
||||
for (Counter *c : vec)
|
||||
llvm::outs() << right_justify(c->name, 20) << "=" << c->value << "\n";
|
||||
std::cout << std::setw(20) << std::right << c->name << "=" << c->value << "\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user