Merge topic 'AutoExport-vftable' into release-3.31

41ff2916f2 WINDOWS_EXPORT_ALL_SYMBOLS: Fix vftable symbol export on ARM64EC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Shijun zhang <1018423405@qq.com>
Merge-request: !10187
This commit is contained in:
Brad King
2025-01-20 19:12:20 +00:00
committed by Kitware Robot

View File

@@ -298,15 +298,20 @@ public:
symbol.find("$entry_thunk") == std::string::npos &&
symbol.find("$iexit_thunk") == std::string::npos &&
symbol.find("$exit_thunk") == std::string::npos)) {
if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
// Read only (i.e. constants) must be excluded
if ((!pSymbolTable->Type &&
// Read only (i.e. constants) must be excluded
(SectChar & IMAGE_SCN_MEM_WRITE)) ||
(this->SymbolArch == Arch::ARM64EC &&
// vftable symbols are DATA on ARM64EC
symbol.compare(0, 4, vftablePrefix) == 0)) {
this->DataSymbols.insert(symbol);
} else {
if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) ||
(SectChar & IMAGE_SCN_MEM_EXECUTE) ||
(symbol.compare(0, 4, vftablePrefix) == 0)) {
this->Symbols.insert(symbol);
}
} else if (pSymbolTable->Type ||
!(SectChar & IMAGE_SCN_MEM_READ) ||
(SectChar & IMAGE_SCN_MEM_EXECUTE) ||
(this->SymbolArch != Arch::ARM64EC &&
// vftable symbols fail if marked as DATA
symbol.compare(0, 4, vftablePrefix) == 0)) {
this->Symbols.insert(symbol);
}
}
}