Repository navigation
5.8.3.1: the module reads lzma.h as the static library it links (LZMA_API_STATIC) - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
compat.xz is a static library. On Windows
lzma.hdeclares every function imported from a DLL unlessLZMA_API_STATICis defined, and the module's units read it without: a program that imports the module calls through__imp_lzma_*. No DLL provides those, so lld-link makes a slot of its own for each, and it does not count such a slot as a reference. In a link that collects unreferenced sections (-ffunction-sections, the release profile) the functions are dropped and each slot holds the image's first byte.Found in mcpp:
mcpp pack --compress xz:<level>and its unit test faulted on Windows (EXCEPTION_ACCESS_VIOLATION at the image base) once its dependency objects were rebuilt; the link's map names the five slots,__imp_lzma_end,__imp_lzma_code,__imp_lzma_easy_buffer_encode,__imp_lzma_stream_decoder,__imp_lzma_stream_buffer_bound.tools/surface.tomlstatesdefines = ["LZMA_API_STATIC"]; the generator writes it beforelzma.hin both module units, intests/macros.cppand in<mwrap/xz/macros.hpp>, which a unit that includeslzma.hitself includes first.tests/linked.cppreads that the functions are not at one address: slots whose functions were dropped all hold the same one, which is not null.docs/usage.md: what a unit that includeslzma.hbeside the module states.The version is a wrapper revision of upstream 5.8.3 (mcpp-index docs/mwrap.md).