TLS program header is not correctly generated for zero-initialized tls variables#1788
Draft
ostylk wants to merge 2 commits intowild-linker:mainfrom
Draft
TLS program header is not correctly generated for zero-initialized tls variables#1788ostylk wants to merge 2 commits intowild-linker:mainfrom
ostylk wants to merge 2 commits intowild-linker:mainfrom
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.
I noticed the tls-common test failed on my machine depending on which environment and versions of compilers I used. It seems like the
TLSprogram header is generated incorrectly for zero initialized tls variables.E.g. in the tls-common we have a variable
tvarthat is in.tbss. However, the TLS program header isfilesz=4,memsz=4which doesn't zero-initialize it but loads bytes from the elf binary. It just so happens that all CIs and your local setup contained zeros in the binary at the exact place for this to nevertheless work. The correct TLS program header would befilesz=0,memsz=4.So this pull request does/will do two things:
//#ExpectProgramHeader:PT_TLS filesz=0,memsz=4and it will only accept if a program header with at least these properties exists.This is a draft because the test option still needs documentation and I haven't found the bug yet and holidays are starting. So I'll complete it at a later time.