mirror of
https://github.com/rui314/mold.git
synced 2024-11-11 16:58:12 +03:00
temporary
This commit is contained in:
parent
b7646b1441
commit
500621484d
11
mold.h
11
mold.h
@ -484,14 +484,6 @@ struct ComdatGroup {
|
||||
u32 section_idx;
|
||||
};
|
||||
|
||||
struct StringPiece {
|
||||
StringPiece(StringRef data) : data(data) {}
|
||||
StringPiece(const StringPiece &other) : data(other.data) {}
|
||||
|
||||
StringRef data;
|
||||
std::atomic_flag flag = ATOMIC_FLAG_INIT;
|
||||
};
|
||||
|
||||
class ObjectFile {
|
||||
public:
|
||||
ObjectFile(MemoryBufferRef mb, StringRef archive_name);
|
||||
@ -541,13 +533,10 @@ private:
|
||||
void initialize_symbols();
|
||||
void maybe_override_symbol(const ELF64LE::Sym &esym, Symbol &sym);
|
||||
void remove_comdat_members(u32 section_idx);
|
||||
void read_string_pieces(const ELF64LE::Shdr &shdr);
|
||||
void write_symtab(u8 *buf, u64 symtab_off, u64 strtab_off, u32 start, u32 end);
|
||||
|
||||
MemoryBufferRef mb;
|
||||
std::vector<std::pair<ComdatGroup *, u32>> comdat_groups;
|
||||
std::vector<StringPiece *> merged_strings_alloc;
|
||||
std::vector<StringPiece *> merged_strings_noalloc;
|
||||
|
||||
std::vector<Symbol> local_symbols;
|
||||
int first_global = 0;
|
||||
|
@ -157,34 +157,6 @@ void ObjectFile::remove_comdat_members(u32 section_idx) {
|
||||
sections[i] = nullptr;
|
||||
}
|
||||
|
||||
void ObjectFile::read_string_pieces(const ELF64LE::Shdr &shdr) {
|
||||
static ConcurrentMap<StringPiece> map1;
|
||||
static ConcurrentMap<StringPiece> map2;
|
||||
|
||||
bool is_alloc = shdr.sh_type & SHF_ALLOC;
|
||||
ConcurrentMap<StringPiece> &map = is_alloc ? map1 : map2;
|
||||
|
||||
ArrayRef<u8> arr = CHECK(obj.getSectionContents(shdr), this);
|
||||
StringRef data((const char *)&arr[0], arr.size());
|
||||
|
||||
while (!data.empty()) {
|
||||
size_t end = data.find('\0');
|
||||
if (end == StringRef::npos)
|
||||
error(toString(this) + ": string is not null terminated");
|
||||
|
||||
StringRef substr = data.substr(0, end + 1);
|
||||
StringPiece *piece = map.insert(substr, StringPiece(substr));
|
||||
|
||||
if (is_alloc)
|
||||
merged_strings_alloc.push_back(piece);
|
||||
else
|
||||
merged_strings_noalloc.push_back(piece);
|
||||
|
||||
data = data.substr(end + 1);
|
||||
// num_string_pieces++;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectFile::parse() {
|
||||
is_dso = (identify_magic(mb.getBuffer()) == file_magic::elf_shared_object);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user