"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Driver/ToolChains/Solaris.cpp" between
cfe-8.0.1.src.tar.xz and cfe-9.0.0.src.tar.xz

About: Clang is an LLVM front end for the C, C++, and Objective-C languages. Clang aims to provide a better user experience through expressive diagnostics, a high level of conformance to language standards, fast compilation, and low memory use.

Solaris.cpp  (cfe-8.0.1.src.tar.xz):Solaris.cpp  (cfe-9.0.0.src.tar.xz)
//===--- Solaris.cpp - Solaris ToolChain Implementations --------*- C++ -*-===// //===--- Solaris.cpp - Solaris ToolChain Implementations --------*- C++ -*-===//
// //
// The LLVM Compiler Infrastructure // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// // See https://llvm.org/LICENSE.txt for license information.
// This file is distributed under the University of Illinois Open Source // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// License. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "Solaris.h" #include "Solaris.h"
#include "CommonArgs.h" #include "CommonArgs.h"
#include "clang/Config/config.h" #include "clang/Config/config.h"
#include "clang/Driver/Compilation.h" #include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h" #include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h" #include "clang/Driver/Options.h"
skipping to change at line 69 skipping to change at line 68
CmdArgs.push_back("_start"); CmdArgs.push_back("_start");
} }
if (Args.hasArg(options::OPT_static)) { if (Args.hasArg(options::OPT_static)) {
CmdArgs.push_back("-Bstatic"); CmdArgs.push_back("-Bstatic");
CmdArgs.push_back("-dn"); CmdArgs.push_back("-dn");
} else { } else {
CmdArgs.push_back("-Bdynamic"); CmdArgs.push_back("-Bdynamic");
if (Args.hasArg(options::OPT_shared)) { if (Args.hasArg(options::OPT_shared)) {
CmdArgs.push_back("-shared"); CmdArgs.push_back("-shared");
} else {
CmdArgs.push_back("--dynamic-linker");
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("ld.so.1")));
} }
// libpthread has been folded into libc since Solaris 10, no need to do // libpthread has been folded into libc since Solaris 10, no need to do
// anything for pthreads. Claim argument to avoid warning. // anything for pthreads. Claim argument to avoid warning.
Args.ClaimAllArgs(options::OPT_pthread); Args.ClaimAllArgs(options::OPT_pthread);
Args.ClaimAllArgs(options::OPT_pthreads); Args.ClaimAllArgs(options::OPT_pthreads);
} }
if (Output.isFilename()) { if (Output.isFilename()) {
CmdArgs.push_back("-o"); CmdArgs.push_back("-o");
skipping to change at line 100 skipping to change at line 95
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crt1.o"))); Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o"))); CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o"))); Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o")));
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o"))); Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
} }
// Provide __start___sancov_guards. Solaris ld doesn't automatically create
// __start_SECNAME labels.
CmdArgs.push_back("--whole-archive");
CmdArgs.push_back(
getToolChain().getCompilerRTArgString(Args, "sancov_begin", false));
CmdArgs.push_back("--no-whole-archive");
getToolChain().AddFilePathLibArgs(Args, CmdArgs); getToolChain().AddFilePathLibArgs(Args, CmdArgs);
Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group, Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
options::OPT_e, options::OPT_r}); options::OPT_e, options::OPT_r});
bool NeedsSanitizerDeps = addSanitizerRuntimes(getToolChain(), Args, CmdArgs); bool NeedsSanitizerDeps = addSanitizerRuntimes(getToolChain(), Args, CmdArgs);
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
if (getToolChain().ShouldLinkCXXStdlib(Args)) if (getToolChain().ShouldLinkCXXStdlib(Args))
skipping to change at line 135 skipping to change at line 123
CmdArgs.push_back("-lgcc_s"); CmdArgs.push_back("-lgcc_s");
CmdArgs.push_back("-lc"); CmdArgs.push_back("-lc");
if (!Args.hasArg(options::OPT_shared)) { if (!Args.hasArg(options::OPT_shared)) {
CmdArgs.push_back("-lgcc"); CmdArgs.push_back("-lgcc");
CmdArgs.push_back("-lm"); CmdArgs.push_back("-lm");
} }
if (NeedsSanitizerDeps) if (NeedsSanitizerDeps)
linkSanitizerRuntimeDeps(getToolChain(), CmdArgs); linkSanitizerRuntimeDeps(getToolChain(), CmdArgs);
} }
// Provide __stop___sancov_guards. Solaris ld doesn't automatically create
// __stop_SECNAME labels.
CmdArgs.push_back("--whole-archive");
CmdArgs.push_back(
getToolChain().getCompilerRTArgString(Args, "sancov_end", false));
CmdArgs.push_back("--no-whole-archive");
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) { if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crtend.o"))); Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
} }
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o"))); CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
getToolChain().addProfileRTLibs(Args, CmdArgs); getToolChain().addProfileRTLibs(Args, CmdArgs);
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs)); C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
skipping to change at line 203 skipping to change at line 184
addPathIfExists(D, D.SysRoot + "/usr/lib" + LibSuffix, Paths); addPathIfExists(D, D.SysRoot + "/usr/lib" + LibSuffix, Paths);
} }
SanitizerMask Solaris::getSupportedSanitizers() const { SanitizerMask Solaris::getSupportedSanitizers() const {
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
SanitizerMask Res = ToolChain::getSupportedSanitizers(); SanitizerMask Res = ToolChain::getSupportedSanitizers();
// FIXME: Omit X86_64 until 64-bit support is figured out. // FIXME: Omit X86_64 until 64-bit support is figured out.
if (IsX86) { if (IsX86) {
Res |= SanitizerKind::Address; Res |= SanitizerKind::Address;
Res |= SanitizerKind::PointerCompare;
Res |= SanitizerKind::PointerSubtract;
} }
Res |= SanitizerKind::Vptr; Res |= SanitizerKind::Vptr;
return Res; return Res;
} }
Tool *Solaris::buildAssembler() const { Tool *Solaris::buildAssembler() const {
return new tools::solaris::Assembler(*this); return new tools::solaris::Assembler(*this);
} }
Tool *Solaris::buildLinker() const { return new tools::solaris::Linker(*this); } Tool *Solaris::buildLinker() const { return new tools::solaris::Linker(*this); }
 End of changes. 5 change blocks. 
22 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)