mirror of
https://github.com/rui314/mold.git
synced 2024-09-20 09:27:45 +03:00
Simplify
This commit is contained in:
parent
4327d4547e
commit
3e818cd350
@ -58,9 +58,18 @@ ElfShdr<E> *InputFile<E>::find_section(i64 type) {
|
||||
|
||||
template <typename E>
|
||||
void InputFile<E>::clear_symbols() {
|
||||
for (Symbol<E> *sym : get_global_syms())
|
||||
if (__atomic_load_n(&sym->file, __ATOMIC_RELAXED) == this)
|
||||
sym->clear();
|
||||
for (Symbol<E> *sym : get_global_syms()) {
|
||||
if (__atomic_load_n(&sym->file, __ATOMIC_ACQUIRE) == this) {
|
||||
sym->origin = 0;
|
||||
sym->value = -1;
|
||||
sym->sym_idx = -1;
|
||||
sym->ver_idx = 0;
|
||||
sym->is_weak = false;
|
||||
sym->is_imported = false;
|
||||
sym->is_exported = false;
|
||||
__atomic_store_n(&sym->file, nullptr, __ATOMIC_RELEASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find the source filename. It should be listed in symtab as STT_FILE.
|
||||
|
13
elf/mold.h
13
elf/mold.h
@ -1987,7 +1987,6 @@ public:
|
||||
i64 get_output_sym_idx(Context<E> &ctx) const;
|
||||
const ElfSym<E> &esym() const;
|
||||
void add_aux(Context<E> &ctx);
|
||||
void clear();
|
||||
|
||||
// A symbol is owned by a file. If two or more files define the
|
||||
// same symbol, the one with the strongest definition owns the symbol.
|
||||
@ -2787,18 +2786,6 @@ inline void Symbol<E>::add_aux(Context<E> &ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
inline void Symbol<E>::clear() {
|
||||
file = nullptr;
|
||||
origin = 0;
|
||||
value = -1;
|
||||
sym_idx = -1;
|
||||
ver_idx = 0;
|
||||
is_weak = false;
|
||||
is_imported = false;
|
||||
is_exported = false;
|
||||
}
|
||||
|
||||
inline bool is_c_identifier(std::string_view s) {
|
||||
if (s.empty())
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user