-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[MinGW] lld Segmentation fault when build mesa with cfguard #78619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-lld-coff Author: None (Andarwinux)
install llvm-mingw nightly
meson_cross.txt
|
Can you rerun the link command with Also, you say that the issue reproduces with the latest nightlies. Does this mean that it's a regression from the latest stable release, or did you only happen to test with a nightly? |
This doesn't seem to be a regression, the same thing happens with llvm17. |
Thanks! It turns out that the lld reproducer generation doesn’t work well here - we’re missing rewriting paths for the wholearchive options. That’s trivial to fix though, but after that, we run into the issue that some of the bundled archives are thin archives, which don’t work here (the repro file would need to contain the input loose object files for that archive, and possibly rewrite the thin archive). That’s not quite trivial to fix… I did manage to reproduce the issue myself by building mesa manually with the given instructions though.
Ok, thanks for checking! |
I've reduced the issue to the following minimal testcase: void weakfunc(void) __attribute__((weak));
typedef void (*funcptr)(void);
funcptr funcs[] = { weakfunc };
void entry(void) { } $ clang -target x86_64-windows-gnu -c weak-undef-addrtaken.c -mguard=cf
$ lld-link weak-undef-addrtaken.o -out:out.exe -subsystem:console -entry:entry -guard:cf
lld-link: /home/martin/code/llvm-project/llvm/include/llvm/Support/Casting.h:662: decltype(auto) llvm::dyn_cast(From *) [To = lld::coff::SectionChunk, From = lld::coff::Chunk]: Assertion `detail::isPresent(Val) && "dyn_cast on a non-existent value"' failed. |
When marking symbols as having their address taken, we can have the sitaution where we have the address taken of a weak symbol. If there's no strong definition of the symbol, the symbol ends up as an absolute symbol with the value null. In those cases, we don't have any Chunk. Skip such symbols from the cfguard tables. This fixes llvm#78619.
I posted a PR that fixes this at #79063. |
) When marking symbols as having their address taken, we can have the sitaution where we have the address taken of a weak symbol. If there's no strong definition of the symbol, the symbol ends up as an absolute symbol with the value null. In those cases, we don't have any Chunk. Skip such symbols from the cfguard tables. This fixes #78619.
Uh oh!
There was an error while loading. Please reload this page.
install llvm-mingw nightly
meson_cross.txt
The text was updated successfully, but these errors were encountered: