Matthew DeVore has uploaded this change for review.

View Change

Specify & for inline asm output operands

According to inline asm documentation for GCC:

Means (in a particular alternative) that this operand is an
earlyclobber operand, which is written before the instruction is
finished using the input operands. Therefore, this operand may not lie
in a register that is read by the instruction or as part of any memory
address.

Source: https://gcc.gnu.org/onlinedocs/gcc/Modifiers.html

This applies to many of the inline assembly snippets in atomic_x86_64.h.

The output operand at %1 is often used as the destination operand in the
first instruction. This could clobber the register which stores the
pointer to %0, which will result in an illegal operation in the lock...
instruction later on.

I discovered this while trying to build and run on macOS. While this may
not be affecting any supported platforms, it could cause problems (an
illegal memory access) if the compiler behavior ever changes, so it's
probably best to fix it.

Change-Id: I13762d2ec11488b2a54472f0f5afe12ce0a3a0c9
Signed-off-by: Matthew DeVore <matvore@google.com>
---
M src/include/atomic_x86_64.h
1 file changed, 15 insertions(+), 15 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/62/502162/1

To view, visit change 502162. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I13762d2ec11488b2a54472f0f5afe12ce0a3a0c9
Gerrit-Change-Number: 502162
Gerrit-PatchSet: 1
Gerrit-Owner: Matthew DeVore <matvore@google.com>
Gerrit-MessageType: newchange