]> Zhao Yanbai Git Server - minix.git/commitdiff
libc: ARM generateasm
authorArun Thomas <arun@minix3.org>
Tue, 7 Aug 2012 15:01:25 +0000 (17:01 +0200)
committerArun Thomas <arun@minix3.org>
Tue, 7 Aug 2012 15:01:25 +0000 (17:01 +0200)
lib/generateasm.mk

index 0fddf0bdaf202a5d5c779fa88f2d7f7cbb523ea1..0b22063649a587c97a525d6939a413464f654d8e 100644 (file)
@@ -1,3 +1,15 @@
+ORIGFUNC= ${.PREFIX:S/^compat//}
+RENAMEDFUNC=${.PREFIX:S/^compat__//:C/([0-9]{2})$//}
+.if (${MACHINE_ARCH} == "i386")
+FUNCTYPE= @function
+PICJMP= jmpl *PIC_PLT(${ORIGFUNC})
+JMP= jmp ${ORIGFUNC}
+.elif (${MACHINE_ARCH} == "arm")
+FUNCTYPE= %%function
+PICJMP= bl PIC_SYM(${ORIGFUNC}, PLT)
+JMP= b ${ORIGFUNC}
+.endif
+
 ${ASM}:
        ${_MKTARGET_CREATE}
        printf '/* MINIX3 */                                                    \n\
@@ -7,14 +19,14 @@ ${ASM}:
 * DO NOT EDIT: this file is automatically generated.                           \n\
 */                                                                             \n\
 #include <machine/asm.h>                                                       \n\
-.global ${.PREFIX:S/^compat__//:C/([0-9]{2})$//};                              \n\
-.global ${.PREFIX:S/^compat//};                                                        \n\
-.type ${.PREFIX:S/^compat__//:C/([0-9]{2})$//},@function                       \n\
-${.PREFIX:S/^compat__//:C/([0-9]{2})$//}:                                      \n\
+.global ${RENAMEDFUNC};                                                                \n\
+.global ${ORIGFUNC};                                                           \n\
+.type ${RENAMEDFUNC},${FUNCTYPE}                                               \n\
+${RENAMEDFUNC}:                                                                        \n\
 #ifdef PIC                                                                     \n\
-jmpl *PIC_PLT(${.PREFIX:S/^compat//})                                          \n\
+${PICJMP}                                                                      \n\
 #else                                                                          \n\
-jmp ${.PREFIX:S/^compat//}                                                     \n\
+${JMP}                                                                         \n\
 #endif                                                                         \n\
 \n ' >${.TARGET}