[clang] fe8eab4 - Add tests to verify behavior of .cfi_sections .debug_frame intrinsic.

2023-04-26 Thread Shubham Sandeep Rastogi via cfe-commits
Author: Shubham Sandeep Rastogi
Date: 2023-04-26T16:16:33-07:00
New Revision: fe8eab468eee18329922901bcf74310534e08b59

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

LOG: Add tests to verify behavior of .cfi_sections .debug_frame intrinsic.

There was some lacking test coverage for checking when the
.cfi_sections .debug_frame intrinsic is emitted. On x86_64,
with -fno-exceptions there is no .cfi_sections .debug_frame intrinsic
emitted because there is an unwind table attribute.

On AArch64, with -fno-exceptions, there is no unwind table attribute, so
the .cfi_sections .debug_frame intrinsic is emitted correctly.

Alternatively, with -fexceptions, both AArch64 and x86_64 emit an unwind
table and therefore do not emit a .cfi_sections .debug_frame intrinsic

All this work was done in addition to https://reviews.llvm.org/D139663
patch.

Differential Revision: https://reviews.llvm.org/D147747

Added: 
clang/test/Driver/test-uwtable.cpp
llvm/test/DebugInfo/AArch64/test-fexceptions-debug-frame.ll
llvm/test/DebugInfo/AArch64/test-fno-exceptions-debug-frame.ll
llvm/test/DebugInfo/X86/test-fexceptions-debug-frame.ll
llvm/test/DebugInfo/X86/test-fno-exceptions-debug-frame.ll

Modified: 


Removed: 




diff  --git a/clang/test/Driver/test-uwtable.cpp 
b/clang/test/Driver/test-uwtable.cpp
new file mode 100644
index 0..8498c68982a0c
--- /dev/null
+++ b/clang/test/Driver/test-uwtable.cpp
@@ -0,0 +1,26 @@
+// This test is added to provide test coverage for the uwtable attribute. It
+// aims to make sure that for an X86_64 output compiled with -fexceptions or
+//  -fno-exceptions, a uwtable attribute is emitted. However, for an AArch64
+//  output with -fexceptions a uwtable attribute is emitted, but with 
+// -fno-exceptions a uwtable attribute is not emitted.
+
+// RUN: %clang -g -fexceptions --target=x86_64-apple-darwin %s -S -emit-llvm 
-o - | FileCheck %s --check-prefix=X86_64_UWTABLE_EXCEPTIONS
+// X86_64_UWTABLE_EXCEPTIONS: attributes #0 = { {{.*}} uwtable
+// X86_64_UWTABLE_EXCEPTIONS: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 2}
+
+// RUN: %clang -g -fno-exceptions --target=x86_64-apple-darwin %s -S 
-emit-llvm -o - | FileCheck %s --check-prefix=X86_64_UWTABLE
+// X86_64_UWTABLE: attributes #0 = { {{.*}} uwtable
+// X86_64_UWTABLE: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 2}
+
+// RUN: %clang -g -fexceptions --target=arm64-apple-darwin %s -S -emit-llvm -o 
- | FileCheck %s --check-prefix=ARM64_UWTABLE_EXCEPTIONS
+// ARM64_UWTABLE_EXCEPTIONS: attributes #0 = { {{.*}} uwtable
+// ARM64_UWTABLE_EXCEPTIONS: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 1}
+
+// RUN: %clang -g -fno-exceptions --target=arm64-apple-darwin %s -S -emit-llvm 
-o - | FileCheck %s --check-prefix=ARM64_UWTABLE
+// ARM64_UWTABLE-NOT: attributes #0 = { {{.*}} uwtable
+// ARM64_UWTABLE-NOT: !{{[0-9]+}} = !{i32 7, !"uwtable", i32 2}
+// ARM64_UWTABLE: attributes #0 =
+
+int main() {
+return 1;
+}

diff  --git a/llvm/test/DebugInfo/AArch64/test-fexceptions-debug-frame.ll 
b/llvm/test/DebugInfo/AArch64/test-fexceptions-debug-frame.ll
new file mode 100644
index 0..6d6dcddd65cc0
--- /dev/null
+++ b/llvm/test/DebugInfo/AArch64/test-fexceptions-debug-frame.ll
@@ -0,0 +1,43 @@
+; This test is added to provide test coverage for the 
+; .cfi_sections .debug_frame intrinsic. It aims to make sure that for a AArch64
+; output compiled with -fexceptions, no .cfi_sections .debug_frame is emitted.
+
+; RUN: llc --filetype=asm %s -o - | FileCheck %s
+; CHECK-NOT: .cfi_sections .debug_frame
+; CHECK: .cfi_startproc
+
+
+; ModuleID = 'test.cpp'
+source_filename = "test.cpp"
+target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
+target triple = "arm64-apple-macosx13.0.0"
+
+; Function Attrs: noinline norecurse nounwind optnone ssp uwtable(sync)
+define i32 @main() #0 !dbg !10 {
+  %1 = alloca i32, align 4
+  store i32 0, ptr %1, align 4
+  ret i32 1, !dbg !15
+}
+
+attributes #0 = { noinline norecurse nounwind optnone ssp uwtable(sync)}
+
+!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6}
+!llvm.dbg.cu = !{!7}
+!llvm.ident = !{!9}
+
+!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 14, i32 0]}
+!1 = !{i32 7, !"Dwarf Version", i32 4}
+!2 = !{i32 2, !"Debug Info Version", i32 3}
+!3 = !{i32 1, !"wchar_size", i32 4}
+!4 = !{i32 8, !"PIC Level", i32 2}
+!5 = !{i32 7, !"uwtable", i32 1}
+!6 = !{i32 7, !"frame-pointer", i32 1}
+!7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !8, 
producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: 
FullDebug, splitDebugInlining: false, nameTableKind: None, sysroot: 
"/Applications/Xcode.app", sdk: "MacOSX.sdk")
+!8 = !DIFile(filename: "test.cpp", directory: "/Users/shubham/Development")
+!9 = !{!"clang"}
+!10 = distinct !DISubprogram(nam

[clang] [llvm] Remove llvm/MC/MCAsmLayout.h and the unused parameter in MCAssembler::layout (PR #97449)

2024-07-03 Thread Shubham Sandeep Rastogi via cfe-commits
rastogishubham wrote:

I agree with @dcci I appreciate all the work, but I noticed 10 patches in MC 
that broke a bunch of stuff for fine-grained caching downstream in 
apple/llvm-project so the assumption that these changes are straightforward is 
incorrect. 

https://github.com/llvm/llvm-project/pull/97449
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 673b5dd - Revert "Introduce symbol versioning for clang-cpp (#116556)"

2024-11-19 Thread Shubham Sandeep Rastogi via cfe-commits
Author: Shubham Sandeep Rastogi
Date: 2024-11-19T16:53:21-08:00
New Revision: 673b5dd380e8457c887d5b321195d81ea90f134d

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

LOG: Revert "Introduce symbol versioning for clang-cpp (#116556)"

This reverts commit 944478dd62a78f6bb43d4da210643affcc4584b6.

Reverted because of following error on greendragon

ld: unknown options: --version-script
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Added: 


Modified: 
clang/tools/clang-shlib/CMakeLists.txt
llvm/CMakeLists.txt

Removed: 
clang/tools/clang-shlib/simple_version_script.map.in



diff  --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index 830f2b138ffa16..298d3a9d18fec8 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -48,14 +48,6 @@ add_clang_library(clang-cpp
   ${_OBJECTS}
   LINK_LIBS
   ${_DEPS})
-
-configure_file(simple_version_script.map.in simple_version_script.map)
-
-if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
-  # Solaris ld does not accept global: *; so there is no way to version *all* 
global symbols
-  target_link_options(clang-cpp PRIVATE 
LINKER:--version-script,${CMAKE_CURRENT_BINARY_DIR}/simple_version_script.map)
-endif()
-
 # Optimize function calls for default visibility definitions to avoid PLT and
 # reduce dynamic relocations.
 if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)

diff  --git a/clang/tools/clang-shlib/simple_version_script.map.in 
b/clang/tools/clang-shlib/simple_version_script.map.in
deleted file mode 100644
index cb2306d1f59682..00
--- a/clang/tools/clang-shlib/simple_version_script.map.in
+++ /dev/null
@@ -1 +0,0 @@
-@LLVM_SHLIB_SYMBOL_VERSION@ { global: *; };

diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index cfcf1404d82b7c..74b72c98253413 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -27,7 +27,7 @@ if (NOT PACKAGE_VERSION)
 endif()
 
 if(NOT DEFINED LLVM_SHLIB_SYMBOL_VERSION)
-  # "Symbol version prefix for libLLVM.so and libclang-cpp.so"
+  # "Symbol version prefix for libLLVM.so"
   set(LLVM_SHLIB_SYMBOL_VERSION 
"LLVM_${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
 endif()
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Introduce symbol versioning for clang-cpp (PR #116556)

2024-11-19 Thread Shubham Sandeep Rastogi via cfe-commits
rastogishubham wrote:

Hi this patch has broken the greendragon llvm bot.

Link to failed build: 
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/15566/

```
ld: unknown options: --version-script 
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

https://github.com/llvm/llvm-project/pull/116556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Introduce symbol versioning for clang-cpp (PR #116556)

2024-11-19 Thread Shubham Sandeep Rastogi via cfe-commits
rastogishubham wrote:

I have reverted the patch with 673b5dd380e8457c887d5b321195d81ea90f134d

https://github.com/llvm/llvm-project/pull/116556
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits