Skip to content

partly fix Issue 9378 - SHA1 asm not PIC compatible#4994

Merged
MartinNowak merged 1 commit intodlang:stablefrom
MartinNowak:fix9378
Dec 24, 2016
Merged

partly fix Issue 9378 - SHA1 asm not PIC compatible#4994
MartinNowak merged 1 commit intodlang:stablefrom
MartinNowak:fix9378

Conversation

@MartinNowak
Copy link
Member

@MartinNowak MartinNowak commented Dec 24, 2016

  • access SHA1 constants through extra register in x64 code
  • tried same for x86 (several hours) but there is no register left and
    loading constants via stack was way too slow
  • little to no interest in x86 PIC code, as the platform is almost dead, and PIC is too slow on x86 anyhow

Roughly 10x faster (now also with shared phobos library).
Prerequisite to fix Issue 16794 – .deb not working on Ubuntu 16.10 because of default PIE linking.

- access SHA1 constants through extra register in x64 code
- tried same for x86 but there is no register left and
  loading constants via stack was way too slow
@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
9378 std.internal.digest.sha_SSE3 breaks if compiled with PIC

Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

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

thanks for working on this

transformSSSE3(state, block);
}
else
transformX86(state, block);
Copy link
Member

Choose a reason for hiding this comment

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

shoud we worry that this is not covered?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's run as part of the 32-bit shared library test suite (b/c that is still PIC incompatible).

/* The round constants. */
align(16) private immutable uint[16] constants =
/* The control words for the byte shuffle instruction and the round constants. */
align(16) public immutable uint[20] constants =
Copy link
Member

Choose a reason for hiding this comment

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

why public?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's passed to the asm function from std.digest.sha, because it's not possible to access globals in PIC code from asm. That's the fix!

@andralex
Copy link
Member

@MartinNowak ok feel free to merge over codecov's protests

@MartinNowak
Copy link
Member Author

Auto-merge toggled on

@MartinNowak MartinNowak merged commit d85b5e0 into dlang:stable Dec 24, 2016
@MartinNowak MartinNowak deleted the fix9378 branch December 24, 2016 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants