[llvm] [X86] Print 'l' section flag for SHF_X86_64_LARGE (PR #70380)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 26 14:04:42 PDT 2023
https://github.com/aeubanks created https://github.com/llvm/llvm-project/pull/70380
When directly compiling to an object file we properly set the section flag, but not when emitting assembly.
>From 96ed091974d0c6bad5e86262c424b128459a8323 Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Thu, 26 Oct 2023 14:01:43 -0700
Subject: [PATCH] [X86] Print 'l' section flag for SHF_X86_64_LARGE
When directly compiling to an object file we properly set the section flag, but not when emitting assembly.
---
llvm/lib/MC/MCSectionELF.cpp | 3 +++
llvm/test/CodeGen/X86/code-model-elf-sections.ll | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 666252ffcb74eb3..95fdf33522076e4 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -123,6 +123,9 @@ void MCSectionELF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
} else if (Arch == Triple::hexagon) {
if (Flags & ELF::SHF_HEX_GPREL)
OS << 's';
+ } else if (Arch == Triple::x86_64) {
+ if (Flags & ELF::SHF_X86_64_LARGE)
+ OS << 'l';
}
OS << '"';
diff --git a/llvm/test/CodeGen/X86/code-model-elf-sections.ll b/llvm/test/CodeGen/X86/code-model-elf-sections.ll
index fe659fa9a46e727..e09e145b3f47b72 100644
--- a/llvm/test/CodeGen/X86/code-model-elf-sections.ll
+++ b/llvm/test/CodeGen/X86/code-model-elf-sections.ll
@@ -16,6 +16,8 @@
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=large -data-sections -o %t
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SMALL-DS
+; RUN: llc < %s -relocation-model=pic -filetype=asm -code-model=medium -large-data-threshold=79 -o - | FileCheck %s --check-prefix=LARGE-ASM
+
; SMALL: .data {{.*}} WA {{.*}}
; SMALL: foo {{.*}} WA {{.*}}
; SMALL: .bss {{.*}} WA {{.*}}
@@ -48,6 +50,8 @@
; LARGE-DS: .tbss.tbss {{.*}} WAT {{.*}}
; LARGE-DS: .tdata.tdata {{.*}} WAT {{.*}}
+; LARGE-ASM: .lrodata,"al"
+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64--linux"
More information about the llvm-commits
mailing list