OSDN Git Service

[XRay] Use wordsize-dependent alignment for index
authorDean Michael Berris <dberris@google.com>
Thu, 4 May 2017 04:55:46 +0000 (04:55 +0000)
committerDean Michael Berris <dberris@google.com>
Thu, 4 May 2017 04:55:46 +0000 (04:55 +0000)
This makes it simpler for the runtime to consistently handle the entries
in the function sled index in both 32 and 64 bit platforms where the
XRay runtime works.

Follow-up on D32693.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302111 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index 7f38c27..7ddb86d 100644 (file)
@@ -2811,10 +2811,10 @@ void AsmPrinter::emitXRayTable() {
 
   // We then emit a single entry in the index per function. We use the symbols
   // that bound the instrumentation map as the range for a specific function.
-  // Each entry here will be 16-byte aligned, as we're writing down two
-  // pointers.
+  // Each entry here will be 2 * word size aligned, as we're writing down two
+  // pointers. This should work for both 32-bit and 64-bit platforms.
   OutStreamer->SwitchSection(FnSledIndex);
-  OutStreamer->EmitCodeAlignment(16);
+  OutStreamer->EmitCodeAlignment(2 * WordSizeBytes);
   OutStreamer->EmitLabel(IdxRef);
   OutStreamer->EmitSymbolValue(SledsStart, WordSizeBytes);
   OutStreamer->EmitSymbolValue(SledsEnd, WordSizeBytes);