[llvm] c5d3892 - [XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 12:02:38 PDT 2020


Author: Fangrui Song
Date: 2020-04-21T12:02:29-07:00
New Revision: c5d38924dc6688c15b3fa133abeb3626e8f0767c

URL: https://github.com/llvm/llvm-project/commit/c5d38924dc6688c15b3fa133abeb3626e8f0767c
DIFF: https://github.com/llvm/llvm-project/commit/c5d38924dc6688c15b3fa133abeb3626e8f0767c.diff

LOG: [XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations

In a future change we should properly fix xray_fn_idx to use PC-relative
addresses as well, but for now let's keep absolute addresses until sled
addresses are all fixed.

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/test/DebugInfo/X86/xray-split-dwarf-interaction.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 1204eec776f5..9c9cafe029dc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -3217,7 +3217,7 @@ void AsmPrinter::emitXRayTable() {
                                        Flags, 0, GroupName,
                                        MCSection::NonUniqueID, LinkedToSym);
     FnSledIndex = OutContext.getELFSection("xray_fn_idx", ELF::SHT_PROGBITS,
-                                           Flags, 0, GroupName,
+                                           Flags | ELF::SHF_WRITE, 0, GroupName,
                                            MCSection::NonUniqueID, LinkedToSym);
   } else if (MF->getSubtarget().getTargetTriple().isOSBinFormatMachO()) {
     InstMap = OutContext.getMachOSection("__DATA", "xray_instr_map", 0,

diff  --git a/llvm/test/DebugInfo/X86/xray-split-dwarf-interaction.ll b/llvm/test/DebugInfo/X86/xray-split-dwarf-interaction.ll
index 404bb4b63215..14a44143a419 100644
--- a/llvm/test/DebugInfo/X86/xray-split-dwarf-interaction.ll
+++ b/llvm/test/DebugInfo/X86/xray-split-dwarf-interaction.ll
@@ -25,7 +25,7 @@
 ; `a::b()` is actually associated with the function's symbol instead of the
 ; .debug_types.dwo section.
 ;
-; CHECK-ASM: xray_fn_idx,"ao", at progbits,_ZN1a1bEv{{$}}
+; CHECK-ASM: xray_fn_idx,"awo", at progbits,_ZN1a1bEv{{$}}
 ;
 ; CHECK-ELF-DAG: [[FSECT:[0-9]+]]] .text._ZN1a1bEv PROGBITS
 ; CHECK-ELF-DAG: [{{.*}}] .debug_types.dwo PROGBITS


        


More information about the llvm-commits mailing list