
``` /// Symbols can be appended with "(.__uniq.xxxx)?.llvm.yyyy" where "xxxx" and /// "yyyy" are numbers that could change between builds. We need to use the root /// symbol name before this suffix so these symbols can be matched with profiles /// which may have different suffixes. ``` Just like what we are doing in BP, https://github.com/llvm/llvm-project/blob/main/lld/MachO/BPSectionOrderer.cpp#L127 the patch removes the suffixes when parsing the order file and getting the symbol priority to have a better symbol match. --------- Co-authored-by: Sharon Xu <sharonxu@fb.com> Co-authored-by: Ellis Hoag <ellis.sparky.hoag@gmail.com>
23 lines
777 B
C++
23 lines
777 B
C++
//===- Utils.cpp ------------------------------------------------*- C++-*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The file defines utils functions that can be shared across archs.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lld/Common/Utils.h"
|
|
|
|
using namespace llvm;
|
|
using namespace lld;
|
|
|
|
StringRef lld::utils::getRootSymbol(StringRef name) {
|
|
name.consume_back(".Tgm");
|
|
auto [P0, S0] = name.rsplit(".llvm.");
|
|
auto [P1, S1] = P0.rsplit(".__uniq.");
|
|
return P1;
|
|
}
|