[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-14 Thread Alastair Houghton via cfe-commits

al45tair wrote:

Regardless of who provides them, if someone is relying on this then this is the 
wrong change. Closing.

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-14 Thread Alastair Houghton via cfe-commits

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Alastair Houghton via cfe-commits

al45tair wrote:

(I had assumed that they came from the C library, since that's where `crt1.o` 
comes from, but if they don't then it sounds like I just need to build them.)

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Alastair Houghton via cfe-commits

al45tair wrote:

> The compiler provides crtbegin/crtend files, not musl.

Interesting. Looking at the LLVM repo, it seems compiler-rt might provide them, 
but I don't believe I have them in spite of building compiler-rt. I'll look at 
this again and see if maybe I need to tweak my compiler-rt build to get it to 
generate or install them in the right place.

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Fangrui Song via cfe-commits

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Fangrui Song via cfe-commits

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay requested changes to this pull request.

Thanks for working on musl but I don't think this is correct.
A musl-cross-make build does use crtbegin/crtend, though technically the files 
can be empty.

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Alastair Houghton via cfe-commits

https://github.com/al45tair updated 
https://github.com/llvm/llvm-project/pull/85089

>From 8bdd6627e21eaddedfff208eebaa46f1eeb81674 Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Thu, 22 Feb 2024 11:36:57 +
Subject: [PATCH 1/2] [Clang] Don't use crtbegin/crtend when building for musl.

musl doesn't supply crtbegin/crtend objects, so we don't want to
try to link them there.

rdar://123436174
---
 clang/lib/Driver/ToolChains/Gnu.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index a9c9d2475809d7..7b7d9194a773ec 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -371,13 +371,15 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
, const JobAction ,
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily();
   const bool isAndroid = ToolChain.getTriple().isAndroid();
+  const bool isMusl = ToolChain.getTriple().isMusl();
   const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
   const bool IsVE = ToolChain.getTriple().isVE();
   const bool IsStaticPIE = getStaticPIE(Args, ToolChain);
   const bool IsStatic = getStatic(Args);
   const bool HasCRTBeginEndFiles =
-  ToolChain.getTriple().hasEnvironment() ||
-  (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);
+!isMusl && (ToolChain.getTriple().hasEnvironment() ||
+(ToolChain.getTriple().getVendor()
+ != llvm::Triple::MipsTechnologies));
 
   ArgStringList CmdArgs;
 

>From cb13d69df1ff750d9653a76186a8ac4626695470 Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Wed, 13 Mar 2024 16:05:09 +
Subject: [PATCH 2/2] [Clang] Tweak code formatting.

Tweak code formatting slightly to make clang-format happy.

rdar://123436174
---
 clang/lib/Driver/ToolChains/Gnu.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 7b7d9194a773ec..740a160cfa5c22 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -377,9 +377,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation , 
const JobAction ,
   const bool IsStaticPIE = getStaticPIE(Args, ToolChain);
   const bool IsStatic = getStatic(Args);
   const bool HasCRTBeginEndFiles =
-!isMusl && (ToolChain.getTriple().hasEnvironment() ||
-(ToolChain.getTriple().getVendor()
- != llvm::Triple::MipsTechnologies));
+  !isMusl &&
+  (ToolChain.getTriple().hasEnvironment() ||
+   (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies));
 
   ArgStringList CmdArgs;
 

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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 960b4aa6dab69125778f230c4c94f2d19c96cc87 
8bdd6627e21eaddedfff208eebaa46f1eeb81674 -- clang/lib/Driver/ToolChains/Gnu.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 7b7d9194a7..740a160cfa 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -377,9 +377,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation , 
const JobAction ,
   const bool IsStaticPIE = getStaticPIE(Args, ToolChain);
   const bool IsStatic = getStatic(Args);
   const bool HasCRTBeginEndFiles =
-!isMusl && (ToolChain.getTriple().hasEnvironment() ||
-(ToolChain.getTriple().getVendor()
- != llvm::Triple::MipsTechnologies));
+  !isMusl &&
+  (ToolChain.getTriple().hasEnvironment() ||
+   (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies));
 
   ArgStringList CmdArgs;
 

``




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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Alastair Houghton (al45tair)


Changes

musl doesn't supply crtbegin/crtend objects, so we don't want to try to link 
them there.

rdar://123436174

---
Full diff: https://github.com/llvm/llvm-project/pull/85089.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+4-2) 


``diff
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index a9c9d2475809d7..7b7d9194a773ec 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -371,13 +371,15 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
, const JobAction ,
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily();
   const bool isAndroid = ToolChain.getTriple().isAndroid();
+  const bool isMusl = ToolChain.getTriple().isMusl();
   const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
   const bool IsVE = ToolChain.getTriple().isVE();
   const bool IsStaticPIE = getStaticPIE(Args, ToolChain);
   const bool IsStatic = getStatic(Args);
   const bool HasCRTBeginEndFiles =
-  ToolChain.getTriple().hasEnvironment() ||
-  (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);
+!isMusl && (ToolChain.getTriple().hasEnvironment() ||
+(ToolChain.getTriple().getVendor()
+ != llvm::Triple::MipsTechnologies));
 
   ArgStringList CmdArgs;
 

``




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


[clang] [Clang] Don't use crtbegin/crtend when building for musl. (PR #85089)

2024-03-13 Thread Alastair Houghton via cfe-commits

https://github.com/al45tair created 
https://github.com/llvm/llvm-project/pull/85089

musl doesn't supply crtbegin/crtend objects, so we don't want to try to link 
them there.

rdar://123436174

>From 8bdd6627e21eaddedfff208eebaa46f1eeb81674 Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Thu, 22 Feb 2024 11:36:57 +
Subject: [PATCH] [Clang] Don't use crtbegin/crtend when building for musl.

musl doesn't supply crtbegin/crtend objects, so we don't want to
try to link them there.

rdar://123436174
---
 clang/lib/Driver/ToolChains/Gnu.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index a9c9d2475809d7..7b7d9194a773ec 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -371,13 +371,15 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
, const JobAction ,
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily();
   const bool isAndroid = ToolChain.getTriple().isAndroid();
+  const bool isMusl = ToolChain.getTriple().isMusl();
   const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
   const bool IsVE = ToolChain.getTriple().isVE();
   const bool IsStaticPIE = getStaticPIE(Args, ToolChain);
   const bool IsStatic = getStatic(Args);
   const bool HasCRTBeginEndFiles =
-  ToolChain.getTriple().hasEnvironment() ||
-  (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);
+!isMusl && (ToolChain.getTriple().hasEnvironment() ||
+(ToolChain.getTriple().getVendor()
+ != llvm::Triple::MipsTechnologies));
 
   ArgStringList CmdArgs;
 

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