[clang] [llvm] [llvm] Add triples for managarm (PR #87845)

2024-05-05 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay 

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


[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-04 Thread Brad Smith via cfe-commits

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


[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-03 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From 31bb7cee2eb783a242734f3778269efcdb460a4c Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD, Fuchsia and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Fuchsia.cpp |  5 -
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 clang/test/Driver/freebsd.c |  4 
 clang/test/Driver/fuchsia.c |  5 +
 clang/test/Driver/haiku.c   |  5 +
 clang/test/Driver/netbsd.c  |  7 +++
 clang/test/Driver/openbsd.c |  8 
 10 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 9d698f77583950..c5757ddebb0f3e 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 14b838500becce..237d1554d4970d 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -119,8 +119,11 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
 CmdArgs.push_back(Args.MakeArgString(Dyld));
   }
 
-  if (ToolChain.getArch() == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index ca7faa68765abf..30464e2229e65b 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 645d0311641f34..0eec8fddabd5db 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid 

[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-03 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From 6c68cdaef71eacbad4fc2f6b81d2845c08b124fd Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD, Fuchsia and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Fuchsia.cpp |  5 -
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 clang/test/Driver/freebsd.c |  3 +++
 clang/test/Driver/fuchsia.c |  4 
 clang/test/Driver/haiku.c   |  4 
 clang/test/Driver/netbsd.c  |  6 ++
 clang/test/Driver/openbsd.c |  5 ++---
 10 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 9d698f77583950..c5757ddebb0f3e 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 14b838500becce..237d1554d4970d 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -119,8 +119,11 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
 CmdArgs.push_back(Args.MakeArgString(Dyld));
   }
 
-  if (ToolChain.getArch() == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index ca7faa68765abf..30464e2229e65b 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 645d0311641f34..0eec8fddabd5db 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");

[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-03 Thread Brad Smith via cfe-commits

brad0 wrote:

I fixed up the tesets.

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


[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-03 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From 35aee78eda1f3e7ac9e217982227c0769eda5ae1 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD, Fuchsia and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Fuchsia.cpp |  5 -
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 clang/test/Driver/freebsd.c |  3 +++
 clang/test/Driver/fuchsia.c |  4 
 clang/test/Driver/haiku.c   |  4 
 clang/test/Driver/netbsd.c  |  6 ++
 clang/test/Driver/openbsd.c |  5 ++---
 10 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 9d698f77583950..c5757ddebb0f3e 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 14b838500becce..237d1554d4970d 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -119,8 +119,11 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
 CmdArgs.push_back(Args.MakeArgString(Dyld));
   }
 
-  if (ToolChain.getArch() == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index ca7faa68765abf..30464e2229e65b 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 645d0311641f34..0eec8fddabd5db 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");

[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-03 Thread Brad Smith via cfe-commits


@@ -203,3 +203,12 @@
 // RELOCATABLE-NOT: "-l
 // RELOCATABLE-NOT: crt{{[^./\\]+}}.o
 
+// Check that the -X flag is passed to the linker on riscv64

brad0 wrote:

When I was putting the diff together I was questioning whether I should combine 
the two into one instance.

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


[clang] [Driver] Remove duplicate -r flag usage when linking (PR #82715)

2024-03-02 Thread Brad Smith via cfe-commits

brad0 wrote:

Fuchsia I think has the same issue, but the Driver code is a bit different.

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


[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-02 Thread Brad Smith via cfe-commits

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


[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-02 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From 35cd96b70bb616bbca68371e374655d0508fc7a8 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD, Fuchsia and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Fuchsia.cpp |  5 -
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 clang/test/Driver/freebsd.c |  9 +
 clang/test/Driver/fuchsia.c | 10 ++
 clang/test/Driver/haiku.c   | 10 ++
 clang/test/Driver/netbsd.c  | 14 ++
 clang/test/Driver/openbsd.c |  9 +++--
 10 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 9d698f77583950..c5757ddebb0f3e 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 14b838500becce..237d1554d4970d 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -119,8 +119,11 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
 CmdArgs.push_back(Args.MakeArgString(Dyld));
   }
 
-  if (ToolChain.getArch() == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   CmdArgs.push_back("-o");
   CmdArgs.push_back(Output.getFilename());
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index ca7faa68765abf..30464e2229e65b 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 645d0311641f34..0eec8fddabd5db 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || 

[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-02 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From 706bf652f2dec8a4c9341641e53bf57647bf49e3 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 clang/test/Driver/freebsd.c |  9 +
 clang/test/Driver/haiku.c   | 10 ++
 clang/test/Driver/netbsd.c  | 14 ++
 clang/test/Driver/openbsd.c |  9 +++--
 8 files changed, 62 insertions(+), 9 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 9d698f77583950..c5757ddebb0f3e 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index ca7faa68765abf..30464e2229e65b 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 645d0311641f34..0eec8fddabd5db 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 97f88b7b79dfbe..6da6728585df93 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -111,6 +111,7 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
@@ -160,8 

[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-03-02 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From ad96ce2633c62efa2de6b4925e8c3c11e98ba8bb Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 9d698f77583950..c5757ddebb0f3e 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index ca7faa68765abf..30464e2229e65b 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 645d0311641f34..0eec8fddabd5db 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 97f88b7b79dfbe..6da6728585df93 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -111,6 +111,7 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
@@ -160,8 +161,11 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (Nopie || Profiling)
 CmdArgs.push_back("-nopie");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 

[clang] [Driver] Remove duplicate -r flag usage when linking (PR #82715)

2024-03-02 Thread Brad Smith via cfe-commits

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


[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-02-27 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/83216

>From 4409a37ff160edb3c41c7650c181a5c9a60c397b Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index b7c9e0e51cdb66..9f942d4694c6a2 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index e0d94035823fd3..7db197d198be53 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 240bf5764b9cce..556fc61556461d 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index fd6aa4d7e68447..0a93f713b08af1 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -111,6 +111,7 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
@@ -160,8 +161,11 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (Nopie || Profiling)
 CmdArgs.push_back("-nopie");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 

[clang] [Driver][RISCV] Forward --no-relax option to linker for RISC-V on *BS… (PR #83216)

2024-02-27 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/83216

…D and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432

>From e9dca00cb002d223b4148d648f4f31b4cfc31d63 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Tue, 27 Feb 2024 21:07:09 -0500
Subject: [PATCH] [Driver][RISCV] Forward --no-relax option to linker for
 RISC-V on *BSD and Haiku

Based on https://github.com/llvm/llvm-project/pull/76432
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 11 ---
 clang/lib/Driver/ToolChains/Haiku.cpp   |  7 +--
 clang/lib/Driver/ToolChains/NetBSD.cpp  |  5 -
 clang/lib/Driver/ToolChains/OpenBSD.cpp |  6 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index b7c9e0e51cdb66..9f942d4694c6a2 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -133,6 +133,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) &&
@@ -165,8 +166,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   CmdArgs.push_back("-dynamic-linker");
   CmdArgs.push_back("/libexec/ld-elf.so.1");
 }
-const llvm::Triple  = ToolChain.getTriple();
-if (Arch == llvm::Triple::arm || T.isX86())
+if (Arch == llvm::Triple::arm || Triple.isX86())
   CmdArgs.push_back("--hash-style=both");
 CmdArgs.push_back("--enable-new-dtags");
   }
@@ -212,12 +212,17 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   case llvm::Triple::riscv64:
 CmdArgs.push_back("-m");
 CmdArgs.push_back("elf64lriscv");
-CmdArgs.push_back("-X");
 break;
   default:
 break;
   }
 
+  if (Triple.isRISCV64()) {
+CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
+
   if (Arg *A = Args.getLastArg(options::OPT_G)) {
 if (ToolChain.getTriple().isMIPS()) {
   StringRef v = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index e0d94035823fd3..6919a8dd0dbeaf 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -25,7 +25,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
-  const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple  = ToolChain.getTriple();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
   ArgStringList CmdArgs;
@@ -61,8 +61,11 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (!Shared)
 CmdArgs.push_back("--no-undefined");
 
-  if (Arch == llvm::Triple::riscv64)
+  if (Triple.isRISCV64()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+ CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 240bf5764b9cce..556fc61556461d 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -240,8 +240,11 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 break;
   }
 
-  if (Triple.isRISCV())
+  if (Triple.isRISCV()) {
 CmdArgs.push_back("-X");
+if (Args.hasArg(options::OPT_mno_relax))
+  CmdArgs.push_back("--no-relax");
+  }
 
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index fd6aa4d7e68447..0a93f713b08af1 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -111,6 +111,7 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
const char *LinkingOutput) const {
   const auto  = static_cast(getToolChain());
   const Driver  = ToolChain.getDriver();
+  const llvm::Triple  = ToolChain.getTriple();
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool Static = Args.hasArg(options::OPT_static);
   const bool Shared = Args.hasArg(options::OPT_shared);
@@ -160,8 +161,11 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   if (Nopie || Profiling)
 CmdArgs.push_back("-nopie");
 
-  if (Arch == 

[clang] [llvm] MIPS/clang: Fix asm constraint for softfloat (PR #79116)

2024-02-26 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay 

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2024-02-25 Thread Brad Smith via cfe-commits

brad0 wrote:

Any chance of reviving this?

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


[clang] [Driver] Remove duplicate -r flag usage when linking (PR #82715)

2024-02-23 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/82715

>From fb18242731fb52c67a6345b5ce7664125d9b7cb4 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 22 Feb 2024 19:44:56 -0500
Subject: [PATCH] [Driver] Remove duplicate -r flag usage when linking

Bug #82010
---
 clang/lib/Driver/ToolChains/Darwin.cpp| 5 ++---
 clang/lib/Driver/ToolChains/DragonFly.cpp | 2 +-
 clang/lib/Driver/ToolChains/FreeBSD.cpp   | 4 ++--
 clang/lib/Driver/ToolChains/Haiku.cpp | 2 +-
 clang/lib/Driver/ToolChains/NetBSD.cpp| 2 +-
 clang/lib/Driver/ToolChains/OpenBSD.cpp   | 4 ++--
 clang/lib/Driver/ToolChains/PS4CPU.cpp| 5 ++---
 clang/lib/Driver/ToolChains/Solaris.cpp   | 3 +--
 8 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index cc1219d69d9910..fff538d2e5d735 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -643,9 +643,8 @@ void darwin::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as 
expected.
-  Args.addAllArgs(CmdArgs,
-  {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
-   options::OPT_Z_Flag, options::OPT_u_Group, options::OPT_r});
+  Args.addAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, 
options::OPT_t,
+options::OPT_Z_Flag, options::OPT_u_Group});
 
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or
diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp 
b/clang/lib/Driver/ToolChains/DragonFly.cpp
index 9942fc632e0a91..89e0600277c44c 100644
--- a/clang/lib/Driver/ToolChains/DragonFly.cpp
+++ b/clang/lib/Driver/ToolChains/DragonFly.cpp
@@ -122,7 +122,7 @@ void dragonfly::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index b7c9e0e51cdb66..9d698f77583950 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -261,8 +261,8 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
-  Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
-options::OPT_t, options::OPT_r});
+  Args.addAllArgs(CmdArgs,
+  {options::OPT_T_Group, options::OPT_s, options::OPT_t});
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index e0d94035823fd3..ca7faa68765abf 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -80,7 +80,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   if (D.isUsingLTO()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 240bf5764b9cce..645d0311641f34 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -268,7 +268,7 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index fd6aa4d7e68447..97f88b7b79dfbe 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -192,8 +192,8 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
-  Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
-options::OPT_t, options::OPT_r});
+  Args.addAllArgs(CmdArgs,
+  

[clang] [Driver] Remove duplicate -r flag usage when linking (PR #82715)

2024-02-22 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/82715

>From 339a9bc79325809dc58783ceb83cf949081a2c96 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 22 Feb 2024 19:44:56 -0500
Subject: [PATCH] [Driver] Remove duplicate -r flag usage when linking

Bug #82010
---
 clang/lib/Driver/ToolChains/Darwin.cpp| 5 ++---
 clang/lib/Driver/ToolChains/DragonFly.cpp | 2 +-
 clang/lib/Driver/ToolChains/FreeBSD.cpp   | 4 ++--
 clang/lib/Driver/ToolChains/Haiku.cpp | 2 +-
 clang/lib/Driver/ToolChains/NetBSD.cpp| 2 +-
 clang/lib/Driver/ToolChains/OpenBSD.cpp   | 4 ++--
 clang/lib/Driver/ToolChains/PS4CPU.cpp| 5 ++---
 clang/lib/Driver/ToolChains/Solaris.cpp   | 3 +--
 8 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index cc1219d69d9910..fff538d2e5d735 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -643,9 +643,8 @@ void darwin::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   // It seems that the 'e' option is completely ignored for dynamic executables
   // (the default), and with static executables, the last one wins, as 
expected.
-  Args.addAllArgs(CmdArgs,
-  {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
-   options::OPT_Z_Flag, options::OPT_u_Group, options::OPT_r});
+  Args.addAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, 
options::OPT_t,
+options::OPT_Z_Flag, options::OPT_u_Group});
 
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or
diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp 
b/clang/lib/Driver/ToolChains/DragonFly.cpp
index 9942fc632e0a91..89e0600277c44c 100644
--- a/clang/lib/Driver/ToolChains/DragonFly.cpp
+++ b/clang/lib/Driver/ToolChains/DragonFly.cpp
@@ -122,7 +122,7 @@ void dragonfly::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index b7c9e0e51cdb66..9d698f77583950 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -261,8 +261,8 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
-  Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
-options::OPT_t, options::OPT_r});
+  Args.addAllArgs(CmdArgs,
+  {options::OPT_T_Group, options::OPT_s, options::OPT_t});
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index e0d94035823fd3..ca7faa68765abf 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -80,7 +80,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   if (D.isUsingLTO()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 240bf5764b9cce..645d0311641f34 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -268,7 +268,7 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index fd6aa4d7e68447..97f88b7b79dfbe 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -192,8 +192,8 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
-  Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
-options::OPT_t, options::OPT_r});
+  Args.addAllArgs(CmdArgs,
+  

[clang] [Driver] Remove duplicate -r flag usage when linking (PR #82715)

2024-02-22 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/82715

Bug #82010

>From 8049d576571703329d34f6a4d399665e07b22ee2 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 22 Feb 2024 19:44:56 -0500
Subject: [PATCH] [Driver] Remove duplicate -r flag usage when linking

Bug #82010
---
 clang/lib/Driver/ToolChains/Darwin.cpp| 2 +-
 clang/lib/Driver/ToolChains/DragonFly.cpp | 2 +-
 clang/lib/Driver/ToolChains/FreeBSD.cpp   | 2 +-
 clang/lib/Driver/ToolChains/Haiku.cpp | 2 +-
 clang/lib/Driver/ToolChains/NetBSD.cpp| 2 +-
 clang/lib/Driver/ToolChains/OpenBSD.cpp   | 2 +-
 clang/lib/Driver/ToolChains/PS4CPU.cpp| 2 +-
 clang/lib/Driver/ToolChains/Solaris.cpp   | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index cc1219d69d9910..1922db77cb09ae 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -645,7 +645,7 @@ void darwin::Linker::ConstructJob(Compilation , const 
JobAction ,
   // (the default), and with static executables, the last one wins, as 
expected.
   Args.addAllArgs(CmdArgs,
   {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
-   options::OPT_Z_Flag, options::OPT_u_Group, options::OPT_r});
+   options::OPT_Z_Flag, options::OPT_u_Group});
 
   // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading
   // members of static archive libraries which implement Objective-C classes or
diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp 
b/clang/lib/Driver/ToolChains/DragonFly.cpp
index 9942fc632e0a91..89e0600277c44c 100644
--- a/clang/lib/Driver/ToolChains/DragonFly.cpp
+++ b/clang/lib/Driver/ToolChains/DragonFly.cpp
@@ -122,7 +122,7 @@ void dragonfly::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index b7c9e0e51cdb66..f8025c8e993be7 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -262,7 +262,7 @@ void freebsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
   Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
-options::OPT_t, options::OPT_r});
+options::OPT_t});
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp 
b/clang/lib/Driver/ToolChains/Haiku.cpp
index e0d94035823fd3..ca7faa68765abf 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -80,7 +80,7 @@ void haiku::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   if (D.isUsingLTO()) {
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp 
b/clang/lib/Driver/ToolChains/NetBSD.cpp
index 240bf5764b9cce..645d0311641f34 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -268,7 +268,7 @@ void netbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   }
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
-options::OPT_s, options::OPT_t, options::OPT_r});
+options::OPT_s, options::OPT_t});
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index fd6aa4d7e68447..ff4da313498298 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -193,7 +193,7 @@ void openbsd::Linker::ConstructJob(Compilation , const 
JobAction ,
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   ToolChain.AddFilePathLibArgs(Args, CmdArgs);
   Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
-options::OPT_t, options::OPT_r});
+options::OPT_t});
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp 
b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index 8ba8b80cfec78e..e97f843bff7fdc 100644
--- 

[clang] [llvm] [CMake] Add a linker test for -Bsymbolic-functions to AddLLVM (PR #79539)

2024-02-18 Thread Brad Smith via cfe-commits

brad0 wrote:

> What's the issue? GNU ld has had -Bsymbolic-functions since 2007 and for 
> quite a few releases LLVM has been using `-Bsymbolic-functions`.

This is binutils 2.17. We've had patches for awhile in our tree too 
specifically for the exceptions not using LLD.

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


[clang] [llvm] MIPS/clang: Fix asm constraint for softfloat (PR #79116)

2024-02-13 Thread Brad Smith via cfe-commits

brad0 wrote:

@wzssyqa Ping.

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


[clang] [llvm] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-02-10 Thread Brad Smith via cfe-commits

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


[clang] [flang] [flang][driver] Rename `flang-new` as `flang` (PR #74377)

2024-02-10 Thread Brad Smith via cfe-commits

brad0 wrote:

> ok, but is there some threshold of percent that pass, or a specific list that 
> we want to be sure pass? My understanding is that we've been running (at 
> least a subset of) the gfortran test suite for a while now. What makes the 
> current results not sufficient?

I think it's more of take flang-new and run it through the test suite and 
provide the output results.

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


[clang] [llvm] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-02-10 Thread Brad Smith via cfe-commits

brad0 wrote:

@s-barannikov How does that look?

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


[clang] [llvm] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-02-07 Thread Brad Smith via cfe-commits

brad0 wrote:

@koachan ?

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2024-02-05 Thread Brad Smith via cfe-commits

brad0 wrote:

Ping.

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


[clang] [clang] Add GCC-compatible code model names for sparc64 (PR #79485)

2024-02-03 Thread Brad Smith via cfe-commits

https://github.com/brad0 approved this pull request.


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


[clang] [llvm] [CMake] Add a linker test for -Bsymbolic-functions to AddLLVM (PR #79539)

2024-01-28 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/79539

>From 024e972034d5e6a91157feeba30cc76368819b8f Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 25 Jan 2024 16:20:47 -0500
Subject: [PATCH] [CMake] Add a linker test for -Bsymbolic-functions to AddLLVM

Add a linker test for -Bsymbolic-functions to AddLLVM and remove
the illumos hardcoded bits for its handling. OpenBSD also has a
local patch for linking with the old BFD linker on mips64 and
sparc64.
---
 clang/tools/clang-shlib/CMakeLists.txt |  2 +-
 llvm/cmake/modules/AddLLVM.cmake   | 13 ++---
 llvm/tools/llvm-shlib/CMakeLists.txt   |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index 298d3a9d18fec8..6afd3efebe53a0 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
   ${_DEPS})
 # 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)
+if (NOT APPLE AND LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
 if (MINGW OR CYGWIN)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 5e989618552824..a030489b619602 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -241,12 +241,6 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
-elseif("${stderr}" MATCHES "(illumos)" OR
-   "${stdout}" MATCHES "(illumos)")
-  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_SOLARISLD YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: Solaris ld (illumos)")
 elseif("${stderr}" MATCHES "Solaris Link Editors" OR
"${stdout}" MATCHES "Solaris Link Editors")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
@@ -260,6 +254,7 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 endif()
 
 function(add_link_opts target_name)
+  include(LLVMCheckLinkerFlag)
   get_llvm_distribution(${target_name} in_distribution in_distribution_var)
   if(NOT in_distribution)
 # Don't LTO optimize targets that aren't part of any distribution.
@@ -291,7 +286,6 @@ function(add_link_opts target_name)
   elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD)
 # Support for ld -z discard-unused=sections was only added in
 # Solaris 11.4.  GNU ld ignores it, but warns every time.
-include(LLVMCheckLinkerFlag)
 llvm_check_linker_flag(CXX "-Wl,-z,discard-unused=sections" 
LINKER_SUPPORTS_Z_DISCARD_UNUSED)
 if (LINKER_SUPPORTS_Z_DISCARD_UNUSED)
   set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -314,6 +308,11 @@ function(add_link_opts target_name)
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-brtl")
   endif()
+
+  if (NOT MINGW)
+llvm_check_linker_flag(CXX "-Wl,-Bsymbolic-functions"
+   LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS)
+  endif()
 endfunction(add_link_opts)
 
 # Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}.
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt 
b/llvm/tools/llvm-shlib/CMakeLists.txt
index a47a0ec84c625c..3e08dd5459a3f1 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -49,7 +49,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
   # Solaris ld does not accept global: *; so there is no way to version 
*all* global symbols
   set(LIB_NAMES 
-Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map
 ${LIB_NAMES})
 endif()
-if (NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
+if (LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS)
   # Optimize function calls for default visibility definitions to avoid 
PLT and
   # reduce dynamic relocations.
   # Note: for -fno-pic default, the address of a function may be different 
from

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2024-01-27 Thread Brad Smith via cfe-commits

brad0 wrote:

Able to look at this further?

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


[clang] [PowerPC] Diagnose invalid combination with Altivec, VSX and soft-float (PR #79109)

2024-01-25 Thread Brad Smith via cfe-commits

brad0 wrote:

cc @MaskRay 

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


[llvm] [clang] [CMake] Add a linker test for -Bsymbolic-functions to AddLLVM (PR #79539)

2024-01-25 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/79539

Add a linker test for -Bsymbolic-functions to AddLLVM and remove
the illumos hardcoded bits for its handling. OpenBSD also has a
local patch for linking with the old BFD linker on mips64 and
sparc64.

>From 73eee521fb6025d5964db1a278abb0123c6834a8 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 25 Jan 2024 16:20:47 -0500
Subject: [PATCH] [CMake] Add a linker test for -Bsymbolic-functions to AddLLVM

Add a linker test for -Bsymbolic-functions to AddLLVM and remove
the illumos hardcoded bits for its handling. OpenBSD also has a
local patch for linking with the old BFD linker on mips64 and
sparc64.
---
 clang/tools/clang-shlib/CMakeLists.txt |  2 +-
 llvm/cmake/modules/AddLLVM.cmake   | 13 ++---
 llvm/tools/llvm-shlib/CMakeLists.txt   |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index 298d3a9d18fec8c..6afd3efebe53a0b 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
   ${_DEPS})
 # 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)
+if (NOT APPLE AND LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
 if (MINGW OR CYGWIN)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 5e9896185528246..a030489b6196023 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -241,12 +241,6 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
-elseif("${stderr}" MATCHES "(illumos)" OR
-   "${stdout}" MATCHES "(illumos)")
-  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_SOLARISLD YES CACHE INTERNAL "")
-  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")
-  message(STATUS "Linker detection: Solaris ld (illumos)")
 elseif("${stderr}" MATCHES "Solaris Link Editors" OR
"${stdout}" MATCHES "Solaris Link Editors")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
@@ -260,6 +254,7 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
 endif()
 
 function(add_link_opts target_name)
+  include(LLVMCheckLinkerFlag)
   get_llvm_distribution(${target_name} in_distribution in_distribution_var)
   if(NOT in_distribution)
 # Don't LTO optimize targets that aren't part of any distribution.
@@ -291,7 +286,6 @@ function(add_link_opts target_name)
   elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD)
 # Support for ld -z discard-unused=sections was only added in
 # Solaris 11.4.  GNU ld ignores it, but warns every time.
-include(LLVMCheckLinkerFlag)
 llvm_check_linker_flag(CXX "-Wl,-z,discard-unused=sections" 
LINKER_SUPPORTS_Z_DISCARD_UNUSED)
 if (LINKER_SUPPORTS_Z_DISCARD_UNUSED)
   set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -314,6 +308,11 @@ function(add_link_opts target_name)
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-brtl")
   endif()
+
+  if (NOT MINGW)
+llvm_check_linker_flag(CXX "-Wl,-Bsymbolic-functions"
+   LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS)
+  endif()
 endfunction(add_link_opts)
 
 # Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}.
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt 
b/llvm/tools/llvm-shlib/CMakeLists.txt
index a47a0ec84c625c6..3e08dd5459a3f1a 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -49,7 +49,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
   # Solaris ld does not accept global: *; so there is no way to version 
*all* global symbols
   set(LIB_NAMES 
-Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map
 ${LIB_NAMES})
 endif()
-if (NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
+if (LINKER_SUPPORTS_B_SYMBOLIC_FUNCTIONS)
   # Optimize function calls for default visibility definitions to avoid 
PLT and
   # reduce dynamic relocations.
   # Note: for -fno-pic default, the address of a function may be different 
from

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


[clang] [UEFI] X86_64 UEFI Clang Driver (PR #76838)

2024-01-25 Thread Brad Smith via cfe-commits

brad0 wrote:

Ping.

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


[clang] [llvm] [SPARC] Support reserving arbitrary general purpose registers (PR #74927)

2024-01-16 Thread Brad Smith via cfe-commits

brad0 wrote:

There is a conflict at the moment. Also 18 is coming up.

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


[clang] [CLANG][NFC] Modify test cases to suit assigned default sysroot path (PR #77075)

2024-01-14 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay Wasn't it you that mentioned this?

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


[llvm] [clang] Hurd: Add x86_64 support (PR #78065)

2024-01-13 Thread Brad Smith via cfe-commits

brad0 wrote:

Looks pretty good to me.

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


[clang] [llvm] [SPARC] Consume `tune-cpu` directive in the backend (PR #77195)

2024-01-12 Thread Brad Smith via cfe-commits

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


[llvm] [clang] [CMake] Add support for building on illumos (PR #74930)

2024-01-08 Thread Brad Smith via cfe-commits

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


[llvm] [clang] [CMake] Add support for building on illumos (PR #74930)

2024-01-08 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74930

>From b63009251c8098b40b3a999ce7622c0dfd14f127 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 9 Dec 2023 01:43:09 -0500
Subject: [PATCH] [CMake] Add support for building on illumos

illumos has an older version of the Solaris linker that does not
support the GNU version script compat nor version scripts and does
not support -Bsymbolic-functions. Treat illumos linker separately.

The libclang/CMakeLists part lifted from NetBSD's pkgsrc.
---
 clang/tools/clang-shlib/CMakeLists.txt |  2 +-
 clang/tools/libclang/CMakeLists.txt| 19 +++
 llvm/cmake/modules/AddLLVM.cmake   |  6 ++
 llvm/tools/llvm-shlib/CMakeLists.txt   |  2 +-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index aa7fcd1efed45b..298d3a9d18fec8 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
   ${_DEPS})
 # Optimize function calls for default visibility definitions to avoid PLT and
 # reduce dynamic relocations.
-if (NOT APPLE AND NOT MINGW)
+if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
 if (MINGW OR CYGWIN)
diff --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 4f23065a247274..1cfc46eb1a52f6 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -185,11 +185,22 @@ if(ENABLE_SHARED)
 endif()
   endif()
   if (USE_VERSION_SCRIPT)
-target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
-# The Solaris 11.4 linker supports a subset of GNU ld version scripts,
-# but requires a special option to enable it.
 if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-  target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat")
+  include(CheckLinkerFlag)
+  # The Solaris 11.4 linker supports a subset of GNU ld version scripts,
+  # but requires a special option to enable it.
+  llvm_check_linker_flag(CXX "-Wl,-z,gnu-version-script-compat"
+ LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+  # Older Solaris (and illumos) linker does not support GNU ld version 
scripts
+  # and does not support GNU version script compat.
+  if (LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+target_link_options(libclang PRIVATE 
"-Wl,-z,gnu-version-script-compat")
+  else()
+target_link_options(libclang PRIVATE 
"-Wl,-M,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+  endif()
+else()
+  target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
 endif()
 # Ensure that libclang.so gets rebuilt when the linker script changes.
 set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index c9bca30c8f33d1..14c0837c35964d 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -241,6 +241,12 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
+elseif("${stderr}" MATCHES "(illumos)" OR
+   "${stdout}" MATCHES "(illumos)")
+  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Solaris ld (illumos)")
 elseif("${stderr}" MATCHES "Solaris Link Editors" OR
"${stdout}" MATCHES "Solaris Link Editors")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt 
b/llvm/tools/llvm-shlib/CMakeLists.txt
index 64d6f631ffadd5..a47a0ec84c625c 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -49,7 +49,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
   # Solaris ld does not accept global: *; so there is no way to version 
*all* global symbols
   set(LIB_NAMES 
-Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map
 ${LIB_NAMES})
 endif()
-if (NOT MINGW)
+if (NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
   # Optimize function calls for default visibility definitions to avoid 
PLT and
   # reduce dynamic relocations.
   # Note: for -fno-pic default, the address of a function may be different 
from

___
cfe-commits mailing list

[llvm] [clang] [CMake] Add support for building on illumos (PR #74930)

2024-01-08 Thread Brad Smith via cfe-commits

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


[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)

2024-01-08 Thread Brad Smith via cfe-commits

brad0 wrote:

> Are they aware of the issue and is there a tracking feature request/issue? It 
> seems that this patch adds code to hard code the implementation properties 
> which may become stale.

Searching via their bug tracker I can't find anything open or closed. But I 
have a hard time believing they are not aware of this.

We run into -Bsymbolic-functions on OpenBSD enough as it is with our BFD 2.17 
linker.

Not sure about how frequently we run into version scripts in the wild.

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


[clang] [llvm] [llvm] Add support for building on illumos (PR #74930)

2024-01-06 Thread Brad Smith via cfe-commits


@@ -241,6 +241,11 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
+elseif("${stderr}" MATCHES "(illumos)" OR
+   "${stdout}" MATCHES "(illumos)")
+  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")

brad0 wrote:

That does simplify things.

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


[clang] [llvm] [llvm] Add support for building on illumos (PR #74930)

2024-01-06 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74930

>From bc209c885f00c5eb4b00ca16bfbd279c62549d89 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 9 Dec 2023 01:43:09 -0500
Subject: [PATCH] [llvm] Add support for building on illumos

illumos has an older version of the Solaris linker that does not
support the GNU version script compat nor version scripts and does
not support -Bsymbolic-functions. Treat illumos linker separately.

The libclang/CMakeLists part lifted from NetBSD's pkgsrc.
---
 clang/tools/clang-shlib/CMakeLists.txt |  2 +-
 clang/tools/libclang/CMakeLists.txt| 19 +++
 llvm/cmake/modules/AddLLVM.cmake   |  6 ++
 llvm/tools/llvm-shlib/CMakeLists.txt   |  2 +-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index aa7fcd1efed45b..298d3a9d18fec8 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
   ${_DEPS})
 # Optimize function calls for default visibility definitions to avoid PLT and
 # reduce dynamic relocations.
-if (NOT APPLE AND NOT MINGW)
+if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
 if (MINGW OR CYGWIN)
diff --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 4f23065a247274..1cfc46eb1a52f6 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -185,11 +185,22 @@ if(ENABLE_SHARED)
 endif()
   endif()
   if (USE_VERSION_SCRIPT)
-target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
-# The Solaris 11.4 linker supports a subset of GNU ld version scripts,
-# but requires a special option to enable it.
 if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-  target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat")
+  include(CheckLinkerFlag)
+  # The Solaris 11.4 linker supports a subset of GNU ld version scripts,
+  # but requires a special option to enable it.
+  llvm_check_linker_flag(CXX "-Wl,-z,gnu-version-script-compat"
+ LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+  # Older Solaris (and illumos) linker does not support GNU ld version 
scripts
+  # and does not support GNU version script compat.
+  if (LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+target_link_options(libclang PRIVATE 
"-Wl,-z,gnu-version-script-compat")
+  else()
+target_link_options(libclang PRIVATE 
"-Wl,-M,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+  endif()
+else()
+  target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
 endif()
 # Ensure that libclang.so gets rebuilt when the linker script changes.
 set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index c9bca30c8f33d1..14c0837c35964d 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -241,6 +241,12 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
+elseif("${stderr}" MATCHES "(illumos)" OR
+   "${stdout}" MATCHES "(illumos)")
+  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Solaris ld (illumos)")
 elseif("${stderr}" MATCHES "Solaris Link Editors" OR
"${stdout}" MATCHES "Solaris Link Editors")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt 
b/llvm/tools/llvm-shlib/CMakeLists.txt
index 64d6f631ffadd5..a47a0ec84c625c 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -49,7 +49,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
   # Solaris ld does not accept global: *; so there is no way to version 
*all* global symbols
   set(LIB_NAMES 
-Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map
 ${LIB_NAMES})
 endif()
-if (NOT MINGW)
+if (NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
   # Optimize function calls for default visibility definitions to avoid 
PLT and
   # reduce dynamic relocations.
   # Note: for -fno-pic default, the address of a function may be different 
from

___
cfe-commits mailing list

[clang] [llvm] [llvm] Add support for building on illumos (PR #74930)

2024-01-03 Thread Brad Smith via cfe-commits

brad0 wrote:

Not so far. I'd like to get this in.

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


[compiler-rt] [clang] Sanitizer prer6 (PR #76894)

2024-01-03 Thread Brad Smith via cfe-commits

brad0 wrote:

This also has a Clang patch mixed in.

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


[clang] Clang/MIPS: Use -mnan value for -mabs if not specified (PR #71157)

2024-01-03 Thread Brad Smith via cfe-commits

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


[clang] Clang/MIPS: Use -mnan value for -mabs if not specified (PR #71157)

2024-01-01 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay Ping.

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


[clang] [Driver][Solaris] Remove reachable llvm_unreachable (PR #76645)

2024-01-01 Thread Brad Smith via cfe-commits

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2023-12-31 Thread Brad Smith via cfe-commits

brad0 wrote:

Thank you for the effort.

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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-31 Thread Brad Smith via cfe-commits
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng
Message-ID:
In-Reply-To: 


brad0 wrote:

You probably need to rebase this.

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


[clang] [clang][Darwin] Remove legacy framework search path logic in the frontend (PR #75841)

2023-12-30 Thread Brad Smith via cfe-commits

brad0 wrote:

Update?

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


[clang] [Driver][Solaris] Remove reachable llvm_unreachable (PR #76645)

2023-12-30 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/76645

Remove the llvm_unreachable from getSolarisLibSuffix(). The code path is
reachable. In the case of an unsupported architecture we're not worrying
about trying to actually find the library paths, and I don't think it
makes sense for the Driver to crash.

Fixes #58334

>From a79555f4f862a7717ce9e50973e9609bb5eadf97 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 30 Dec 2023 21:37:55 -0500
Subject: [PATCH] [Driver][Solaris] Remove reachable llvm_unreachable

Remove the llvm_unreachable from getSolarisLibSuffix(). The code path is
reachable. In the case of an unsupported architecture we're not worrying
about trying to actually find the library paths, and I don't think it
makes sense for the Driver to crash.

Fixes #58334
---
 clang/lib/Driver/ToolChains/Solaris.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp 
b/clang/lib/Driver/ToolChains/Solaris.cpp
index 9a9792d019d5ed..200ac46aa53409 100644
--- a/clang/lib/Driver/ToolChains/Solaris.cpp
+++ b/clang/lib/Driver/ToolChains/Solaris.cpp
@@ -295,13 +295,12 @@ static StringRef getSolarisLibSuffix(const llvm::Triple 
) {
   switch (Triple.getArch()) {
   case llvm::Triple::x86:
   case llvm::Triple::sparc:
+  default:
 break;
   case llvm::Triple::x86_64:
 return "/amd64";
   case llvm::Triple::sparcv9:
 return "/sparcv9";
-  default:
-llvm_unreachable("Unsupported architecture");
   }
   return "";
 }

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


[clang] [Driver] Hook up Haiku PowerPC support (PR #69134)

2023-12-26 Thread Brad Smith via cfe-commits

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


[flang] [clang] [flang][driver] Rename `flang-new` as `flang` (PR #74377)

2023-12-23 Thread Brad Smith via cfe-commits

brad0 wrote:

It's all green lights. Anything holding this up?

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


[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)

2023-12-10 Thread Brad Smith via cfe-commits

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


[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)

2023-12-10 Thread Brad Smith via cfe-commits

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


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-09 Thread Brad Smith via cfe-commits

brad0 wrote:

Just FYI submitting lots of PRs with all of them having commits with a commit 
message of 1 is not going to go anywhere. They need to be revised with proper 
meaningful commit messages.

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


[clang] [Preprocessor] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 for AArch64 (PR #74954)

2023-12-09 Thread Brad Smith via cfe-commits

https://github.com/brad0 approved this pull request.


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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Brad Smith via cfe-commits
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng
Message-ID:
In-Reply-To: 



@@ -242,14 +240,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const 
llvm::Triple ,
 
   switch (os) {
   case llvm::Triple::Win32:
-switch (triple.getEnvironment()) {
-default: llvm_unreachable("Include management is handled in the driver.");
-case llvm::Triple::Cygnus:
-  AddPath("/usr/include/w32api", System, false);
-  break;
-case llvm::Triple::GNU:
-  break;
-}
+llvm_unreachable("Include management is handled in the driver.");

brad0 wrote:

Just remove the switch statement all together.

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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Brad Smith via cfe-commits
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng
Message-ID:
In-Reply-To: 



@@ -268,17 +259,7 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
   llvm::Triple::OSType os = triple.getOS();
   switch (os) {
   case llvm::Triple::Win32:
-switch (triple.getEnvironment()) {
-default: llvm_unreachable("Include management is handled in the driver.");
-case llvm::Triple::Cygnus:
-  // Cygwin-1.7
-  AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.7.3");
-  AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.5.3");
-  AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
-  // g++-4 / Cygwin-1.5
-  AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
-  break;
-}
+llvm_unreachable("Include management is handled in the driver.");

brad0 wrote:

You should be able to remove AddDefaultCPlusPlusIncludePaths().

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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Brad Smith via cfe-commits
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng
Message-ID:
In-Reply-To: 



@@ -205,9 +205,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const 
llvm::Triple ,
   if (HSOpts.UseStandardSystemIncludes) {
 switch (os) {
 case llvm::Triple::Win32:
-  if (triple.getEnvironment() != llvm::Triple::Cygnus)
-break;
-  [[fallthrough]];

brad0 wrote:

Just remove the Win32 switch case.

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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Brad Smith via cfe-commits
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng
Message-ID:
In-Reply-To: 



@@ -310,10 +291,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
 return false;
 
   case llvm::Triple::Win32:
-if (triple.getEnvironment() != llvm::Triple::Cygnus ||
-triple.isOSBinFormatMachO())
-  return false;
-break;

brad0 wrote:

Add Win32 to the list just above this.

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


[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)

2023-12-09 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74930

>From 58f07d552bb73244e1641078aebdbce64d5219e9 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 9 Dec 2023 01:43:09 -0500
Subject: [PATCH] [llvm] Add support for building on illumos

illumos has an older version of the Solaris linker that does not
support the GNU version script compat nor version scripts and does
not support -Bsymbolic-functions. Treat illumos linker separately.

The libclang/CMakeLists part lifted from NetBSD's pkgsrc.
---
 clang/tools/clang-shlib/CMakeLists.txt |  2 +-
 clang/tools/libclang/CMakeLists.txt| 19 +++
 llvm/cmake/modules/AddLLVM.cmake   | 13 ++---
 llvm/tools/llvm-shlib/CMakeLists.txt   |  4 ++--
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index aa7fcd1efed45b..298d3a9d18fec8 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
   ${_DEPS})
 # Optimize function calls for default visibility definitions to avoid PLT and
 # reduce dynamic relocations.
-if (NOT APPLE AND NOT MINGW)
+if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
 if (MINGW OR CYGWIN)
diff --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 4f23065a247274..1cfc46eb1a52f6 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -185,11 +185,22 @@ if(ENABLE_SHARED)
 endif()
   endif()
   if (USE_VERSION_SCRIPT)
-target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
-# The Solaris 11.4 linker supports a subset of GNU ld version scripts,
-# but requires a special option to enable it.
 if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-  target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat")
+  include(CheckLinkerFlag)
+  # The Solaris 11.4 linker supports a subset of GNU ld version scripts,
+  # but requires a special option to enable it.
+  llvm_check_linker_flag(CXX "-Wl,-z,gnu-version-script-compat"
+ LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+  # Older Solaris (and illumos) linker does not support GNU ld version 
scripts
+  # and does not support GNU version script compat.
+  if (LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+target_link_options(libclang PRIVATE 
"-Wl,-z,gnu-version-script-compat")
+  else()
+target_link_options(libclang PRIVATE 
"-Wl,-M,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+  endif()
+else()
+  target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
 endif()
 # Ensure that libclang.so gets rebuilt when the linker script changes.
 set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index c9bca30c8f33d1..ca146ad699ff6c 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -115,7 +115,7 @@ function(add_llvm_symbol_exports target_name export_file)
   DEPENDS ${export_file}
   VERBATIM
   COMMENT "Creating export file for ${target_name}")
-if (${LLVM_LINKER_IS_SOLARISLD})
+if ((${LLVM_LINKER_IS_SOLARISLD}) OR (${LLVM_LINKER_IS_SOLARISLD_ILLUMOS}))
   set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS "  
-Wl,-M,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"")
 else()
@@ -241,6 +241,11 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
+elseif("${stderr}" MATCHES "(illumos)" OR
+   "${stdout}" MATCHES "(illumos)")
+  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Solaris ld (illumos)")
 elseif("${stderr}" MATCHES "Solaris Link Editors" OR
"${stdout}" MATCHES "Solaris Link Editors")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
@@ -282,11 +287,13 @@ function(add_link_opts target_name)
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-dead_strip")
-  elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD)
+  elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND 
(LLVM_LINKER_IS_SOLARISLD OR
+ 

[llvm] [clang] [llvm] Add support for building on illumos (PR #74930)

2023-12-09 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/74930

illumos has an older version of the Solaris linker that does not
support the GNU version script compat nor version scripts and does
not support -Bsymbolic-functions. Treat illumos linker separately.

The libclang/CMakeLists part lifted from NetBSD's pkgsrc.

Build tested on Solaris 11.4 and OpenIndiana.

/usr/bin/ld --version

ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.3260
ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1790 (illumos)

>From 5b41ec8ab1640e09f0fa29bf2b9f2ec89168d4c4 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 9 Dec 2023 01:43:09 -0500
Subject: [PATCH] [llvm] Add support for building on illumos

illumos has an older version of the Solaris linker that does not
support the GNU version script compat nor version scripts and does
not support -Bsymbolic-functions. Treat illumos linker separately.
---
 clang/tools/clang-shlib/CMakeLists.txt |  2 +-
 clang/tools/libclang/CMakeLists.txt| 19 +++
 llvm/cmake/modules/AddLLVM.cmake   | 13 ++---
 llvm/tools/llvm-shlib/CMakeLists.txt   |  4 ++--
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/clang/tools/clang-shlib/CMakeLists.txt 
b/clang/tools/clang-shlib/CMakeLists.txt
index aa7fcd1efed45..298d3a9d18fec 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,7 +50,7 @@ add_clang_library(clang-cpp
   ${_DEPS})
 # Optimize function calls for default visibility definitions to avoid PLT and
 # reduce dynamic relocations.
-if (NOT APPLE AND NOT MINGW)
+if (NOT APPLE AND NOT MINGW AND NOT LLVM_LINKER_IS_SOLARISLD_ILLUMOS)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()
 if (MINGW OR CYGWIN)
diff --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 4f23065a24727..1cfc46eb1a52f 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -185,11 +185,22 @@ if(ENABLE_SHARED)
 endif()
   endif()
   if (USE_VERSION_SCRIPT)
-target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
-# The Solaris 11.4 linker supports a subset of GNU ld version scripts,
-# but requires a special option to enable it.
 if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-  target_link_options(libclang PRIVATE "-Wl,-z,gnu-version-script-compat")
+  include(CheckLinkerFlag)
+  # The Solaris 11.4 linker supports a subset of GNU ld version scripts,
+  # but requires a special option to enable it.
+  llvm_check_linker_flag(CXX "-Wl,-z,gnu-version-script-compat"
+ LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+  # Older Solaris (and illumos) linker does not support GNU ld version 
scripts
+  # and does not support GNU version script compat.
+  if (LINKER_SUPPORTS_Z_GNU_VERSION_SCRIPT_COMPAT)
+target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+target_link_options(libclang PRIVATE 
"-Wl,-z,gnu-version-script-compat")
+  else()
+target_link_options(libclang PRIVATE 
"-Wl,-M,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+  endif()
+else()
+  target_link_options(libclang PRIVATE 
"-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
 endif()
 # Ensure that libclang.so gets rebuilt when the linker script changes.
 set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index c9bca30c8f33d..ca146ad699ff6 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -115,7 +115,7 @@ function(add_llvm_symbol_exports target_name export_file)
   DEPENDS ${export_file}
   VERBATIM
   COMMENT "Creating export file for ${target_name}")
-if (${LLVM_LINKER_IS_SOLARISLD})
+if ((${LLVM_LINKER_IS_SOLARISLD}) OR (${LLVM_LINKER_IS_SOLARISLD_ILLUMOS}))
   set_property(TARGET ${target_name} APPEND_STRING PROPERTY
LINK_FLAGS "  
-Wl,-M,\"${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}\"")
 else()
@@ -241,6 +241,11 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
   set(LLVM_LINKER_IS_GNULD YES CACHE INTERNAL "")
   message(STATUS "Linker detection: GNU ld")
+elseif("${stderr}" MATCHES "(illumos)" OR
+   "${stdout}" MATCHES "(illumos)")
+  set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
+  set(LLVM_LINKER_IS_SOLARISLD_ILLUMOS YES CACHE INTERNAL "")
+  message(STATUS "Linker detection: Solaris ld (illumos)")
 elseif("${stderr}" MATCHES "Solaris Link Editors" OR
"${stdout}" MATCHES "Solaris Link Editors")
   set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
@@ -282,11 +287,13 @@ 

[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)

2023-12-09 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay Any response to what [yxsamliu](https://github.com/yxsamliu) said?

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


[clang] [Driver] Mark -arch as TargetSpecific (PR #74365)

2023-12-04 Thread Brad Smith via cfe-commits

https://github.com/brad0 approved this pull request.


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


[clang] [clang-fuzzer] Remove GCC 4.x pre GCC 4.9 workaround to silence warning (PR #73974)

2023-12-02 Thread Brad Smith via cfe-commits

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


[clang] [Clang] Remove NetBSD/i386 workaround for FP eval method with older versions (PR #74025)

2023-12-01 Thread Brad Smith via cfe-commits

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


[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)

2023-12-01 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay

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


[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)

2023-12-01 Thread Brad Smith via cfe-commits

brad0 wrote:

> Why couldn't you have put this logic in `addLTOOptions`? Seems like it's 
> copy-pasted verbatim at every site now.
> 
> AMD should handle very similarly to Linux here. They both compile down to 
> LLVM-IR and get sent to `ld.lld`.

It's not my area, but I was thinking that would make more sense. I am just 
trying to ensure consistency with the various targets.

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


[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)

2023-12-01 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/74178

Copying 
https://github.com/llvm/llvm-project/commit/1881832994840baa6e42f908b8822ce4d15ab632
 to the last of the targets that use LTO.

But I am not sure about tests for these targets, especially the AMD toolchains.

Could the respective AMD and MinGW commiters please help here?

>From e475c3e4c3fdcb3fa869279ec65a2cf866b7d48e Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 11 Nov 2023 20:02:40 -0500
Subject: [PATCH] [Driver][LTO] Copy fix empty stats filename to AMDGPU,
 HIPAMD, MinGW

---
 clang/lib/Driver/ToolChains/AMDGPU.cpp | 15 ---
 clang/lib/Driver/ToolChains/HIPAMD.cpp | 10 +-
 clang/lib/Driver/ToolChains/MinGW.cpp  | 10 +-
 3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp 
b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index cad206ea4df1bc5..3776d3bbac811b9 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -611,10 +611,19 @@ void amdgpu::Linker::ConstructJob(Compilation , const 
JobAction ,
   addLinkerCompressDebugSectionsOption(getToolChain(), Args, CmdArgs);
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
-  if (C.getDriver().isUsingLTO())
-addLTOOptions(getToolChain(), Args, CmdArgs, Output, Inputs[0],
+  if (C.getDriver().isUsingLTO()) {
+assert(!Inputs.empty() && "Must have at least one input.");
+// Find the first filename InputInfo object.
+auto Input = llvm::find_if(
+Inputs, [](const InputInfo ) -> bool { return II.isFilename(); });
+if (Input == Inputs.end())
+  // For a very rare case, all of the inputs to the linker are
+  // InputArg. If that happens, just use the first InputInfo.
+  Input = Inputs.begin();
+
+addLTOOptions(getToolChain(), Args, CmdArgs, Output, *Input,
   C.getDriver().getLTOMode() == LTOK_Thin);
-  else if (Args.hasArg(options::OPT_mcpu_EQ))
+  } else if (Args.hasArg(options::OPT_mcpu_EQ))
 CmdArgs.push_back(Args.MakeArgString(
 "-plugin-opt=mcpu=" + Args.getLastArgValue(options::OPT_mcpu_EQ)));
   CmdArgs.push_back("-o");
diff --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp 
b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index ccb36a6c846c806..24f3db9001e1dd6 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -119,8 +119,16 @@ void AMDGCN::Linker::constructLldCommand(Compilation , 
const JobAction ,
   auto  = getToolChain();
   auto  = TC.getDriver();
   assert(!Inputs.empty() && "Must have at least one input.");
+  // Find the first filename InputInfo object.
+  auto Input = llvm::find_if(
+  Inputs, [](const InputInfo ) -> bool { return II.isFilename(); });
+  if (Input == Inputs.end())
+// For a very rare case, all of the inputs to the linker are
+// InputArg. If that happens, just use the first InputInfo.
+Input = Inputs.begin();
+
   bool IsThinLTO = D.getLTOMode(/*IsOffload=*/true) == LTOK_Thin;
-  addLTOOptions(TC, Args, LldArgs, Output, Inputs[0], IsThinLTO);
+  addLTOOptions(TC, Args, LldArgs, Output, *Input, IsThinLTO);
 
   // Extract all the -m options
   std::vector Features;
diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 5d7f8675daf8d28..066566eb02e4983 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -243,7 +243,15 @@ void tools::MinGW::Linker::ConstructJob(Compilation , 
const JobAction ,
 
   if (D.isUsingLTO()) {
 assert(!Inputs.empty() && "Must have at least one input.");
-addLTOOptions(TC, Args, CmdArgs, Output, Inputs[0],
+// Find the first filename InputInfo object.
+auto Input = llvm::find_if(
+Inputs, [](const InputInfo ) -> bool { return II.isFilename(); });
+if (Input == Inputs.end())
+  // For a very rare case, all of the inputs to the linker are
+  // InputArg. If that happens, just use the first InputInfo.
+  Input = Inputs.begin();
+
+addLTOOptions(TC, Args, CmdArgs, Output, *Input,
   D.getLTOMode() == LTOK_Thin);
   }
 

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


[clang] [Clang] Remove NetBSD/i386 workaround for FP eval method with older versions (PR #74025)

2023-12-01 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74025

>From 68942fe871a37e59c686c177aa43e63f08d730aa Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 30 Nov 2023 20:50:01 -0500
Subject: [PATCH] [Clang] Remove NetBSD/i386 workaround for FP eval method with
 older versions

NetBSD 7.x is long EoL. Make 8.x the minimum.
---
 clang/lib/Basic/Targets/X86.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 99a64501d263ce4..f03edccf7a13c57 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -507,15 +507,6 @@ class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
 public:
   NetBSDI386TargetInfo(const llvm::Triple , const TargetOptions )
   : NetBSDTargetInfo(Triple, Opts) {}
-
-  LangOptions::FPEvalMethodKind getFPEvalMethod() const override {
-VersionTuple OsVersion = getTriple().getOSVersion();
-// New NetBSD uses the default rounding mode.
-if (OsVersion >= VersionTuple(6, 99, 26) || OsVersion.getMajor() == 0)
-  return X86_32TargetInfo::getFPEvalMethod();
-// NetBSD before 6.99.26 defaults to "double" rounding.
-return LangOptions::FPEvalMethodKind::FEM_Double;
-  }
 };
 
 class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo

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


[clang] 357b8b4 - [Driver] Remove tests for NetBSD 7. No longer supported.

2023-12-01 Thread Brad Smith via cfe-commits

Author: Brad Smith
Date: 2023-12-01T18:56:22-05:00
New Revision: 357b8b46b125810c5c383c485b1fb3f3db233759

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

LOG: [Driver] Remove tests for NetBSD 7. No longer supported.

Added: 


Modified: 
clang/test/CodeGen/X86/fp-eval-method.c
clang/test/Driver/netbsd.c
clang/test/Driver/netbsd.cpp

Removed: 




diff  --git a/clang/test/CodeGen/X86/fp-eval-method.c 
b/clang/test/CodeGen/X86/fp-eval-method.c
index d74f88b9fe255a1..c1d8f617400d517 100644
--- a/clang/test/CodeGen/X86/fp-eval-method.c
+++ b/clang/test/CodeGen/X86/fp-eval-method.c
@@ -1,7 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-netbsd6 -emit-llvm -o - %s \
-// RUN: | FileCheck %s -check-prefixes=CHECK
-
-// RUN: %clang_cc1 -triple i386-unknown-netbsd7 -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple i386-unknown-netbsd -emit-llvm -o - %s \
 // RUN: | FileCheck %s -check-prefixes=CHECK-EXT
 
 // RUN: %clang_cc1 -triple i386--linux -emit-llvm -o - %s \

diff  --git a/clang/test/Driver/netbsd.c b/clang/test/Driver/netbsd.c
index 1452e9e2dc6e3c0..73777e7a3e38fa3 100644
--- a/clang/test/Driver/netbsd.c
+++ b/clang/test/Driver/netbsd.c
@@ -14,21 +14,12 @@
 // RUN: %clang --target=x86_64-unknown-netbsd \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=X86_64 %s
-// RUN: %clang --target=x86_64-unknown-netbsd7.0.0 \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=X86_64-7 %s
 // RUN: %clang --target=aarch64-unknown-netbsd \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=AARCH64 %s
-// RUN: %clang --target=aarch64-unknown-netbsd7.0.0 \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=AARCH64-7 %s
 // RUN: %clang --target=aarch64_be-unknown-netbsd \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=AARCH64_BE %s
-// RUN: %clang --target=aarch64_be-unknown-netbsd7.0.0 \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=AARCH64_BE-7 %s
 // RUN: %clang --target=arm-unknown-netbsd-eabi \
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=ARM %s
@@ -56,9 +47,6 @@
 // RUN: %clang --target=thumbeb-unknown-netbsd-eabi \
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=THUMBEB %s
-// RUN: %clang --target=arm-unknown-netbsd7.0.0-eabi \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=ARM-7 %s
 // RUN: %clang --target=riscv32-unknown-netbsd \
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=RISCV32 %s
@@ -81,42 +69,18 @@
 // RUN: %clang --target=x86_64-unknown-netbsd -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=S-X86_64 %s
-// RUN: %clang --target=x86_64-unknown-netbsd7.0.0 -static \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=S-X86_64-7 %s
 // RUN: %clang --target=aarch64-unknown-netbsd -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=S-AARCH64 %s
-// RUN: %clang --target=aarch64-unknown-netbsd7.0.0 -static \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=S-AARCH64-7 %s
 // RUN: %clang --target=aarch64_be-unknown-netbsd -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=S-AARCH64_BE %s
-// RUN: %clang --target=aarch64_be-unknown-netbsd7.0.0 -static \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=S-AARCH64_BE-7 %s
 // RUN: %clang --target=arm-unknown-netbsd-eabi -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=S-ARM %s
 // RUN: %clang --target=armeb-unknown-netbsd-eabi -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
 // RUN: | FileCheck -check-prefix=S-ARMEB %s
-// RUN: %clang --target=arm-unknown-netbsd7.0.0-eabi -static \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=S-ARM-7 %s
-// RUN: %clang --target=riscv32-unknown-netbsd7.0.0 -static \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck -check-prefix=S-RISCV32-7 %s
-// RUN: %clang --target=riscv64-unknown-netbsd7.0.0 -static \
-// RUN: --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
-// RUN: | FileCheck 

[clang] Clang/MIPS: Use -mnan value for -mabs if not specified (PR #71157)

2023-11-30 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay Ping.

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


[clang] [Clang] Remove NetBSD/i386 workaround for FP eval method with older versions (PR #74025)

2023-11-30 Thread Brad Smith via cfe-commits

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


[clang] [Clang] Remove NetBSD workaround for FP eval method with older versions (PR #74025)

2023-11-30 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74025

>From 00b44ae89a46af7159087789c25ba5c4942eca6f Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 30 Nov 2023 20:50:01 -0500
Subject: [PATCH] [Clang] Remove NetBSD/i386 workaround for FP eval method with
 older versions

NetBSD 7.x is long EoL. Make 8.x the minimum.
---
 clang/lib/Basic/Targets/X86.h   | 9 -
 clang/test/CodeGen/X86/fp-eval-method.c | 5 +
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 99a64501d263ce4..f03edccf7a13c57 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -507,15 +507,6 @@ class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
 public:
   NetBSDI386TargetInfo(const llvm::Triple , const TargetOptions )
   : NetBSDTargetInfo(Triple, Opts) {}
-
-  LangOptions::FPEvalMethodKind getFPEvalMethod() const override {
-VersionTuple OsVersion = getTriple().getOSVersion();
-// New NetBSD uses the default rounding mode.
-if (OsVersion >= VersionTuple(6, 99, 26) || OsVersion.getMajor() == 0)
-  return X86_32TargetInfo::getFPEvalMethod();
-// NetBSD before 6.99.26 defaults to "double" rounding.
-return LangOptions::FPEvalMethodKind::FEM_Double;
-  }
 };
 
 class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
diff --git a/clang/test/CodeGen/X86/fp-eval-method.c 
b/clang/test/CodeGen/X86/fp-eval-method.c
index d74f88b9fe255a1..c1d8f617400d517 100644
--- a/clang/test/CodeGen/X86/fp-eval-method.c
+++ b/clang/test/CodeGen/X86/fp-eval-method.c
@@ -1,7 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-netbsd6 -emit-llvm -o - %s \
-// RUN: | FileCheck %s -check-prefixes=CHECK
-
-// RUN: %clang_cc1 -triple i386-unknown-netbsd7 -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple i386-unknown-netbsd -emit-llvm -o - %s \
 // RUN: | FileCheck %s -check-prefixes=CHECK-EXT
 
 // RUN: %clang_cc1 -triple i386--linux -emit-llvm -o - %s \

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


[clang] [Clang] Remove NetBSD workaround for FP eval method with older versions (PR #74025)

2023-11-30 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/74025

NetBSD 7.x is long EoL. Make 8.x the minimum.

>From 90064d300b35f1eef7245d907d7f881d149020d1 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 30 Nov 2023 20:50:01 -0500
Subject: [PATCH] [Clang] Remove NetBSD workaround for FP eval method with
 older versions

NetBSD 7.x is long EoL. Make 8.x the minimum.
---
 clang/lib/Basic/Targets/X86.h   | 9 -
 clang/test/CodeGen/X86/fp-eval-method.c | 5 +
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 99a64501d263ce4..f03edccf7a13c57 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -507,15 +507,6 @@ class LLVM_LIBRARY_VISIBILITY NetBSDI386TargetInfo
 public:
   NetBSDI386TargetInfo(const llvm::Triple , const TargetOptions )
   : NetBSDTargetInfo(Triple, Opts) {}
-
-  LangOptions::FPEvalMethodKind getFPEvalMethod() const override {
-VersionTuple OsVersion = getTriple().getOSVersion();
-// New NetBSD uses the default rounding mode.
-if (OsVersion >= VersionTuple(6, 99, 26) || OsVersion.getMajor() == 0)
-  return X86_32TargetInfo::getFPEvalMethod();
-// NetBSD before 6.99.26 defaults to "double" rounding.
-return LangOptions::FPEvalMethodKind::FEM_Double;
-  }
 };
 
 class LLVM_LIBRARY_VISIBILITY OpenBSDI386TargetInfo
diff --git a/clang/test/CodeGen/X86/fp-eval-method.c 
b/clang/test/CodeGen/X86/fp-eval-method.c
index d74f88b9fe255a1..c1d8f617400d517 100644
--- a/clang/test/CodeGen/X86/fp-eval-method.c
+++ b/clang/test/CodeGen/X86/fp-eval-method.c
@@ -1,7 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-netbsd6 -emit-llvm -o - %s \
-// RUN: | FileCheck %s -check-prefixes=CHECK
-
-// RUN: %clang_cc1 -triple i386-unknown-netbsd7 -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple i386-unknown-netbsd -emit-llvm -o - %s \
 // RUN: | FileCheck %s -check-prefixes=CHECK-EXT
 
 // RUN: %clang_cc1 -triple i386--linux -emit-llvm -o - %s \

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


[clang] [Driver] Remove support for FreeBSD 11.x (PR #73392)

2023-11-30 Thread Brad Smith via cfe-commits

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


[clang] [Driver] Remove support for FreeBSD 11.x (PR #73392)

2023-11-30 Thread Brad Smith via cfe-commits

brad0 wrote:

Thanks.

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


[clang] [clang-fuzzer] Remove GCC 4.x pre GCC 4.9 workaround to silence warning (PR #73974)

2023-11-30 Thread Brad Smith via cfe-commits

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


[clang] [clang-fuzzer] Remove GCC 4.x pre GCC 4.9 workaround to silence warning (PR #73974)

2023-11-30 Thread Brad Smith via cfe-commits

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


[clang] [clang-fuzzer] Remove GCC 4.9 workaround to silence warning (PR #73974)

2023-11-30 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/73974

>From 30168e3a9b832b5af977813fc4844465e3b63280 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 30 Nov 2023 14:53:34 -0500
Subject: [PATCH] [clang-fuzzer] Remove GCC 4.x pre GCC 4.9 workaround to
 silence warning

The minimum GCC version was bumped up from 4.8 to 5.1 and then even newer
awhile ago so garbage collect the pre 4.9 workaround.

https://reviews.llvm.org/D66188
---
 .../clang-fuzzer/handle-llvm/handle_llvm.cpp | 16 
 1 file changed, 16 deletions(-)

diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp 
b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
index 3d39d69e6c2b422..798b34b3ef0afd2 100644
--- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -185,23 +185,7 @@ static void CreateAndRunJITFunc(const std::string , 
CodeGenOptLevel OLvl) {
   EE->finalizeObject();
   EE->runStaticConstructorsDestructors(false);
 
-#if defined(__GNUC__) && !defined(__clang) &&  
\
-((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
-// Silence
-//
-//   warning: ISO C++ forbids casting between pointer-to-function and
-//   pointer-to-object [-Wpedantic]
-//
-// Since C++11 this casting is conditionally supported and GCC versions
-// starting from 4.9.0 don't warn about the cast.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
   LLVMFunc f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
-#if defined(__GNUC__) && !defined(__clang) &&  
\
-((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
-#pragma GCC diagnostic pop
-#endif
 
   // Figure out if we are running the optimized func or the unoptimized func
   RunFuncOnInputs(f, (OLvl == CodeGenOptLevel::None) ? UnoptArrays : 
OptArrays);

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


[clang] [clang-fuzzer] Remove GCC 4.9 workaround to silence warning (PR #73974)

2023-11-30 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/73974

The minimum GCC version was bumped up from 4.8 to 5.1 and then even newer 
awhile ago so garbage collect the 4.9 workaround.

https://reviews.llvm.org/D66188

>From 5897fa680892ea05759f038554ea190fda92172c Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 30 Nov 2023 14:53:34 -0500
Subject: [PATCH] [clang-fuzzer] Remove GCC 4.9 workaround to silence warning

The minimum GCC version was bumped up from 4.8 to 5.1 and then even newer
awhile ago so garbage collect the 4.9 workaround.

https://reviews.llvm.org/D66188
---
 .../clang-fuzzer/handle-llvm/handle_llvm.cpp | 16 
 1 file changed, 16 deletions(-)

diff --git a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp 
b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
index 3d39d69e6c2b422..798b34b3ef0afd2 100644
--- a/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
+++ b/clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp
@@ -185,23 +185,7 @@ static void CreateAndRunJITFunc(const std::string , 
CodeGenOptLevel OLvl) {
   EE->finalizeObject();
   EE->runStaticConstructorsDestructors(false);
 
-#if defined(__GNUC__) && !defined(__clang) &&  
\
-((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
-// Silence
-//
-//   warning: ISO C++ forbids casting between pointer-to-function and
-//   pointer-to-object [-Wpedantic]
-//
-// Since C++11 this casting is conditionally supported and GCC versions
-// starting from 4.9.0 don't warn about the cast.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
   LLVMFunc f = reinterpret_cast(EE->getPointerToFunction(EntryFunc));
-#if defined(__GNUC__) && !defined(__clang) &&  
\
-((__GNUC__ == 4) && (__GNUC_MINOR__ < 9))
-#pragma GCC diagnostic pop
-#endif
 
   // Figure out if we are running the optimized func or the unoptimized func
   RunFuncOnInputs(f, (OLvl == CodeGenOptLevel::None) ? UnoptArrays : 
OptArrays);

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


[clang] [Driver] Remove support for FreeBSD 11.x (PR #73392)

2023-11-30 Thread Brad Smith via cfe-commits

brad0 wrote:

Ping.

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


[libc] [flang] [libcxxabi] [libcxx] [clang] [lld] [llvm] [clang-tools-extra] [lldb] [flang] Pass Argv0 to getIntriniscDir and getOpenMPHeadersDir (PR #73254)

2023-11-28 Thread Brad Smith via cfe-commits

brad0 wrote:

It would be nice to get this in so Flang is buildable.

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


[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-27 Thread Brad Smith via cfe-commits


@@ -18,3 +18,38 @@
 ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
 ! MSVC-LINKER-OPTIONS-SAME: "-dll"
 ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
+
+! Verify that certain linker flags are known to the frontend and are not 
passed on
+! to the linker.

brad0 wrote:

Well ya, the original wording that I copied was wrong. The tests are testing 
Driver flags and how the Driver behaves.

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


[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-27 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601

>From aeb9e987b91ab9ff63ed7bc38f42a59960e0295b Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Wed, 15 Nov 2023 14:24:11 -0500
Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and
 -nostdlib

---
 clang/include/clang/Driver/Options.td |  9 ---
 flang/test/Driver/dynamic-linker.f90  | 39 +--
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 9689f12fd01417b..7f5d705e74778c6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5164,7 +5164,8 @@ def : Flag<["-"], "nocudalib">, Alias;
 def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Link the LLVM C Library for GPUs">;
 def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
+  Visibility<[ClangOption, FlangOption]>;
 def nodriverkitlib : Flag<["-"], "nodriverkitlib">;
 def nofixprebinding : Flag<["-"], "nofixprebinding">;
 def nolibc : Flag<["-"], "nolibc">;
@@ -5174,7 +5175,8 @@ def no_pie : Flag<["-"], "no-pie">, 
Visibility<[ClangOption, FlangOption]>;
 def noprebind : Flag<["-"], "noprebind">;
 def noprofilelib : Flag<["-"], "noprofilelib">;
 def noseglinkedit : Flag<["-"], "noseglinkedit">;
-def nostartfiles : Flag<["-"], "nostartfiles">, Group;
+def nostartfiles : Flag<["-"], "nostartfiles">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdinc : Flag<["-"], "nostdinc">,
   Visibility<[ClangOption, CLOption, DXCOption]>, Group;
 def nostdlibinc : Flag<["-"], "nostdlibinc">, Group;
@@ -5182,7 +5184,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, 
Visibility<[ClangOption, CC1Option]>
   Group,
   HelpText<"Disable standard #include directories for the C++ standard 
library">,
   MarshallingInfoNegativeFlag>;
-def nostdlib : Flag<["-"], "nostdlib">, Group;
+def nostdlib : Flag<["-"], "nostdlib">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdlibxx : Flag<["-"], "nostdlib++">;
 def object : Flag<["-"], "object">;
 def o : JoinedOrSeparate<["-"], "o">,
diff --git a/flang/test/Driver/dynamic-linker.f90 
b/flang/test/Driver/dynamic-linker.f90
index df119c22a2ea516..f0f6232ed5d9a3d 100644
--- a/flang/test/Driver/dynamic-linker.f90
+++ b/flang/test/Driver/dynamic-linker.f90
@@ -1,5 +1,5 @@
-! Verify that certain linker flags are known to the frontend and are passed on
-! to the linker.
+! Verify that Driver flags are known to the frontend and appropriate linker
+! flags are passed to the linker.
 
 ! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \
 ! RUN: -static %s 2>&1 | FileCheck \
@@ -18,3 +18,38 @@
 ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
 ! MSVC-LINKER-OPTIONS-SAME: "-dll"
 ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
+
+! Verify that Driver flags are known to the frontend and appropriate linker
+! flags are not passed to the linker.
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+
+! NOSTDLIB: "{{.*}}ld{{(.exe)?}}"
+! NOSTDLIB-NOT: crt{{[^.]+}}.o
+! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+
+! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}"
+! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" 
"-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+
+! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}"
+! NOSTARTFILES-NOT: crt{{[^.]+}}.o
+! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"

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


[clang] [libc] [clang-tools-extra] [libcxx] [lld] [llvm] [libcxxabi] [lldb] [flang] [flang] Pass Argv0 to getIntriniscDir and getOpenMPHeadersDir (PR #73254)

2023-11-27 Thread Brad Smith via cfe-commits

brad0 wrote:

I see you re-based 2 times. Does this look Ok as is? It would be good to add 
the AIX Driver bits once this goes in.

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


[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-27 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601

>From 150120669543b71b32a4e817a761c952f523d525 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Wed, 15 Nov 2023 14:24:11 -0500
Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and
 -nostdlib

---
 clang/include/clang/Driver/Options.td |  9 ---
 flang/test/Driver/dynamic-linker.f90  | 39 +--
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 9689f12fd01417b..7f5d705e74778c6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5164,7 +5164,8 @@ def : Flag<["-"], "nocudalib">, Alias;
 def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Link the LLVM C Library for GPUs">;
 def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
+  Visibility<[ClangOption, FlangOption]>;
 def nodriverkitlib : Flag<["-"], "nodriverkitlib">;
 def nofixprebinding : Flag<["-"], "nofixprebinding">;
 def nolibc : Flag<["-"], "nolibc">;
@@ -5174,7 +5175,8 @@ def no_pie : Flag<["-"], "no-pie">, 
Visibility<[ClangOption, FlangOption]>;
 def noprebind : Flag<["-"], "noprebind">;
 def noprofilelib : Flag<["-"], "noprofilelib">;
 def noseglinkedit : Flag<["-"], "noseglinkedit">;
-def nostartfiles : Flag<["-"], "nostartfiles">, Group;
+def nostartfiles : Flag<["-"], "nostartfiles">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdinc : Flag<["-"], "nostdinc">,
   Visibility<[ClangOption, CLOption, DXCOption]>, Group;
 def nostdlibinc : Flag<["-"], "nostdlibinc">, Group;
@@ -5182,7 +5184,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, 
Visibility<[ClangOption, CC1Option]>
   Group,
   HelpText<"Disable standard #include directories for the C++ standard 
library">,
   MarshallingInfoNegativeFlag>;
-def nostdlib : Flag<["-"], "nostdlib">, Group;
+def nostdlib : Flag<["-"], "nostdlib">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdlibxx : Flag<["-"], "nostdlib++">;
 def object : Flag<["-"], "object">;
 def o : JoinedOrSeparate<["-"], "o">,
diff --git a/flang/test/Driver/dynamic-linker.f90 
b/flang/test/Driver/dynamic-linker.f90
index df119c22a2ea516..e483a66ff884a5f 100644
--- a/flang/test/Driver/dynamic-linker.f90
+++ b/flang/test/Driver/dynamic-linker.f90
@@ -1,5 +1,5 @@
-! Verify that certain linker flags are known to the frontend and are passed on
-! to the linker.
+! Verify that Driver flags are known to the frontend and appropriate linker
+! flags are passed on.
 
 ! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \
 ! RUN: -static %s 2>&1 | FileCheck \
@@ -18,3 +18,38 @@
 ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
 ! MSVC-LINKER-OPTIONS-SAME: "-dll"
 ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
+
+! Verify that Driver flags are known to the frontend and appropriate linker
+! flags are not passed to the linker.
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+
+! NOSTDLIB: "{{.*}}ld{{(.exe)?}}"
+! NOSTDLIB-NOT: crt{{[^.]+}}.o
+! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+
+! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}"
+! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" 
"-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+
+! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}"
+! NOSTARTFILES-NOT: crt{{[^.]+}}.o
+! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"

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


[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-27 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601

>From b21b8b56e50171d803e8ae2b7cbd36a8baeacd35 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Wed, 15 Nov 2023 14:24:11 -0500
Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and
 -nostdlib

---
 clang/include/clang/Driver/Options.td |  9 ---
 flang/test/Driver/dynamic-linker.f90  | 39 +--
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 9689f12fd01417b..7f5d705e74778c6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5164,7 +5164,8 @@ def : Flag<["-"], "nocudalib">, Alias;
 def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Link the LLVM C Library for GPUs">;
 def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
+  Visibility<[ClangOption, FlangOption]>;
 def nodriverkitlib : Flag<["-"], "nodriverkitlib">;
 def nofixprebinding : Flag<["-"], "nofixprebinding">;
 def nolibc : Flag<["-"], "nolibc">;
@@ -5174,7 +5175,8 @@ def no_pie : Flag<["-"], "no-pie">, 
Visibility<[ClangOption, FlangOption]>;
 def noprebind : Flag<["-"], "noprebind">;
 def noprofilelib : Flag<["-"], "noprofilelib">;
 def noseglinkedit : Flag<["-"], "noseglinkedit">;
-def nostartfiles : Flag<["-"], "nostartfiles">, Group;
+def nostartfiles : Flag<["-"], "nostartfiles">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdinc : Flag<["-"], "nostdinc">,
   Visibility<[ClangOption, CLOption, DXCOption]>, Group;
 def nostdlibinc : Flag<["-"], "nostdlibinc">, Group;
@@ -5182,7 +5184,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, 
Visibility<[ClangOption, CC1Option]>
   Group,
   HelpText<"Disable standard #include directories for the C++ standard 
library">,
   MarshallingInfoNegativeFlag>;
-def nostdlib : Flag<["-"], "nostdlib">, Group;
+def nostdlib : Flag<["-"], "nostdlib">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdlibxx : Flag<["-"], "nostdlib++">;
 def object : Flag<["-"], "object">;
 def o : JoinedOrSeparate<["-"], "o">,
diff --git a/flang/test/Driver/dynamic-linker.f90 
b/flang/test/Driver/dynamic-linker.f90
index df119c22a2ea516..c6fbaf0dc37a689 100644
--- a/flang/test/Driver/dynamic-linker.f90
+++ b/flang/test/Driver/dynamic-linker.f90
@@ -1,5 +1,5 @@
-! Verify that certain linker flags are known to the frontend and are passed on
-! to the linker.
+! Verify that Driver flags are known to the frontend and appropraite linker
+! flags are passed on.
 
 ! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \
 ! RUN: -static %s 2>&1 | FileCheck \
@@ -18,3 +18,38 @@
 ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
 ! MSVC-LINKER-OPTIONS-SAME: "-dll"
 ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
+
+! Verify that Driver flags are known to the frontend and appropraite linker
+! flags are not passed to the linker.
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+
+! NOSTDLIB: "{{.*}}ld{{(.exe)?}}"
+! NOSTDLIB-NOT: crt{{[^.]+}}.o
+! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+
+! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}"
+! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" 
"-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+
+! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}"
+! NOSTARTFILES-NOT: crt{{[^.]+}}.o
+! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"

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


[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-27 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601

>From 2c6f2f7a56e00f873d07fbdec0b1031a17dc6dd4 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Wed, 15 Nov 2023 14:24:11 -0500
Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and
 -nostdlib

---
 clang/include/clang/Driver/Options.td |  9 ---
 flang/test/Driver/dynamic-linker.f90  | 35 +++
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 9689f12fd01417b..7f5d705e74778c6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5164,7 +5164,8 @@ def : Flag<["-"], "nocudalib">, Alias;
 def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Link the LLVM C Library for GPUs">;
 def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
+  Visibility<[ClangOption, FlangOption]>;
 def nodriverkitlib : Flag<["-"], "nodriverkitlib">;
 def nofixprebinding : Flag<["-"], "nofixprebinding">;
 def nolibc : Flag<["-"], "nolibc">;
@@ -5174,7 +5175,8 @@ def no_pie : Flag<["-"], "no-pie">, 
Visibility<[ClangOption, FlangOption]>;
 def noprebind : Flag<["-"], "noprebind">;
 def noprofilelib : Flag<["-"], "noprofilelib">;
 def noseglinkedit : Flag<["-"], "noseglinkedit">;
-def nostartfiles : Flag<["-"], "nostartfiles">, Group;
+def nostartfiles : Flag<["-"], "nostartfiles">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdinc : Flag<["-"], "nostdinc">,
   Visibility<[ClangOption, CLOption, DXCOption]>, Group;
 def nostdlibinc : Flag<["-"], "nostdlibinc">, Group;
@@ -5182,7 +5184,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, 
Visibility<[ClangOption, CC1Option]>
   Group,
   HelpText<"Disable standard #include directories for the C++ standard 
library">,
   MarshallingInfoNegativeFlag>;
-def nostdlib : Flag<["-"], "nostdlib">, Group;
+def nostdlib : Flag<["-"], "nostdlib">, Group,
+  Visibility<[ClangOption, FlangOption]>;
 def nostdlibxx : Flag<["-"], "nostdlib++">;
 def object : Flag<["-"], "object">;
 def o : JoinedOrSeparate<["-"], "o">,
diff --git a/flang/test/Driver/dynamic-linker.f90 
b/flang/test/Driver/dynamic-linker.f90
index df119c22a2ea516..aa90be5ac196e0e 100644
--- a/flang/test/Driver/dynamic-linker.f90
+++ b/flang/test/Driver/dynamic-linker.f90
@@ -18,3 +18,38 @@
 ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
 ! MSVC-LINKER-OPTIONS-SAME: "-dll"
 ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
+
+! Verify that certain linker flags are known to the frontend and are not 
passed on
+! to the linker.
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+
+! NOSTDLIB: "{{.*}}ld{{(.exe)?}}"
+! NOSTDLIB-NOT: crt{{[^.]+}}.o
+! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+
+! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}"
+! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" 
"-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+
+! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}"
+! NOSTARTFILES-NOT: crt{{[^.]+}}.o
+! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"

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


[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-27 Thread Brad Smith via cfe-commits


@@ -5152,7 +5152,8 @@ def : Flag<["-"], "nocudalib">, Alias;
 def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Link the LLVM C Library for GPUs">;
 def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;

brad0 wrote:

Ok, I'll remove them. It is easy enough to add them later on. I just don't want 
to tack on too many options if it does not make any sense and/or serves no 
purpose.

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


[clang] [Driver] Allow -e entry but reject -eentry (PR #72804)

2023-11-26 Thread Brad Smith via cfe-commits

https://github.com/brad0 approved this pull request.


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


[clang] [Driver] Remove support for FreeBSD 11.x (PR #73392)

2023-11-25 Thread Brad Smith via cfe-commits

https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/73392

Now that FreeBSD 14.0 has been released make the 12.x branch the oldest
supported releases. -fuse-init-array defaults to on. DWARF 4 is now the
default.

>From 95e05a6a5d78c7914e3dd2e77e6a44b95dc2eac2 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Sat, 25 Nov 2023 09:46:43 -0500
Subject: [PATCH] [Driver] Remove support for FreeBSD 11.x

Now that FreeBSD 14.0 has been released make the 12.x branch the oldest
supported releases. -fuse-init-array defaults to on. DWARF 4 is now the
default.
---
 clang/lib/Driver/ToolChains/FreeBSD.cpp | 17 -
 clang/lib/Driver/ToolChains/FreeBSD.h   |  6 +-
 clang/test/Driver/clang-g-opts.c|  8 
 clang/test/Driver/constructors.c|  4 
 clang/test/Driver/debug-options.c   | 13 +
 5 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp 
b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index d08764aeef77539..3be0bf3789e1c40 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -400,13 +400,6 @@ FreeBSD::FreeBSD(const Driver , const llvm::Triple 
,
 getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib"));
 }
 
-unsigned FreeBSD::GetDefaultDwarfVersion() const {
-  unsigned Major = getTriple().getOSMajorVersion();
-  if (Major >= 12 || Major == 0)
-return 4;
-  return 2;
-}
-
 void FreeBSD::AddClangSystemIncludeArgs(
 const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const {
@@ -510,13 +503,3 @@ SanitizerMask FreeBSD::getSupportedSanitizers() const {
   }
   return Res;
 }
-
-void FreeBSD::addClangTargetOptions(const ArgList ,
-ArgStringList ,
-Action::OffloadKind) const {
-  unsigned Major = getTriple().getOSMajorVersion();
-  if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
-  options::OPT_fno_use_init_array,
-  (Major >= 12 || Major == 0)))
-CC1Args.push_back("-fno-use-init-array");
-}
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.h 
b/clang/lib/Driver/ToolChains/FreeBSD.h
index 959cbf78ddc79d1..7ab63905ed4f991 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.h
+++ b/clang/lib/Driver/ToolChains/FreeBSD.h
@@ -82,14 +82,10 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
   getDefaultUnwindTableLevel(const llvm::opt::ArgList ) const override;
   bool isPIEDefault(const llvm::opt::ArgList ) const override;
   SanitizerMask getSupportedSanitizers() const override;
-  unsigned GetDefaultDwarfVersion() const override;
+  unsigned GetDefaultDwarfVersion() const override { return 4; }
   // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
   // FreeBSD defaults to standalone/full debug info.
   bool GetDefaultStandaloneDebug() const override { return true; }
-  void
-  addClangTargetOptions(const llvm::opt::ArgList ,
-llvm::opt::ArgStringList ,
-Action::OffloadKind DeviceOffloadKind) const override;
 
 protected:
   Tool *buildAssembler() const override;
diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
index b1cdf411925aea1..b73602a155b0094 100644
--- a/clang/test/Driver/clang-g-opts.c
+++ b/clang/test/Driver/clang-g-opts.c
@@ -7,8 +7,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target i686-pc-openbsd 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
-// RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g -target x86_64-pc-freebsd 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 // RUN: %clang -### -S %s -g --target=x86_64-unknown-haiku 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 
@@ -27,8 +27,8 @@
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-STANDALONE %s
 // RUN: %clang -### -S %s -g0 -g -target i686-pc-openbsd 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
-// RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd10.0 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
+// RUN: %clang -### -S %s -g0 -g -target x86_64-pc-freebsd 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 // RUN: %clang -### -S %s -g0 -g --target=x86_64-unknown-haiku 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF4 %s
 // RUN: %clang -### -S %s -g0 -g --target=i386-pc-solaris 2>&1 \
diff --git a/clang/test/Driver/constructors.c b/clang/test/Driver/constructors.c
index 45d6dd6cb171e46..1cb3aec840c2d91 100644
--- a/clang/test/Driver/constructors.c
+++ b/clang/test/Driver/constructors.c
@@ -75,10 +75,6 @@
 // RUN: 

[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-22 Thread Brad Smith via cfe-commits

brad0 wrote:

@MaskRay Still could use some input about the ```CLOption, DXCOption``` part. 
Same with 34e4e5eb70818fca90574beb8f5617e27bfac138.

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


[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-22 Thread Brad Smith via cfe-commits

brad0 wrote:


> It would be helpful if you could clearly distinguish between the two opposite 
> cases that are currently being tested in "dynamic-linker.f90".

Ok, done.

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


[flang] [clang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-22 Thread Brad Smith via cfe-commits

https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/72601

>From da17459071b039e9da0f53ae5e68ab1c3aaa13e4 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Wed, 15 Nov 2023 14:24:11 -0500
Subject: [PATCH] [flang][Driver] Support -nodefaultlibs, -nostartfiles and
 -nostdlib

---
 clang/include/clang/Driver/Options.td |  9 ---
 flang/test/Driver/dynamic-linker.f90  | 35 +++
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b2f2bcb6ac37910..bc04c53d7c76b9d 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5152,7 +5152,8 @@ def : Flag<["-"], "nocudalib">, Alias;
 def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option]>,
   HelpText<"Link the LLVM C Library for GPUs">;
 def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
+  Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>;
 def nodriverkitlib : Flag<["-"], "nodriverkitlib">;
 def nofixprebinding : Flag<["-"], "nofixprebinding">;
 def nolibc : Flag<["-"], "nolibc">;
@@ -5162,7 +5163,8 @@ def no_pie : Flag<["-"], "no-pie">, 
Visibility<[ClangOption, FlangOption]>;
 def noprebind : Flag<["-"], "noprebind">;
 def noprofilelib : Flag<["-"], "noprofilelib">;
 def noseglinkedit : Flag<["-"], "noseglinkedit">;
-def nostartfiles : Flag<["-"], "nostartfiles">, Group;
+def nostartfiles : Flag<["-"], "nostartfiles">, Group,
+  Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>;
 def nostdinc : Flag<["-"], "nostdinc">,
   Visibility<[ClangOption, CLOption, DXCOption]>, Group;
 def nostdlibinc : Flag<["-"], "nostdlibinc">, Group;
@@ -5170,7 +5172,8 @@ def nostdincxx : Flag<["-"], "nostdinc++">, 
Visibility<[ClangOption, CC1Option]>
   Group,
   HelpText<"Disable standard #include directories for the C++ standard 
library">,
   MarshallingInfoNegativeFlag>;
-def nostdlib : Flag<["-"], "nostdlib">, Group;
+def nostdlib : Flag<["-"], "nostdlib">, Group,
+  Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>;
 def nostdlibxx : Flag<["-"], "nostdlib++">;
 def object : Flag<["-"], "object">;
 def o : JoinedOrSeparate<["-"], "o">,
diff --git a/flang/test/Driver/dynamic-linker.f90 
b/flang/test/Driver/dynamic-linker.f90
index df119c22a2ea516..aa90be5ac196e0e 100644
--- a/flang/test/Driver/dynamic-linker.f90
+++ b/flang/test/Driver/dynamic-linker.f90
@@ -18,3 +18,38 @@
 ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
 ! MSVC-LINKER-OPTIONS-SAME: "-dll"
 ! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
+
+! Verify that certain linker flags are known to the frontend and are not 
passed on
+! to the linker.
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostdlib %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostdlib %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=NOSTDLIB %s
+
+! NOSTDLIB: "{{.*}}ld{{(.exe)?}}"
+! NOSTDLIB-NOT: crt{{[^.]+}}.o
+! NOSTDLIB-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nodefaultlibs %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NODEFAULTLIBS %s
+
+! NODEFAULTLIBS: "{{.*}}ld{{(.exe)?}}"
+! NODEFAULTLIBS-NOT: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" 
"-lm"
+
+! RUN: %flang -### --target=x86_64-unknown-freebsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=x86_64-unknown-netbsd -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+! RUN: %flang -### --target=i386-pc-solaris2.11 -nostartfiles %s 2>&1 | 
FileCheck \
+! RUN: --check-prefixes=NOSTARTFILES %s
+
+! NOSTARTFILES: "{{.*}}ld{{(.exe)?}}"
+! NOSTARTFILES-NOT: crt{{[^.]+}}.o
+! NOSTARTFILES: "-lFortran_main" "-lFortranRuntime" "-lFortranDecimal" "-lm"

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


[clang] [flang] [flang][Driver] Support -nodefaultlibs, -nostartfiles and -nostdlib (PR #72601)

2023-11-21 Thread Brad Smith via cfe-commits

brad0 wrote:

Ping.

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


[clang] [Driver] Add support for -export-dynamic which can match GCC behavior. (PR #72781)

2023-11-20 Thread Brad Smith via cfe-commits

brad0 wrote:

I have never seen such usage before. You're supposed to use ```-rdynamic```.

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


[clang] [Driver] Make ELF -nopie specific to OpenBSD (PR #72578)

2023-11-20 Thread Brad Smith via cfe-commits

https://github.com/brad0 approved this pull request.


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


  1   2   3   4   5   >