From 277cc4a372d580e1394455b76c43f3ed5969c741 Mon Sep 17 00:00:00 2001 From: Grigory Pastukhov Date: Mon, 18 Aug 2025 14:38:40 -0700 Subject: [PATCH 1/2] Fix bolt/test/perf2bolt/Inputs/perf_test.lds --- bolt/test/perf2bolt/Inputs/perf_test.lds | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bolt/test/perf2bolt/Inputs/perf_test.lds b/bolt/test/perf2bolt/Inputs/perf_test.lds index 66d925a05bebc..c2704d73a638c 100644 --- a/bolt/test/perf2bolt/Inputs/perf_test.lds +++ b/bolt/test/perf2bolt/Inputs/perf_test.lds @@ -1,13 +1,12 @@ SECTIONS { - . = SIZEOF_HEADERS; + . = 0x400000 + SIZEOF_HEADERS; .interp : { *(.interp) } .note.gnu.build-id : { *(.note.gnu.build-id) } - . = 0x212e8; .dynsym : { *(.dynsym) } - . = 0x31860; + . = 0x801000; .text : { *(.text*) } - . = 0x41c20; + . = 0x803000; .fini_array : { *(.fini_array) } - . = 0x54e18; + . = 0x805000; .data : { *(.data) } -} \ No newline at end of file +} From 7ef03340665cb8cf42db757bd722ae10f0af7fda Mon Sep 17 00:00:00 2001 From: Grigory Pastukhov Date: Tue, 19 Aug 2025 16:37:27 -0700 Subject: [PATCH 2/2] Force PIE explicitly in the test --- bolt/test/perf2bolt/Inputs/perf_test.lds | 11 ++++++----- bolt/test/perf2bolt/perf_test.test | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bolt/test/perf2bolt/Inputs/perf_test.lds b/bolt/test/perf2bolt/Inputs/perf_test.lds index c2704d73a638c..66d925a05bebc 100644 --- a/bolt/test/perf2bolt/Inputs/perf_test.lds +++ b/bolt/test/perf2bolt/Inputs/perf_test.lds @@ -1,12 +1,13 @@ SECTIONS { - . = 0x400000 + SIZEOF_HEADERS; + . = SIZEOF_HEADERS; .interp : { *(.interp) } .note.gnu.build-id : { *(.note.gnu.build-id) } + . = 0x212e8; .dynsym : { *(.dynsym) } - . = 0x801000; + . = 0x31860; .text : { *(.text*) } - . = 0x803000; + . = 0x41c20; .fini_array : { *(.fini_array) } - . = 0x805000; + . = 0x54e18; .data : { *(.data) } -} +} \ No newline at end of file diff --git a/bolt/test/perf2bolt/perf_test.test b/bolt/test/perf2bolt/perf_test.test index 434d4d2780feb..08b3413a67a0b 100644 --- a/bolt/test/perf2bolt/perf_test.test +++ b/bolt/test/perf2bolt/perf_test.test @@ -2,7 +2,7 @@ REQUIRES: system-linux, perf -RUN: %clang %S/Inputs/perf_test.c -fuse-ld=lld -Wl,--script=%S/Inputs/perf_test.lds -o %t +RUN: %clang %S/Inputs/perf_test.c -fuse-ld=lld -pie -Wl,--script=%S/Inputs/perf_test.lds -o %t RUN: perf record -Fmax -e cycles:u -o %t2 -- %t RUN: perf2bolt %t -p=%t2 -o %t3 -nl -ignore-build-id --show-density \ RUN: --heatmap %t.hm 2>&1 | FileCheck %s