Steps to reproduce on Windows:
test.c
#pragma comment(linker, "/alternatename:x=y")
#pragma comment(linker, "/alternatename:y=puts")
extern int x(const char *str);
int main(void) {
x("Hello");
return 0;
}
Compile and link:
clang-cl /c test.c
lld-link /OUT:test.exe /SUBSYSTEM:console test.obj
It works with lld-link <=20 and MS link.exe, but fails with lld-link 21.1.1:
lld-link: error: undefined symbol: x
>>> referenced by test.obj:(main)
I think it's caused by this commit: ac31d64. If I roll back that commit for SymbolTable.cpp, linking succeeds again.