Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Implement PInvoke Unix asm helpers - #1323

Merged
janvorli merged 1 commit into
dotnet:masterfrom
jkotas:unix-pinvoke-helpers
May 26, 2016
Merged

janvorli merged 1 commit into
dotnet:masterfrom
jkotas:unix-pinvoke-helpers

Conversation

@jkotas

@jkotas jkotas commented May 26, 2016

Copy link
Copy Markdown
Member

No description provided.

@jkotas

jkotas commented May 26, 2016

Copy link
Copy Markdown
Member Author

@janvorli PTLA

movq _tls_CurrentThread@TLVP(%rip), %rdi
callq *(%rdi)
#else
leaq tls_CurrentThread@TLSLD(%rip), %rdi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that we are hardcoding support of only the Local Dynamic TLS model. Since the runtime is used as a static lib that can be linked into any kind of executable, I wonder how to support the other models, e.g. the Initial Exe one. Maybe we should later build separate version of the static lib for each (or subset of) model?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ELF loader will patch this with mov from fs and no-ops. There is no actual call here if you step through this code when it is statically linked into main executable. We could have a separate build flavors, but I doubt that it is worth it to save a few no-ops.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, cool. I didn't know the loader is able to recognize the code sequence.

@janvorli

Copy link
Copy Markdown
Member

LGTM

@janvorli
janvorli merged commit d88b465 into dotnet:master May 26, 2016
@jkotas
jkotas deleted the unix-pinvoke-helpers branch May 31, 2016 14:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants