1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-11-05 12:34:59 +09:00
parent 99d57805dc
commit ab517ea1ee
3 changed files with 8 additions and 12 deletions

View File

@ -675,10 +675,10 @@ int main(int argc, char **argv) {
// Set priorities to files
int priority = 1;
for (ObjectFile *file : files)
if (!file->is_in_archive())
if (!file->is_in_archive)
file->priority = priority++;
for (ObjectFile *file : files)
if (file->is_in_archive())
if (file->is_in_archive)
file->priority = priority++;
// Resolve symbols
@ -690,7 +690,7 @@ int main(int argc, char **argv) {
// Resolve symbols
std::vector<ObjectFile *> objs;
for (ObjectFile *file : files)
if (!file->is_in_archive())
if (!file->is_in_archive)
objs.push_back(file);
// Mark archive members we include into the final output.

3
mold.h
View File

@ -503,8 +503,6 @@ public:
void write_local_symtab(u8 *buf, u64 symtab_off, u64 strtab_off);
void write_global_symtab(u8 *buf, u64 symtab_off, u64 strtab_off);
bool is_in_archive();
static ObjectFile *create_internal_file(ArrayRef<OutputChunk *> output_chunks);
std::vector<InputSection *> sections;
@ -515,6 +513,7 @@ public:
u32 priority;
std::atomic_bool is_alive = ATOMIC_VAR_INIT(false);
bool is_dso;
const bool is_in_archive;
std::string name;
u64 local_symtab_size = 0;

View File

@ -9,7 +9,8 @@ using namespace llvm::ELF;
ObjectFile::ObjectFile(MemoryBufferRef mb, StringRef archive_name)
: mb(mb), name(mb.getBufferIdentifier()), archive_name(archive_name),
obj(check(ELFFile<ELF64LE>::create(mb.getBuffer()))) {}
obj(check(ELFFile<ELF64LE>::create(mb.getBuffer()))),
is_in_archive(archive_name != "") {}
static const ELF64LE::Shdr
*findSection(ArrayRef<ELF64LE::Shdr> sections, u32 type) {
@ -242,7 +243,7 @@ void ObjectFile::resolve_symbols() {
if (UNLIKELY(sym.traced && sym.file == this))
llvm::outs() << "trace: " << toString(sym.file)
<< (is_in_archive() ? ": lazy definition of " : ": definition of ")
<< (is_in_archive ? ": lazy definition of " : ": definition of ")
<< sym.name << "\n";
}
}
@ -264,7 +265,7 @@ ObjectFile::mark_live_archive_members(tbb::parallel_do_feeder<ObjectFile *> &fee
<< ": reference to " << sym.name << "\n";
if (esym.getBinding() != STB_WEAK && sym.file &&
sym.file->is_in_archive() && !sym.file->is_alive) {
sym.file->is_in_archive && !sym.file->is_alive) {
feeder.add(sym.file);
static Counter counter("undefined_syms");
@ -437,10 +438,6 @@ void ObjectFile::write_global_symtab(u8 *buf, u64 symtab_off, u64 strtab_off) {
write_symtab(buf, symtab_off, strtab_off, first_global, elf_syms.size());
}
bool ObjectFile::is_in_archive() {
return !archive_name.empty();
}
bool is_c_identifier(StringRef name) {
if (name == "")
return false;