Skip to contentSkip to conversation

scripts/recordmcount: support more than 64K ELF sections

PATCH New Dan Aloni 1 participant 1 message Feb 15, 2019

lore
Share & tools
lore

Dan Aloni

author
#0 lore raw

PATCH 1/1 scripts/recordmcount: support more than 64K ELF sections

Before this change, recordmcount thought that there were zero sections in an ELF that has more than 64K sections. It did nothing and exited with exit status 0.

This change is needed so that CONFIG_DYNAMIC_FTRACE continues working with special compilation flags that put each function in its own section, a situation sometimes happens with modern compilers.

The other ELF mangling host program helpers in the kernel tree have also received this treatment in the past. For example, see commit 6845756b29e4 ("modpost: Update 64k section support for binutils 2.18.50").

Some changes here were taken from scripts/sortextable.c.

---
 scripts/recordmcount.c |   5 ++
 scripts/recordmcount.h | 106 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 99 insertions(+), 12 deletions(-)
scripts/recordmcount.c +5 -0
index a50a2aa963ad..85b5a5105cce 100644
@@ -409,6 +409,11 @@ is_mcounted_section_name(char const *const txtname)
 		strcmp(".text.unlikely", txtname) == 0;
 }
 
+static inline int is_shndx_special(unsigned int i)
+{
+	return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE;
+}
+
 /* 32 bit and 64 bit are very similar */
 #include "recordmcount.h"
 #define RECORD_MCOUNT_64
scripts/recordmcount.h +94 -12

187 lines not on this page · raw message

Signature · 1 line
2.20.1