coff: collect Data/Text symbols with Unknown section as extern names

The previous commit routed these symbols through the externs table,
but they were never added to the table, causing warnings like:

  coff: reloc: failed to find extern: __cxa_pure_virtual

Extend get_coff_extern_names to also collect Data/Text symbols with
Unknown sections, so weak externals get assigned entries in the UNDEF
section and resolve correctly.
This commit is contained in:
vee1e 2026-06-18 17:07:11 +05:30
parent b9cf3adbc8
commit 273bf04377
No known key found for this signature in database
GPG key ID: EB498AFC60A7A01A

View file

@ -334,7 +334,9 @@ fn get_coff_extern_names(obj: &object::File) -> BTreeSet<String> {
match (symbol.kind(), symbol.section()) {
(
object::SymbolKind::Data | object::SymbolKind::Text,
object::SymbolSection::Undefined | object::SymbolSection::Common,
object::SymbolSection::Undefined
| object::SymbolSection::Common
| object::SymbolSection::Unknown,
) => {
debug!("coff: reloc: extern: symbol: {}", name);
externs.insert(name.to_string());