llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.16k stars 12.03k forks source link

llvm-strip.exe error: unexpected associative section index #53433

Open encelo opened 2 years ago

encelo commented 2 years ago

I'm the developer of nCine, a cross-platform 2D game framework that is constantly built by GitHub Actions using different compilers, on different platforms.

Since some months there is a combination in the test matrix that it consistently failing: when I compile my project on MSYS2 using clang then I have a strange issue with llvm-strip.

The error message is: C:\msys64\mingw64\bin/llvm-strip.exe: error: 'D:/a/nCine/nCine-build-DevDist/libncine.dll': unexpected associative section index. Basically my library cannot be stripped for some reason and this was not happening some months ago.

I can reproduce the issue on my machine with MSYS2 installed and Clang 13, it is not a GitHub Actions runner only issue.

llvmbot commented 2 years ago

@llvm/issue-subscribers-tools-llvm-objcopy-strip

belmeopmenieuwesim commented 2 years ago

This is still an issue today. Even on LLVM version 14.0

belmeopmenieuwesim commented 2 years ago

I found something that may be of value. It appears that this error is triggered when PointerToSymbolTable is set in the PE IMAGE_FILE_HEADER. If this is zeroed out, then llvm-strip will work fine. Hope this helps...

A temporary fix would be also to compile with the linker flag --discard-all, since it will avoid populating PointerToSymbolTable.

@MaskRay maybe you know a way to solve this in llvm-strip?