[lld] [LLD][ELF] add bp-* options in ELF (PR #120514)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 14:20:32 PST 2025


================
@@ -0,0 +1,77 @@
+//===- BPSectionOrderer.cpp------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "BPSectionOrderer.h"
+#include "Config.h"
+#include "InputFiles.h"
+#include "InputSection.h"
+#include "lld/Common/BPSectionOrdererBase.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/xxhash.h"
+
+#include "SymbolTable.h"
+#include "Symbols.h"
+
+using namespace llvm;
+using namespace lld::elf;
+
+void BPSectionELF::getSectionHashes(
+    llvm::SmallVectorImpl<uint64_t> &hashes,
+    const llvm::DenseMap<const void *, uint64_t> &sectionToIdx) const {
+  constexpr unsigned windowSize = 4;
+
+  size_t size = isec->content().size();
+  for (size_t i = 0; i < size; i++) {
----------------
MaskRay wrote:

`i != size; ++i`

https://github.com/llvm/llvm-project/pull/120514


More information about the llvm-commits mailing list