On Fri, Aug 11 2017, Christian Weisgerber <na...@mips.inka.de> wrote: > On 2017-08-10, Jeremie Courreges-Anglas <j...@wxcvbn.org> wrote: > >> +# XXX base gcc >> +CC= /usr/bin/gcc
Thanks for the test reports, which confirm that I'm the only one unable to run memtest86+ on my machines... > That isn't a solution. It is a solution, just not a long-term one. ;) So here's a diff I just cooked up (I don't know where I've put the previous version...). While here, respect CC. Note that as(1) is still used once, which could be a problem on a clang-only box. Tests welcome. Index: Makefile =================================================================== RCS file: /d/cvs/ports/sysutils/memtest86+/Makefile,v retrieving revision 1.10 diff -u -p -r1.10 Makefile --- Makefile 4 Feb 2014 10:14:52 -0000 1.10 +++ Makefile 11 Aug 2017 20:07:02 -0000 @@ -19,7 +19,7 @@ MASTER_SITES= ${HOMEPAGE}/download/${VE USE_GMAKE= Yes NO_TEST= Yes -MAKE_ENV= V=${VERSION} +MAKE_ENV= CC="${CC}" V=${VERSION} post-build: @cd ${WRKBUILD} && sh ${WRKDIST}/makeiso.sh Index: patches/patch-Makefile =================================================================== RCS file: /d/cvs/ports/sysutils/memtest86+/patches/patch-Makefile,v retrieving revision 1.6 diff -u -p -r1.6 patch-Makefile --- patches/patch-Makefile 31 Mar 2015 18:29:51 -0000 1.6 +++ patches/patch-Makefile 11 Aug 2017 20:15:20 -0000 @@ -1,7 +1,8 @@ $OpenBSD: patch-Makefile,v 1.6 2015/03/31 18:29:51 pascal Exp $ $RuOBSD: patch-Makefile,v 1.3 2009/02/07 10:28:03 form Exp $ ---- Makefile.orig Sun Jan 23 19:11:04 2011 -+++ Makefile Tue Mar 31 17:06:38 2015 +Index: Makefile +--- Makefile.orig ++++ Makefile @@ -6,33 +6,47 @@ # # Path for the floppy disk device @@ -72,7 +73,7 @@ $RuOBSD: patch-Makefile,v 1.3 2009/02/07 test.o: test.c - $(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding test.c -+ $(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fno-pie test.c ++ $(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fno-stack-protector -fno-pie test.c clean: rm -f *.o *.s *.iso memtest.bin memtest memtest_shared memtest_shared.bin Index: patches/patch-io_h =================================================================== RCS file: patches/patch-io_h diff -N patches/patch-io_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-io_h 11 Aug 2017 20:17:26 -0000 @@ -0,0 +1,34 @@ +$OpenBSD$ + +Simple fix to avoid multiple definitions error. + +Index: io.h +--- io.h.orig ++++ io.h +@@ -31,7 +31,7 @@ + */ + + #define __OUT1(s,x) \ +-extern inline void __out##s(unsigned x value, unsigned short port) { ++static inline void __out##s(unsigned x value, unsigned short port) { + + #define __OUT2(s,s1,s2) \ + __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" +@@ -43,7 +43,7 @@ __OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" + __OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } + + #define __IN1(s) \ +-extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; ++static inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; + + #define __IN2(s,s1,s2) \ + __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" +@@ -55,7 +55,7 @@ __IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) + __IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } + + #define __OUTS(s) \ +-extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ ++static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ + { __asm__ __volatile__ ("cld ; rep ; outs" #s \ + : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + Index: patches/patch-main_c =================================================================== RCS file: patches/patch-main_c diff -N patches/patch-main_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-main_c 11 Aug 2017 20:05:21 -0000 @@ -0,0 +1,20 @@ +$OpenBSD$ + +Unsupported with clang: + + main.c:115:2: error: indirect goto in function with no address-of-label expressions + +Index: main.c +--- main.c.orig ++++ main.c +@@ -112,7 +112,9 @@ static void __run_at(unsigned long addr) + memmove((void *)addr, &_start, _end - _start); + /* Jump to the start address */ + p = (ulong *)(addr + startup_32 - _start); +- goto *p; ++ ++ void (* volatile f)(void); ++ f = (void (* volatile)(void)) p; + } + + static unsigned long run_at_addr = 0xffffffff; -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE