Skip to content

Conversation

@brad0
Copy link
Contributor

@brad0 brad0 commented Jan 10, 2025

FreeBSD going forward will not have 32-bit arch support.

Also missed a spot with removing riscv32 support.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jan 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 10, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Brad Smith (brad0)

Changes

FreeBSD going forward will not have 32-bit arch support.

Also missed a spot with removing riscv32 support.


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

4 Files Affected:

  • (modified) clang/lib/Basic/Targets.cpp (-3)
  • (modified) clang/lib/Basic/Targets/OSTargets.h (+1-4)
  • (modified) clang/lib/Driver/ToolChains/FreeBSD.cpp (-4)
  • (modified) clang/test/Driver/freebsd.c (-3)
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index be5dedbe8044e2..872f2952a1bae2 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -735,9 +735,6 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
     case llvm::Triple::Linux:
         return std::make_unique<LinuxTargetInfo<LoongArch32TargetInfo>>(Triple,
                                                                         Opts);
-    case llvm::Triple::FreeBSD:
-      return std::make_unique<FreeBSDTargetInfo<LoongArch32TargetInfo>>(Triple,
-                                                                        Opts);
     default:
         return std::make_unique<LoongArch32TargetInfo>(Triple, Opts);
     }
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 53dd23c3129636..3408b008b2217c 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -228,11 +228,8 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo<Target> {
     case llvm::Triple::arm:
       this->MCountName = "__mcount";
       break;
-    case llvm::Triple::riscv32:
-    case llvm::Triple::riscv64:
-      break;
-    case llvm::Triple::loongarch32:
     case llvm::Triple::loongarch64:
+    case llvm::Triple::riscv64:
       break;
     }
   }
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index 88a27e3192827f..a6d859f0ebfec2 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -213,10 +213,6 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-m");
     CmdArgs.push_back("elf64lriscv");
     break;
-  case llvm::Triple::loongarch32:
-    CmdArgs.push_back("-m");
-    CmdArgs.push_back("elf32loongarch");
-    break;
   case llvm::Triple::loongarch64:
     CmdArgs.push_back("-m");
     CmdArgs.push_back("elf64loongarch");
diff --git a/clang/test/Driver/freebsd.c b/clang/test/Driver/freebsd.c
index a0787bab4feb8f..94db63278bfe97 100644
--- a/clang/test/Driver/freebsd.c
+++ b/clang/test/Driver/freebsd.c
@@ -79,9 +79,6 @@
 //
 // Check that LoongArch passes the correct linker emulation.
 //
-// RUN: %clang --target=loongarch32-freebsd -### %s %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-LA32-LD %s
-// CHECK-LA32-LD: ld{{.*}}" {{.*}} "-m" "elf32loongarch"
 // RUN: %clang --target=loongarch64-freebsd -### %s %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-LA64-LD %s
 // CHECK-LA64-LD: ld{{.*}}" {{.*}} "-m" "elf64loongarch"

@brad0 brad0 requested a review from emaste January 10, 2025 19:36
@github-actions
Copy link

github-actions bot commented Jan 10, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

FreeBSD going forward will not have 32-bit arch support.

Also missed a spot with removing riscv32 support.
@brad0 brad0 force-pushed the llvm_freebsd_loongarch branch from e2bec3c to b6b7ecf Compare January 10, 2025 20:05
@brad0 brad0 requested a review from brooksdavis January 13, 2025 00:13
@brad0
Copy link
Contributor Author

brad0 commented Jan 17, 2025

@emaste @brooksdavis

Copy link
Contributor

@SixWeining SixWeining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the LoongArch changes.

@brad0 brad0 merged commit 4294fe1 into llvm:main Jan 20, 2025
8 checks passed
@brad0 brad0 deleted the llvm_freebsd_loongarch branch January 20, 2025 03:23
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 20, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-libc-amdgpu-runtime running on omp-vega20-1 while building clang at step 7 "Add check check-offload".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/11996

Here is the relevant piece of the build log for the reference
Step 7 (Add check check-offload) failure: test (failure)
******************** TEST 'libomptarget :: amdgcn-amd-amdhsa :: offloading/pgo1.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang -fopenmp    -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib  -fopenmp-targets=amdgcn-amd-amdhsa /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp -Xoffload-linker -lc -Xoffload-linker -lm /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a -fprofile-instr-generate      -Xclang "-fprofile-instrument=clang"
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang -fopenmp -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -fopenmp-targets=amdgcn-amd-amdhsa /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp -Xoffload-linker -lc -Xoffload-linker -lm /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a -fprofile-instr-generate -Xclang -fprofile-instrument=clang
# RUN: at line 3
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp 2>&1 | /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c      --check-prefix="CLANG-PGO"
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/pgo1.c.tmp
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c --check-prefix=CLANG-PGO
# .---command stderr------------
# | /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c:32:20: error: CLANG-PGO-NEXT: expected string not found in input
# | // CLANG-PGO-NEXT: [ 0 11 20 ]
# |                    ^
# | <stdin>:3:28: note: scanning from here
# | ======== Counters =========
# |                            ^
# | <stdin>:4:1: note: possible intended match here
# | [ 0 14 20 ]
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/pgo1.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            1: ======= GPU Profile ======= 
# |            2: Target: amdgcn-amd-amdhsa 
# |            3: ======== Counters ========= 
# | next:32'0                                X error: no match found
# |            4: [ 0 14 20 ] 
# | next:32'0     ~~~~~~~~~~~~
# | next:32'1     ?            possible intended match
# |            5: [ 10 ] 
# | next:32'0     ~~~~~~~
# |            6: [ 20 ] 
# | next:32'0     ~~~~~~~
# |            7: ========== Data =========== 
# | next:32'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            8: { 9515997471539760012 4749112401 0xffffffffffffffd8 0x0 0x0 0x0 3 [...] 0 } 
# | next:32'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            9: { 3666282617048535130 24 0xffffffffffffffb0 0x0 0x0 0x0 1 [...] 0 } 
# | next:32'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
...

Copy link
Contributor

@brooksdavis brooksdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retroactive, but LGTM. No need to leave riscv32 around providing a confusing trail for future architectures.

yushanwei added a commit to yushanwei/freebsd-src that referenced this pull request Jun 15, 2025
backport from llvm20:
[clang][LoongArch] Add FreeBSD targets:
llvm/llvm-project#119191
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support:
llvm/llvm-project#122515

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
yushanwei added a commit to yushanwei/freebsd-src that referenced this pull request Jul 4, 2025
backport from llvm20:
[clang][LoongArch] Add FreeBSD targets:
llvm/llvm-project#119191
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support:
llvm/llvm-project#122515

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
yushanwei added a commit to yushanwei/freebsd-src that referenced this pull request Jul 16, 2025
backport from llvm20:
[clang][LoongArch] Add FreeBSD targets:
llvm/llvm-project#119191
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support:
llvm/llvm-project#122515

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
yushanwei added a commit to yushanwei/freebsd-src that referenced this pull request Jul 27, 2025
backport from llvm20:
[clang][LoongArch] Add FreeBSD targets:
llvm/llvm-project#119191
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support:
llvm/llvm-project#122515

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
yushanwei added a commit to yushanwei/freebsd-src that referenced this pull request Aug 20, 2025
backport from llvm20:
[clang][LoongArch] Add FreeBSD targets:
llvm/llvm-project#119191
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support:
llvm/llvm-project#122515

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
yushanwei added a commit to yushanwei/freebsd-src that referenced this pull request Sep 5, 2025
backport from llvm20:
[clang][LoongArch] Add FreeBSD targets:
llvm/llvm-project#119191
[Driver][FreeBSD] Remove FreeBSD/loongarch32 support:
llvm/llvm-project#122515

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants