mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2026-04-28 21:12:24 +00:00
Warn if an STT_FUNC has zero size.
This commit is contained in:
parent
ba4aede49c
commit
ce7402cf78
1 changed files with 7 additions and 3 deletions
10
src/main.cpp
10
src/main.cpp
|
|
@ -732,7 +732,7 @@ bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, EL
|
|||
continue;
|
||||
}
|
||||
|
||||
if (section_index < context.sections.size()) {
|
||||
if (section_index < context.sections.size()) {
|
||||
// Check if this symbol is the entrypoint
|
||||
if (has_entrypoint && value == entrypoint && type == ELFIO::STT_FUNC) {
|
||||
if (found_entrypoint_func) {
|
||||
|
|
@ -795,13 +795,17 @@ bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, EL
|
|||
}
|
||||
}
|
||||
|
||||
if (!ignored && type == ELFIO::STT_FUNC && num_instructions == 0 && bind != ELFIO::STB_WEAK) {
|
||||
fmt::print(stderr, "[WARN] Function '{}' has zero size.\n", name);
|
||||
}
|
||||
|
||||
// Suffix local symbols to prevent name conflicts.
|
||||
if (bind == ELFIO::STB_LOCAL) {
|
||||
name = fmt::format("{}_{:08X}", name, rom_address);
|
||||
}
|
||||
|
||||
|
||||
if (num_instructions > 0) {
|
||||
context.section_functions[section_index].push_back(context.functions.size());
|
||||
context.section_functions[section_index].push_back(context.functions.size());
|
||||
recorded_symbol = true;
|
||||
}
|
||||
context.functions_by_name[name] = context.functions.size();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue