Skip to contentSkip to conversation

scripts/recordmcount: improve EM_METAG define checks

PATCH In review Ross Burton 2 participants 2 messages Jul 13, 2016 – Jul 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/recordmcount: improve EM_METAG define checks

Current glibc (as of c10f90, soon to be 2.24) has an elf.h which defines EM_METAG but doesn't also define R_METAG_ADDR32 and _NONE. This results in recordmcount not defining any of the META symbols, and the compile failing.

Handle this by checking each #define individually instead of assuming the presence.

---
 scripts/recordmcount.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/recordmcount.c +5 -1
index e1675927..44ce050 100644
@@ -33,10 +33,14 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifndef EM_METAG
 /* Remove this when these make it to the standard system elf.h. */
+#ifndef EM_METAG
 #define EM_METAG      174
+#endif
+#ifndef R_METAG_ADDR32
 #define R_METAG_ADDR32                   2
+#endif
+#ifndef R_METAG_NONE
 #define R_METAG_NONE                     3
 #endif
 
Signature · 1 line
2.8.1
#1 lore raw
Quoted 8 lines · On Wed, 13 Jul 2016 14:37:46 +0100 Ross Burton <[email protected]> wrote:

Current glibc (as of c10f90, soon to be 2.24) has an elf.h which defines EM_METAG but doesn't also define R_METAG_ADDR32 and _NONE. This results in recordmcount not defining any of the META symbols, and the compile failing.

Handle this by checking each #define individually instead of assuming the presence.

Actually, Laura beat you to it:

http://lkml.kernel.org/r/[email protected]

I'll be applying her patch. I'll also mark it as stable, as it's come up a few times on IRC as well.

I'll still add a Reported-by from you.

Thanks!

-- Steve

Quoted 24 lines
---
 scripts/recordmcount.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/recordmcount.c +5 -1
index e1675927..44ce050 100644
@@ -33,10 +33,14 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifndef EM_METAG
 /* Remove this when these make it to the standard system elf.h. */
+#ifndef EM_METAG
 #define EM_METAG      174
+#endif
+#ifndef R_METAG_ADDR32
 #define R_METAG_ADDR32                   2
+#endif
+#ifndef R_METAG_NONE
 #define R_METAG_NONE                     3
 #endif