xref: /freebsd/contrib/llvm-project/lld/Common/Utils.cpp (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric //===- Utils.cpp ------------------------------------------------*- C++-*-===//
2*700637cbSDimitry Andric //
3*700637cbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*700637cbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*700637cbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*700637cbSDimitry Andric //===----------------------------------------------------------------------===//
7*700637cbSDimitry Andric //
8*700637cbSDimitry Andric // The file defines utils functions that can be shared across archs.
9*700637cbSDimitry Andric //
10*700637cbSDimitry Andric //===----------------------------------------------------------------------===//
11*700637cbSDimitry Andric 
12*700637cbSDimitry Andric #include "lld/Common/Utils.h"
13*700637cbSDimitry Andric 
14*700637cbSDimitry Andric using namespace llvm;
15*700637cbSDimitry Andric using namespace lld;
16*700637cbSDimitry Andric 
getRootSymbol(StringRef name)17*700637cbSDimitry Andric StringRef lld::utils::getRootSymbol(StringRef name) {
18*700637cbSDimitry Andric   name.consume_back(".Tgm");
19*700637cbSDimitry Andric   auto [P0, S0] = name.rsplit(".llvm.");
20*700637cbSDimitry Andric   auto [P1, S1] = P0.rsplit(".__uniq.");
21*700637cbSDimitry Andric   return P1;
22*700637cbSDimitry Andric }
23