From dc93b1127c5e0621e672745d26bce5a11f68d943 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 28 Feb 2021 21:07:30 -0800 Subject: [PATCH] [profile] Delete zero-size dummy sections They were added so that if no metadata section is present, `__start_llvm_prf_*` references would not cause "undefined symbol" errors. By switching to undefined weak symbols in D96936, the dummy sections are not needed. This patch is also needed to work around https://sourceware.org/bugzilla/show_bug.cgi?id=27490 Differential Revision: https://reviews.llvm.org/D97648 --- compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c index b63b4d4..07f3578 100644 --- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c +++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c @@ -38,20 +38,6 @@ extern char PROF_NAME_STOP COMPILER_RT_VISIBILITY COMPILER_RT_WEAK; extern ValueProfNode PROF_VNODES_START COMPILER_RT_VISIBILITY COMPILER_RT_WEAK; extern ValueProfNode PROF_VNODES_STOP COMPILER_RT_VISIBILITY COMPILER_RT_WEAK; -/* Add dummy data to ensure the section is always created. Add used attribute so - * that they are linker GC roots on supported ELF platforms. - */ -__llvm_profile_data __prof_data_sect_data[0] COMPILER_RT_SECTION( - INSTR_PROF_DATA_SECT_NAME) COMPILER_RT_USED; -uint64_t __prof_cnts_sect_data[0] COMPILER_RT_SECTION(INSTR_PROF_CNTS_SECT_NAME) - COMPILER_RT_USED; -uint32_t __prof_orderfile_sect_data[0] COMPILER_RT_SECTION( - INSTR_PROF_ORDERFILE_SECT_NAME) COMPILER_RT_USED; -const char __prof_nms_sect_data[0] COMPILER_RT_SECTION( - INSTR_PROF_NAME_SECT_NAME) COMPILER_RT_USED; -ValueProfNode __prof_vnodes_sect_data[0] COMPILER_RT_SECTION( - INSTR_PROF_VNODES_SECT_NAME) COMPILER_RT_USED; - COMPILER_RT_VISIBILITY const __llvm_profile_data * __llvm_profile_begin_data(void) { return &PROF_DATA_START; -- 2.7.4