aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ModuleSymbolTable.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@chromium.org>2020-06-30 12:48:10 +0200
committerHans Wennborg <hans@chromium.org>2020-07-01 09:43:45 +0200
commita8e582c8307ba1d33c05d272b5c1b755fa809b51 (patch)
tree4342a71d7f6efb840cddab7a38fdad4dc1434942 /llvm/lib/Object/ModuleSymbolTable.cpp
parent91823163955859abbdcad5901d765aeae860939e (diff)
downloadllvm-a8e582c8307ba1d33c05d272b5c1b755fa809b51.zip
llvm-a8e582c8307ba1d33c05d272b5c1b755fa809b51.tar.gz
llvm-a8e582c8307ba1d33c05d272b5c1b755fa809b51.tar.bz2
[ThinLTO] Always parse module level inline asm with At&t dialect (PR46503)
clang-cl passes -x86-asm-syntax=intel to the cc1 invocation so that assembly listings produced by the /FA flag are printed in Intel dialect. That flag however should not affect the *parsing* of inline assembly in the program. (See r322652) When compiling normally, AsmPrinter::emitInlineAsm is used for assembling and defaults to At&t dialect. However, when compiling for ThinLTO, the code which parses module level inline asm to find symbols for the symbol table was failing to set the dialect. This patch fixes that. (See the bug for more details.) Differential revision: https://reviews.llvm.org/D82862
Diffstat (limited to 'llvm/lib/Object/ModuleSymbolTable.cpp')
-rw-r--r--llvm/lib/Object/ModuleSymbolTable.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Object/ModuleSymbolTable.cpp b/llvm/lib/Object/ModuleSymbolTable.cpp
index 45bcf74..7f3055b 100644
--- a/llvm/lib/Object/ModuleSymbolTable.cpp
+++ b/llvm/lib/Object/ModuleSymbolTable.cpp
@@ -23,6 +23,7 @@
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -116,6 +117,10 @@ initializeRecordStreamer(const Module &M,
if (!TAP)
return;
+ // Module-level inline asm is assumed to use At&t syntax (see
+ // AsmPrinter::doInitialization()).
+ Parser->setAssemblerDialect(InlineAsm::AD_ATT);
+
Parser->setTargetParser(*TAP);
if (Parser->Run(false))
return;