clang 20.0.0git
PPCLinux.cpp
Go to the documentation of this file.
1//===-- PPCLinux.cpp - PowerPC ToolChain Implementations --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "PPCLinux.h"
10#include "clang/Driver/Driver.h"
13#include "llvm/Support/FileSystem.h"
14#include "llvm/Support/Path.h"
15
16using namespace clang::driver;
17using namespace clang::driver::toolchains;
18using namespace llvm::opt;
19using namespace llvm::sys;
20
21// Glibc older than 2.32 doesn't fully support IEEE float128. Here we check
22// glibc version by looking at dynamic linker name.
23static bool GlibcSupportsFloat128(const std::string &Linker) {
25
26 // Resolve potential symlinks to linker.
27 if (fs::real_path(Linker, Path))
28 return false;
29 llvm::StringRef LinkerName =
30 path::filename(llvm::StringRef(Path.data(), Path.size()));
31
32 // Since glibc 2.34, the installed .so file is not symlink anymore. But we can
33 // still safely assume it's newer than 2.32.
34 if (LinkerName.starts_with("ld64.so"))
35 return true;
36
37 if (!LinkerName.starts_with("ld-2."))
38 return false;
39 unsigned Minor = (LinkerName[5] - '0') * 10 + (LinkerName[6] - '0');
40 if (Minor < 32)
41 return false;
42
43 return true;
44}
45