[PATCH] D151512: Remove small data limit for riscv64.*android triples

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 23:17:45 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG280930816fe0: Remove small data limit for riscv64.*android triples (authored by AdityaK <1894981+hiraditya at users.noreply.github.com>).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151512/new/

https://reviews.llvm.org/D151512

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c
  clang/test/Driver/riscv-sdata-warning.c


Index: clang/test/Driver/riscv-sdata-warning.c
===================================================================
--- clang/test/Driver/riscv-sdata-warning.c
+++ clang/test/Driver/riscv-sdata-warning.c
@@ -6,3 +6,7 @@
 // RUN: %clang -S --target=riscv64-unknown-elf -mcmodel=large -msmall-data-limit=8 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-RV64-LARGE-SDATA %s
 // CHECK-RV64-LARGE-SDATA: warning: ignoring '-msmall-data-limit=' with -mcmodel=large for -fpic or RV64
+
+// RUN: %clang -S --target=riscv64-linux-android -msmall-data-limit=8 %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-RV64-LARGE-SDATA-ANDROID %s
+// CHECK-RV64-LARGE-SDATA-ANDROID: warning: ignoring '-msmall-data-limit=' with -mcmodel=large for -fpic or RV64
Index: clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c
===================================================================
--- clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c
+++ clang/test/CodeGen/RISCV/riscv-sdata-module-flag.c
@@ -21,6 +21,10 @@
 // RUN:   | FileCheck %s -check-prefix=RV64-S2G4
 // RUN: %clang -target riscv64-unknown-elf %s -S -emit-llvm -msmall-data-threshold=16 -o - \
 // RUN:   | FileCheck %s -check-prefix=RV64-T16
+// RUN: %clang -target riscv64-linux-android %s -S -emit-llvm -o - \
+// RUN:   | FileCheck %s -check-prefix=RV64-ANDROID
+// RUN: %clang -target riscv64-linux-android %s -S -emit-llvm -msmall-data-limit=8 -o - \
+// RUN:   | FileCheck %s -check-prefix=RV64-ANDROID
 // RUN: %clang -target riscv64-unknown-elf %s -S -emit-llvm -fpic -o - \
 // RUN:   | FileCheck %s -check-prefix=RV64-PIC
 // RUN: %clang -target riscv64-unknown-elf %s -S -emit-llvm -mcmodel=large -o - \
@@ -46,3 +50,6 @@
 // The value will be passed by module flag instead of target feature.
 // RV32-S0-NOT: +small-data-limit=
 // RV64-S0-NOT: +small-data-limit=
+
+// RV64-ANDROID-NOT: small-data-limit
+// RV64-ANDROID:   !{i32 8, !"SmallDataLimit", i32 0}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2096,6 +2096,12 @@
     if (Args.hasArg(options::OPT_G)) {
       D.Diag(diag::warn_drv_unsupported_sdata);
     }
+  } else if (Triple.isAndroid()) {
+    // GP relaxation is not supported on Android.
+    SmallDataLimit = "0";
+    if (Args.hasArg(options::OPT_G)) {
+      D.Diag(diag::warn_drv_unsupported_sdata);
+    }
   } else if (Arg *A = Args.getLastArg(options::OPT_G)) {
     SmallDataLimit = A->getValue();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151512.531619.patch
Type: text/x-patch
Size: 2554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230615/3742a28c/attachment.bin>


More information about the cfe-commits mailing list