mirror of
https://github.com/rui314/mold.git
synced 2024-09-11 21:17:28 +03:00
[ELF][LTO] Recognize IR files generated by GCC 11
This commit is contained in:
parent
1dcd20b401
commit
c1963ce2ac
@ -251,8 +251,6 @@ static int phase = 0;
|
||||
|
||||
static void *dlopen_handle;
|
||||
static std::vector<PluginSymbol> plugin_symbols;
|
||||
static std::vector<std::unique_ptr<PluginInputFile>> plugin_files;
|
||||
|
||||
static ClaimFileHandler *claim_file_hook;
|
||||
static AllSymbolsReadHandler *all_symbols_read_hook;
|
||||
static CleanupHandler *cleanup_hook;
|
||||
@ -336,10 +334,6 @@ get_input_file(const void *handle, struct PluginInputFile *file) {
|
||||
template <typename E>
|
||||
static PluginStatus release_input_file(const void *handle) {
|
||||
LOG << "release_input_file\n";
|
||||
i64 idx = (i64)handle;
|
||||
if (idx < 0 || plugin_files.size() <= idx)
|
||||
return LDPS_BAD_HANDLE;
|
||||
close(plugin_files[idx]->fd);
|
||||
return LDPS_OK;
|
||||
}
|
||||
|
||||
|
@ -43,11 +43,14 @@ inline bool is_gcc_lto_obj(MappedFile<C> *mf) {
|
||||
std::span<ElfSym<E>> elf_syms{(ElfSym<E> *)(data + sec.sh_offset),
|
||||
sec.sh_size / sizeof(ElfSym<E>)};
|
||||
|
||||
auto skip = [](u8 type) {
|
||||
return type == STT_NOTYPE || type == STT_FILE || type == STT_SECTION;
|
||||
};
|
||||
|
||||
// GCC LTO object contains only sections symbols followed by a common
|
||||
// symbol whose name is `__gnu_lto_v1` or `__gnu_lto_slim`.
|
||||
i64 i = 1;
|
||||
while (i < elf_syms.size() &&
|
||||
(elf_syms[i].st_type == STT_FILE || elf_syms[i].st_type == STT_SECTION))
|
||||
while (i < elf_syms.size() && skip(elf_syms[i].st_type))
|
||||
i++;
|
||||
|
||||
if (i < elf_syms.size() && elf_syms[i].st_shndx == SHN_COMMON) {
|
||||
|
Loading…
Reference in New Issue
Block a user