]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - scripts/recordmcount.c
ARM: 8950/1: ftrace/recordmcount: filter relocation types
[mirror_ubuntu-bionic-kernel.git] / scripts / recordmcount.c
index 16e086dcc56762dd7bc8e6ccd78324e43320d829..a4888e955466616ec5c4c584febdc535835d140a 100644 (file)
 #define R_AARCH64_ABS64        257
 #endif
 
+#define R_ARM_PC24             1
+#define R_ARM_THM_CALL         10
+#define R_ARM_CALL             28
+
 static int fd_map;     /* File descriptor for file being modified. */
 static int mmap_failed; /* Boolean flag. */
 static char gpfx;      /* prefix for global symbol name (sometimes '_') */
@@ -428,6 +432,18 @@ is_mcounted_section_name(char const *const txtname)
 #define RECORD_MCOUNT_64
 #include "recordmcount.h"
 
+static int arm_is_fake_mcount(Elf32_Rel const *rp)
+{
+       switch (ELF32_R_TYPE(w(rp->r_info))) {
+       case R_ARM_THM_CALL:
+       case R_ARM_CALL:
+       case R_ARM_PC24:
+               return 0;
+       }
+
+       return 1;
+}
+
 /* 64-bit EM_MIPS has weird ELF64_Rela.r_info.
  * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
  * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40]
@@ -529,6 +545,7 @@ do_file(char const *const fname)
                         altmcount = "__gnu_mcount_nc";
                         make_nop = make_nop_arm;
                         rel_type_nop = R_ARM_NONE;
+                        is_fake_mcount32 = arm_is_fake_mcount;
                         break;
        case EM_AARCH64:
                        reltype = R_AARCH64_ABS64;