This is an archive of the discontinued LLVM Phabricator instance.

[X86] [ASM INTEL SYNTAX] fix for incorrect assembler code generation when x86-asm-syntax=intel (PR34617)
ClosedPublic

Authored by kbelochapka on Sep 15 2017, 6:51 PM.

Details

Summary

fix for incorrect code generation when x86-asm-syntax=intel

Diff Detail

Event Timeline

kbelochapka created this revision.Sep 15 2017, 6:51 PM
This revision is now accepted and ready to land.Sep 25 2017, 10:29 AM
This revision was automatically updated to reflect the committed changes.
coby added a reviewer: coby.Sep 25 2017, 12:46 PM
coby edited edge metadata.EditedSep 25 2017, 12:58 PM

suggested change will work fine if one is to solely consider masm / gas, as llvm's (x86) integrated assembler is yet to be introduced to the 'offset' keyword (handle it partially and falsely as part of inline-asm only).
for example, the following (dumb) snippet:

void *f() {
  return "";
}

under clang -cc1 -S -mllvm -x86-asm-syntax=intel -mrelocation-model static will produce the following asm (amongst other boilerplate):

movabs  rax, offset .L.str

which in turn, under clang -cc1as will yield:

error: cannot use more than one symbol in memory operand

see D37461 for a comprehensive proposal, which answers PR34617 as well