Date: Sun, 12 Sep 2021 21:12:42 GMT From: Piotr Kubaj <pkubaj@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: ff9319692d9e - main - security/masscan: fix build on powerpc* Message-ID: <202109122112.18CLCg3F047521@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=ff9319692d9e5399bc446413b48c01a60dc07db9 commit ff9319692d9e5399bc446413b48c01a60dc07db9 Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2021-09-12 21:06:06 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2021-09-12 21:06:06 +0000 security/masscan: fix build on powerpc* Implement rdtsc, similar to ARM. Builds fine with clang. --- security/masscan/Makefile | 6 ------ security/masscan/files/patch-src_smack1.c | 27 +++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/security/masscan/Makefile b/security/masscan/Makefile index 85aaa246e53d..8eb1c1fcf037 100644 --- a/security/masscan/Makefile +++ b/security/masscan/Makefile @@ -17,12 +17,6 @@ CFLAGS+= -Wno-format PLIST_FILES= bin/masscan man/man8/masscan.8.gz -.include <bsd.port.options.mk> - -.if ${ARCH} == powerpc64 || ${ARCH} == powerpc -USE_GCC= yes -.endif - do-install: ${INSTALL_PROGRAM} ${WRKSRC}/bin/masscan ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/doc/masscan.8 ${STAGEDIR}${MANPREFIX}/man/man8 diff --git a/security/masscan/files/patch-src_smack1.c b/security/masscan/files/patch-src_smack1.c index 8a5448fd62dc..909d256435cf 100644 --- a/security/masscan/files/patch-src_smack1.c +++ b/security/masscan/files/patch-src_smack1.c @@ -1,6 +1,6 @@ --- src/smack1.c.orig 2021-01-31 09:13:30 UTC +++ src/smack1.c -@@ -119,8 +119,7 @@ +@@ -119,9 +119,8 @@ #elif defined(__FreeBSD__) #include <sys/types.h> #include <machine/cpufunc.h> @@ -10,12 +10,35 @@ unsigned long long rdtsc(void) { uint32_t pmccntr; -@@ -138,6 +137,10 @@ unsigned long long rdtsc(void) + uint32_t pmuseren; +@@ -138,6 +137,32 @@ unsigned long long rdtsc(void) } return 0; } +#elif defined(__aarch64__) +#define __rdtsc() 0 ++#elif defined(__powerpc64__) ++unsigned long long __rdtsc(void) ++{ ++ unsigned long long rval; ++ __asm__ __volatile__("mfspr %%r3, 268": "=r" (rval)); ++ return rval; ++} ++#elif defined(__powerpc__) ++unsigned long long __rdtsc(void) ++{ ++ unsigned int tmp; ++ union { unsigned long long complete; unsigned int part[2]; } ticks; ++ __asm__ ("0:" ++ "mftbu %[hi32]\n" ++ "mftb %[lo32]\n" ++ "mftbu %[tmp]\n" ++ "cmpw %[tmp],%[hi32]\n" ++ "bne 0b\n" ++ : [hi32] "=r"(ticks.part[0]), [lo32] "=r"(ticks.part[1]), ++ [tmp] "=r"(tmp)); ++ return ticks.complete; ++} +#else +#define __rdtsc rdtsc #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109122112.18CLCg3F047521>