[lld] [lld][AArch64] Add support for GCS (PR #90732)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 10:55:49 PDT 2024


================
@@ -560,6 +564,25 @@ static uint8_t getZStartStopVisibility(opt::InputArgList &args) {
   return ret;
 }
 
+static StringRef getZGcs(opt::InputArgList &args) {
+  StringRef ret = "implicit";
+  for (auto *arg : args.filtered(OPT_z)) {
+    std::pair<StringRef, StringRef> kv = StringRef(arg->getValue()).split('=');
+    if (kv.first == "gcs") {
+      arg->claim();
+      if (kv.second == "implicit" || kv.second == "always" ||
+          kv.second == "never")
+        ret = kv.second;
+      else if (StringRef(arg->getValue()) == "gcs")
+        // -z gcs is the same as -z gcs=always
+        ret = "always";
+      else
+        error("unknown -z gcs= value: " + StringRef(kv.second));
----------------
MaskRay wrote:

kv.second is a StringRef, so the StringRef ctor is unneeded.
It can be `Twine` for clarity.

I'll fix `-z start-stop-visibility=` above

https://github.com/llvm/llvm-project/pull/90732


More information about the llvm-commits mailing list