This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Remove rsp from the clobber list in internal_clone
ClosedPublic

Authored by cryptoad on Aug 9 2018, 10:17 AM.

Details

Summary

When compiling with WERROR=ON, a new fatal warning started popping up recently
(due to -Werror,-Winline-asm):

.../lib/sanitizer_common/sanitizer_linux.cc:1214:24: error: inline asm clobber list contains reserved registers: RSP [-Werror,-Winline-asm]
                       "syscall\n"
                       ^
<inline asm>:1:1: note: instantiated into assembly here
        syscall
^
.../lib/sanitizer_common/sanitizer_linux.cc:1214:24: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
                       "syscall\n"
                       ^
<inline asm>:1:1: note: instantiated into assembly here
        syscall
^

Removing rsp from the clobber list makes the warning go away, and does not
appear to have a functional impact. If there is another way to solve this, let
me know.

Diff Detail

Event Timeline

cryptoad created this revision.Aug 9 2018, 10:17 AM
eugenis accepted this revision.Aug 9 2018, 12:01 PM

Hmm, I don't see how this assembly clobbers rsp.
If it did, then "return res" after it would not really work.

This revision is now accepted and ready to land.Aug 9 2018, 12:01 PM
This revision was automatically updated to reflect the committed changes.