[profile] Delete zero-size dummy sections
authorFangrui Song <i@maskray.me>
Mon, 1 Mar 2021 05:07:30 +0000 (21:07 -0800)
committerFangrui Song <i@maskray.me>
Mon, 1 Mar 2021 05:07:30 +0000 (21:07 -0800)
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

index b63b4d4..07f3578 100644 (file)
@@ -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;