Skip to content

[BOLT] Abort on out-of-section symbols in GOT #100801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2024
Merged

[BOLT] Abort on out-of-section symbols in GOT #100801

merged 1 commit into from
Aug 7, 2024

Conversation

yota9
Copy link
Member

@yota9 yota9 commented Jul 26, 2024

This patch aborts BOLT execution if it finds out-of-section (section
end) symbol in GOT table. In order to handle such situations properly in
future, we would need to have an arch-dependent way to analyze
relocations or its sequences, e.g., for ARM it would probably be ADRP +
LDR analysis in order to get GOT entry address. Currently, it is also
challenging because GOT-related relocation symbols are replaced to
__BOLT_got_zero. Anyway, it seems to be quite a rare case, which seems
to be only? related to static binaries. For the most part, it seems that
it should be handled on the linker stage, since static binary should not
have GOT table at all. LLD linker with relaxations enabled would replace
instruction addresses from GOT directly to target symbols, which
eliminates the problem.

Anyway, in order to achieve detection of such cases, this patch fixes a
few things in BOLT:

  1. For the end symbols, we're now using the section provided by ELF
    binary. Previously it would be tied with a wrong section found by symbol
    address.
  2. The end symbols would have limited registration we would only
    add them in name->data GlobalSymbols map, since using address->data
    BinaryDataMap map would likely be impossible due to address duality of
    such symbols.
  3. The outdated BD->getSection (currently returning refence, not
    pointer) check in postProcessSymbolTable is replaced by getSize check in
    order to allow zero-sized top-level symbols if they are located in
    zero-sized sections. For the most part, such things could only be found
    in tests, but I don't see a reason not to handle such cases.
  4. Updated section-end-sym test and removed x86_64 requirement since
    there is no reason for this (tested on aarch64 linux)

The test was provided by peterwaller-arm (thank you) in #100096 and
slightly modified by me.

@yota9 yota9 added the BOLT label Jul 26, 2024
@yota9 yota9 requested a review from dcci as a code owner July 26, 2024 19:04
@yota9 yota9 requested a review from mtvec July 26, 2024 19:04
@llvmbot
Copy link
Member

llvmbot commented Jul 26, 2024

@llvm/pr-subscribers-bolt

Author: Vladislav Khmelevsky (yota9)

Changes
  • [BOLT][NFC] Fix build
  • [BOLT] Abort on out-of-section symbols in GOT

Full diff: https://github.com/llvm/llvm-project/pull/100801.diff

5 Files Affected:

  • (modified) bolt/include/bolt/Core/BinaryContext.h (+2-1)
  • (modified) bolt/lib/Core/BinaryContext.cpp (+16-6)
  • (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+33-8)
  • (added) bolt/test/AArch64/Inputs/got_end_of_section_symbol.lld_script (+6)
  • (added) bolt/test/AArch64/got_end_of_section_symbol.s (+28)
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 73932c4ca2fb3..42ab171706827 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -890,7 +890,8 @@ class BinaryContext {
   /// of \p Flags.
   MCSymbol *registerNameAtAddress(StringRef Name, uint64_t Address,
                                   uint64_t Size, uint16_t Alignment,
-                                  unsigned Flags = 0);
+                                  unsigned Flags = 0,
+                                  BinarySection *Section = NULL);
 
   /// Return BinaryData registered at a given \p Address or nullptr if no
   /// global symbol was registered at the location.
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index 0a1f1bb9e0d20..648c74a4ed048 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -1054,18 +1054,28 @@ void BinaryContext::adjustCodePadding() {
 MCSymbol *BinaryContext::registerNameAtAddress(StringRef Name, uint64_t Address,
                                                uint64_t Size,
                                                uint16_t Alignment,
-                                               unsigned Flags) {
+                                               unsigned Flags,
+                                               BinarySection *Section) {
   // Register the name with MCContext.
   MCSymbol *Symbol = Ctx->getOrCreateSymbol(Name);
+  BinaryData *BD;
+
+  // Register out of section symbols only in GlobalSymbols map
+  if (Section && Section->getEndAddress() == Address) {
+    BD = new BinaryData(*Symbol, Address, Size, Alignment ? Alignment : 1,
+                        *Section, Flags);
+    GlobalSymbols[Name] = BD;
+    return Symbol;
+  }
 
   auto GAI = BinaryDataMap.find(Address);
-  BinaryData *BD;
   if (GAI == BinaryDataMap.end()) {
     ErrorOr<BinarySection &> SectionOrErr = getSectionForAddress(Address);
-    BinarySection &Section =
-        SectionOrErr ? SectionOrErr.get() : absoluteSection();
+    BinarySection &SectionRef = Section        ? *Section
+                                : SectionOrErr ? SectionOrErr.get()
+                                               : absoluteSection();
     BD = new BinaryData(*Symbol, Address, Size, Alignment ? Alignment : 1,
-                        Section, Flags);
+                        SectionRef, Flags);
     GAI = BinaryDataMap.emplace(Address, BD).first;
     GlobalSymbols[Name] = BD;
     updateObjectNesting(GAI);
@@ -1399,7 +1409,7 @@ void BinaryContext::postProcessSymbolTable() {
     if ((BD->getName().starts_with("SYMBOLat") ||
          BD->getName().starts_with("DATAat")) &&
         !BD->getParent() && !BD->getSize() && !BD->isAbsolute() &&
-        BD->getSection()) {
+        BD->getSection().getSize()) {
       this->errs() << "BOLT-WARNING: zero-sized top level symbol: " << *BD
                    << "\n";
       Valid = false;
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 32562ccb6b345..e41abe489c875 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -954,13 +954,13 @@ void RewriteInstance::discoverFileObjects() {
     uint64_t SymbolSize = ELFSymbolRef(Symbol).getSize();
     uint64_t SymbolAlignment = Symbol.getAlignment();
 
-    auto registerName = [&](uint64_t FinalSize) {
+    auto registerName = [&](uint64_t FinalSize, BinarySection *Section = NULL) {
       // Register names even if it's not a function, e.g. for an entry point.
       BC->registerNameAtAddress(UniqueName, SymbolAddress, FinalSize,
-                                SymbolAlignment, SymbolFlags);
+                                SymbolAlignment, SymbolFlags, Section);
       if (!AlternativeName.empty())
         BC->registerNameAtAddress(AlternativeName, SymbolAddress, FinalSize,
-                                  SymbolAlignment, SymbolFlags);
+                                  SymbolAlignment, SymbolFlags, Section);
     };
 
     section_iterator Section =
@@ -985,12 +985,25 @@ void RewriteInstance::discoverFileObjects() {
                       << " for function\n");
 
     if (SymbolAddress == Section->getAddress() + Section->getSize()) {
+      ErrorOr<BinarySection &> SectionOrError =
+          BC->getSectionForAddress(Section->getAddress());
+
+      // Skip symbols from invalid sections
+      if (!SectionOrError) {
+        BC->errs() << "BOLT-WARNING: " << UniqueName << " (0x"
+                   << Twine::utohexstr(SymbolAddress)
+                   << ") does not have any section\n";
+        continue;
+      }
+
       assert(SymbolSize == 0 &&
              "unexpect non-zero sized symbol at end of section");
-      LLVM_DEBUG(
-          dbgs()
-          << "BOLT-DEBUG: rejecting as symbol points to end of its section\n");
-      registerName(SymbolSize);
+      LLVM_DEBUG({
+        dbgs() << "BOLT-DEBUG: rejecting as symbol " << UniqueName
+               << " points to end of " << SectionOrError->getName()
+               << " section\n";
+      });
+      registerName(SymbolSize, &SectionOrError.get());
       continue;
     }
 
@@ -1432,7 +1445,9 @@ void RewriteInstance::registerFragments() {
   // of the last local symbol.
   ELFSymbolRef LocalSymEnd = ELF64LEFile->toSymbolRef(SymTab, SymTab->sh_info);
 
-  for (auto &[ParentName, BF] : AmbiguousFragments) {
+  for (auto &Fragment : AmbiguousFragments) {
+    const StringRef &ParentName = Fragment.first;
+    BinaryFunction *BF = Fragment.second;
     const uint64_t Address = BF->getAddress();
 
     // Get fragment's own symbol
@@ -2557,6 +2572,16 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
     return;
   }
 
+  if (Relocation::isGOT(RType) && !Relocation::isTLS(RType)) {
+    BinaryData *BD = BC->getBinaryDataByName(SymbolName);
+    if (BD && BD->getAddress() == BD->getSection().getEndAddress()) {
+      BC->errs() << "BOLT-ERROR: GOT table contains currently unsupported "
+                    "section end symbol "
+                 << BD->getName() << "\n";
+      exit(1);
+    }
+  }
+
   const uint64_t Address = SymbolAddress + Addend;
 
   LLVM_DEBUG({
diff --git a/bolt/test/AArch64/Inputs/got_end_of_section_symbol.lld_script b/bolt/test/AArch64/Inputs/got_end_of_section_symbol.lld_script
new file mode 100644
index 0000000000000..2ad4169bbcc60
--- /dev/null
+++ b/bolt/test/AArch64/Inputs/got_end_of_section_symbol.lld_script
@@ -0,0 +1,6 @@
+SECTIONS {
+  PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
+  .data : { *(.data)  *(.array) }
+  .text : { *(.text) }
+  .got  : { *(.got) *(.igot) }
+}
diff --git a/bolt/test/AArch64/got_end_of_section_symbol.s b/bolt/test/AArch64/got_end_of_section_symbol.s
new file mode 100644
index 0000000000000..c203214fe3fbe
--- /dev/null
+++ b/bolt/test/AArch64/got_end_of_section_symbol.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
+# RUN:   %s -o %t.o
+# RUN: %clang %cflags  -nostartfiles -nodefaultlibs -static -Wl,--no-relax \
+# RUN:   -Wl,-q -Wl,-T %S/Inputs/got_end_of_section_symbol.lld_script  \
+# RUN:   %t.o -o %t.exe
+# RUN: not llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
+
+# CHECK: BOLT-ERROR: GOT table contains currently unsupported section end
+# CHECK-SAME: symbol array_end
+
+.section .array, "a", @progbits
+.globl array_start
+.globl array_end
+array_start:
+  .word 0
+array_end:
+
+.section .text
+.globl _start
+.type exitOk, %function
+_start:
+  adrp x1, #:got:array_start
+  ldr x1, [x1, #:got_lo12:array_start]
+  adrp x0, #:got:array_end
+  ldr x0, [x0, #:got_lo12:array_end]
+  adrp x2, #:got:_start
+  ldr x2, [x2, #:got_lo12:_start]
+  ret

@yota9 yota9 changed the title main [BOLT] Abort on out-of-section symbols in GOT Jul 26, 2024
@yota9
Copy link
Member Author

yota9 commented Jul 26, 2024

Updated section-end-sym test and removed x86_64 requirement added by @omjavaid as there is no reason for this. I've tested it on aarch64 linux and have no problem with this test.

This patch aborts BOLT execution if it finds out-of-section (section
end) symbol in GOT table. In order to handle such situations properly in
future, we would need to have an arch-dependent way to analyze
relocations or its sequences, e.g., for ARM it would probably be ADRP +
LDR analysis in order to get GOT entry address. Currently, it is also
challenging because GOT-related relocation symbols are replaced to
__BOLT_got_zero. Anyway, it seems to be quite a rare case, which seems
to be only? related to static binaries. For the most part, it seems that
it should be handled on the linker stage, since static binary should not
have GOT table at all. LLD linker with relaxations enabled would replace
instruction addresses from GOT directly to target symbols, which
eliminates the problem.

Anyway, in order to achieve detection of such cases, this patch fixes a
few things in BOLT:
1. For the end symbols, we're now using the section provided by ELF
binary. Previously it would be tied with a wrong section found by symbol
address.
2. The end symbols would have limited registration we would only
add them in name->data GlobalSymbols map, since using address->data
BinaryDataMap map would likely be impossible due to address duality of
such symbols.
3. The outdated BD->getSection (currently returning refence, not
pointer) check in postProcessSymbolTable is replaced by getSize check in
order to allow zero-sized top-level symbols if they are located in
zero-sized sections. For the most part, such things could only be found
in tests, but I don't see a reason not to handle such cases.
4. Updated section-end-sym test and removed x86_64 requirement since
there is no reason for this (tested on aarch64 linux)

The test was provided by peterwaller-arm (thank you) in llvm#100096 and
slightly modified by me.
Copy link
Contributor

@peterwaller-arm peterwaller-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! I have also tested this on the previously malformed static binaries reported in #100096 and can confirm that this correctly aborts on them.

@yota9
Copy link
Member Author

yota9 commented Jul 31, 2024

Thanks, if no objections from other reviewers would merge it in 24 hours

@yota9 yota9 merged commit a4900f0 into llvm:main Aug 7, 2024
6 checks passed
yota9 added a commit to yota9/llvm-project that referenced this pull request Aug 7, 2024
Add R_AARCH64_LD64_GOT*_LO15 to the list of supported relocations.
But due to the fact that JITlink doesn't create GOT section when used
with BOLT and there is no common VK_LO15 relocation for aarch64 don't
record this relocation to further process. Since BOLT doesn't move GOT
table it's OK that instruction would have preserved imm value and not
expression. But this level of support is needed during relocations
processing e.g. to abort on out-of-section GOT symbols (llvm#100801).
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 7, 2024

LLVM Buildbot has detected a new failure on builder bolt-x86_64-ubuntu-nfc running on bolt-worker while building bolt at step 9 "test-build-bolt-check-large-bolt".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/92/builds/4167

Here is the relevant piece of the build log for the reference:

Step 9 (test-build-bolt-check-large-bolt) failure: test (failure)
******************** TEST 'bolt-tests :: X86/clang7-pic.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 6: mkdir -p /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output
+ mkdir -p /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output
RUN: at line 7: test -f /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic ||     unzstd /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Inputs/clang-7.pic.zst -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic
+ test -f /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic
RUN: at line 9: test -f /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic.fdata ||     unzstd /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Inputs/clang-7.pic.fdata.zst -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic.fdata
+ test -f /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic.fdata
RUN: at line 11: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/llvm-bolt /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/bolttests/X86/Output/clang7-pic.test.tmp -data /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic.fdata     -relocs -reorder-blocks=ext-tsp -split-functions=3 -split-all-cold     -split-eh -icf=1 -reorder-functions=hfsort+ -use-gnu-stack     -jump-tables=aggressive -frame-opt=hot -strict     | /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/FileCheck /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/clang7-pic.test --check-prefix=CHECK-STRICT
+ /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/llvm-bolt /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/bolttests/X86/Output/clang7-pic.test.tmp -data /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic.fdata -relocs -reorder-blocks=ext-tsp -split-functions=3 -split-all-cold -split-eh -icf=1 -reorder-functions=hfsort+ -use-gnu-stack -jump-tables=aggressive -frame-opt=hot -strict
+ /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/FileCheck /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/clang7-pic.test --check-prefix=CHECK-STRICT
BOLT-WARNING: specifying non-boolean value "3" for option -split-functions is deprecated
BOLT-WARNING: '-reorder-functions=hfsort+' is deprecated, please use '-reorder-functions=cdsort' instead
llvm-bolt: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/llvm-project/bolt/lib/Rewrite/RewriteInstance.cpp:2868: void llvm::bolt::RewriteInstance::handleRelocation(const llvm::object::SectionRef&, const llvm::object::RelocationRef&): Assertion `(IsAArch64 || BC->isRISCV() || IsSectionRelocation || BC->getSectionNameForAddress(SymbolAddress)->starts_with(".plt")) && "known symbols should not resolve to anonymous locals"' failed.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  llvm-bolt 0x00005635c5f01770
1  llvm-bolt 0x00005635c5efed9f
2  llvm-bolt 0x00005635c5efeef5
3  libc.so.6 0x00007f8612242520
4  libc.so.6 0x00007f86122969fc pthread_kill + 300
5  libc.so.6 0x00007f8612242476 raise + 22
6  libc.so.6 0x00007f86122287f3 abort + 211
7  libc.so.6 0x00007f861222871b
8  libc.so.6 0x00007f8612239e96
9  llvm-bolt 0x00005635c5fc6fff
10 llvm-bolt 0x00005635c5fc775e
11 llvm-bolt 0x00005635c5fc7a0f
12 llvm-bolt 0x00005635c5fcb025
13 llvm-bolt 0x00005635c5fec4a5
14 llvm-bolt 0x00005635c5215aed
15 libc.so.6 0x00007f8612229d90
16 libc.so.6 0x00007f8612229e40 __libc_start_main + 128
17 llvm-bolt 0x00005635c52be195
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/llvm-bolt /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/bolttests/X86/Output/clang7-pic.test.tmp -data /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/clang-7.pic.fdata -relocs -reorder-blocks=ext-tsp -split-functions=3 -split-all-cold -split-eh -icf=1 -reorder-functions=hfsort+ -use-gnu-stack -jump-tables=aggressive -frame-opt=hot -strict
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/clang7-pic.test:19:15: error: CHECK-STRICT: expected string not found in input
CHECK-STRICT: BOLT-INFO: 14724 out of 59493 functions in the binary (24.7%) have non-empty execution profile
              ^
<stdin>:1:1: note: scanning from here
BOLT-INFO: Target architecture: x86_64
^

Input file: <stdin>
Check file: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/clang7-pic.test

-dump-input=help explains the following input dump.
...
Step 13 (nfc-check-large-bolt) failure: NFC check-large-bolt completed (failure)
******************** TEST 'bolt-tests :: X86/openssl.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 10: mkdir -p /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output
+ mkdir -p /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output
RUN: at line 11: test -f /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/openssl || unzstd /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Inputs/openssl.zst -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/openssl
+ test -f /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/openssl
RUN: at line 14: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/llvm-bolt /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/openssl -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/bolttests/X86/Output/openssl.test.tmp.exe --pa -p /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Inputs/openssl.preagg.txt    -reorder-blocks=ext-tsp -peepholes=all -dyno-stats -enable-bat    -split-functions -split-all-cold -split-eh -icf    -reorder-functions=cdsort -use-gnu-stack -jump-tables=move -frame-opt=hot    -print-cfg -print-only=bn_mul4x_mont.*,__memcpy_evex_unaligned_erms.*,BN_BLINDING_convert_ex    |& /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/FileCheck /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/openssl.test -check-prefix=CHECK-BOLT-BAT
+ /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/llvm-bolt /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Output/openssl -o /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/tools/bolttests/X86/Output/openssl.test.tmp.exe --pa -p /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/Inputs/openssl.preagg.txt -reorder-blocks=ext-tsp -peepholes=all -dyno-stats -enable-bat -split-functions -split-all-cold -split-eh -icf -reorder-functions=cdsort -use-gnu-stack -jump-tables=move -frame-opt=hot -print-cfg '-print-only=bn_mul4x_mont.*,__memcpy_evex_unaligned_erms.*,BN_BLINDING_convert_ex'
+ /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/build/bin/FileCheck /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/openssl.test -check-prefix=CHECK-BOLT-BAT
/home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/openssl.test:22:17: error: CHECK-BOLT-BAT: expected string not found in input
CHECK-BOLT-BAT: Binary Function "bn_mul4x_mont/1(*2)" after building cfg {
                ^
<stdin>:1:1: note: scanning from here
/tmp/lit-tmp-3toe3ax5/tmpudsxlzn4
^

Input file: <stdin>
Check file: /home/worker/bolt-worker2/bolt-x86_64-ubuntu-nfc/bolt-tests/test/X86/openssl.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1: /tmp/lit-tmp-3toe3ax5/tmpudsxlzn4 
check:22     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          2: exitcode mismatch 
check:22     ~~~~~~~~~~~~~~~~~~
>>>>>>

--

********************


dcci added a commit that referenced this pull request Aug 8, 2024
@dcci
Copy link
Member

dcci commented Aug 8, 2024

Reverted in:

commit e49549ff19d3ea69331a967f8492eeb1819e6cd0 (HEAD -> main, upstream/main)
Author: Davide Italiano <[email protected]>
Date:   Wed Aug 7 20:52:19 2024 -0700

    Revert "[BOLT] Abort on out-of-section symbols in GOT (#100801)"
    
    This reverts commit a4900f0d936f0e86bbd04bd9de4291e1795f1768.

as it breaks buildbot.

@paschalis-mpeis
Copy link
Member

Any updates on this? TMU it remains as reverted correct?

Are there any plans of getting it merged again?

@paschalis-mpeis
Copy link
Member

It looks like the issue #100096 is specific to BFD?

With GOLD, AArch64MCCodeEmitter crashes with:

did not expect relocated expression

Maybe that could be handled here as well?

LLD seems to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants