https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/92713
>From a32bf63f61f6d382f09982d992f3cabc8dc55cfd Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Sun, 19 May 2024 19:44:20 -0700 Subject: [PATCH 1/4] drop changes to bolt/test/AArch64/text-data.c Created using spr 1.3.4 --- bolt/test/AArch64/text-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bolt/test/AArch64/text-data.c b/bolt/test/AArch64/text-data.c index 17e507a7cc1b4..2986fe7840078 100644 --- a/bolt/test/AArch64/text-data.c +++ b/bolt/test/AArch64/text-data.c @@ -3,7 +3,7 @@ // RUN: %clang %cflags %s -o %t.exe -Wl,-q // RUN: llvm-bolt %t.exe -o %t.bolt --lite=0 --use-old-text=0 -// RUN: llvm-objdump -j .bolt.org.text -d --disassemble-symbols=arr %t.bolt | \ +// RUN: llvm-objdump -j .text -d --disassemble-symbols=arr %t.bolt | \ // RUN: FileCheck %s // CHECK: {{.*}} <arr>: >From d09b18df4eb75879ef528bfcb43604b86d56860c Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Sun, 19 May 2024 20:13:19 -0700 Subject: [PATCH 2/4] Address comments Created using spr 1.3.4 --- bolt/lib/Rewrite/RewriteInstance.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 0d11bdc46fa5a..ba5cec7d9c596 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -4789,7 +4789,6 @@ void RewriteInstance::updateELFSymbolTable( continue; Expected<StringRef> SymbolName = Symbol.getName(StringSection); - assert(SymbolName && "cannot get symbol name"); const BinaryFunction *Function = BC->getBinaryFunctionAtAddress(Symbol.st_value); @@ -4798,8 +4797,11 @@ void RewriteInstance::updateELFSymbolTable( if (Function && Symbol.getType() == ELF::STT_SECTION) Function = nullptr; - // Ignore input hot markers as function aliases – markers are handled - // separately. + // Ignore input hot markers as function aliases. + // If hot markers are treated as function aliases, we may create + // non-sensical __hot_start.cold symbols which would not have a parent + // when read by BOLT as we don't register them as function aliases + // (explicitly ignored in parsing symbol table in discoverFileObjects). if (Function && (*SymbolName == "__hot_start" || *SymbolName == "__hot_end")) Function = nullptr; >From b36c250836607410246e6ddf2f855d43df77e80d Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Sun, 19 May 2024 20:17:15 -0700 Subject: [PATCH 3/4] keep assert Created using spr 1.3.4 --- bolt/lib/Rewrite/RewriteInstance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index ba5cec7d9c596..e788ca7afd5ad 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -4789,6 +4789,7 @@ void RewriteInstance::updateELFSymbolTable( continue; Expected<StringRef> SymbolName = Symbol.getName(StringSection); + assert(SymbolName && "cannot get symbol name"); const BinaryFunction *Function = BC->getBinaryFunctionAtAddress(Symbol.st_value); >From 1a1e2ae769bc6c9c6eb82980349f4ba7b4404aae Mon Sep 17 00:00:00 2001 From: Amir Ayupov <aau...@fb.com> Date: Mon, 20 May 2024 15:49:16 -0700 Subject: [PATCH 4/4] Hoist the special symbol handling Created using spr 1.3.4 --- bolt/lib/Rewrite/RewriteInstance.cpp | 31 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 98d21bd7b0c77..9cc4c8c8c4faf 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -4826,11 +4826,20 @@ void RewriteInstance::updateELFSymbolTable( updateSymbolValue(*SymbolName); ++NumHotTextSymsUpdated; } - // Ignore input hot markers as function aliases. - // If hot markers are treated as function aliases, we may create - // non-sensical __hot_start.cold symbols which would not have a parent - // when read by BOLT as we don't register them as function aliases - // (explicitly ignored in parsing symbol table in discoverFileObjects). + goto registerSymbol; + } + + if (*SymbolName == "__hot_data_start" || *SymbolName == "__hot_data_end") { + if (opts::HotData) { + updateSymbolValue(*SymbolName); + ++NumHotDataSymsUpdated; + } + goto registerSymbol; + } + + if (*SymbolName == "_end") { + if (NextAvailableAddress > Symbol.st_value) + updateSymbolValue(*SymbolName, NextAvailableAddress); goto registerSymbol; } @@ -4930,17 +4939,7 @@ void RewriteInstance::updateELFSymbolTable( } } - // Handle special symbols based on their name. - if (opts::HotData && (*SymbolName == "__hot_data_start" || - *SymbolName == "__hot_data_end")) { - updateSymbolValue(*SymbolName); - ++NumHotDataSymsUpdated; - } - - if (*SymbolName == "_end" && NextAvailableAddress > Symbol.st_value) - updateSymbolValue(*SymbolName, NextAvailableAddress); - -registerSymbol: + registerSymbol: if (IsDynSym) Write((&Symbol - cantFail(Obj.symbols(&SymTabSection)).begin()) * sizeof(ELFSymTy), _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits