forked from CTSRD-CHERI/cheribsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rtld: Add missing "memory" clobbers to prevent reordering
I was only testing a -O0 rtld so the inline assembly happened to work. However, at -O2 the compiler is free to reorder instruction before/after the inline asm (including the restore of $cgp after a function call). This was causing the rtld $cgp to be re-installed after the inline asm so the function calls would then crash due to a wrong $cgp. Using "memory" clobbers should fix this issue but for the two cases the return the target function pointer it would be much nicer if we could just return "target+cgp" in $c3/$c4 instead of having to use an on-stack output argument. See CTSRD-CHERI/llvm-project#326
- Loading branch information
1 parent
40d6ef0
commit 27a5191
Showing
3 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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