[compiler-rt] dc93b11 - [profile] Delete zero-size dummy sections

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 28 21:07:38 PST 2021


Author: Fangrui Song
Date: 2021-02-28T21:07:30-08:00
New Revision: dc93b1127c5e0621e672745d26bce5a11f68d943

URL: https://github.com/llvm/llvm-project/commit/dc93b1127c5e0621e672745d26bce5a11f68d943
DIFF: https://github.com/llvm/llvm-project/commit/dc93b1127c5e0621e672745d26bce5a11f68d943.diff

LOG: [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

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingPlatformLinux.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
index b63b4d40ac91..07f3578dc43b 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;


        


More information about the llvm-commits mailing list