On Fri, Sep 28, 2018 at 7:22 AM, Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote: > >> I've committed a patch to update libgo to the 1.11 release. As usual >> for these updates, the patch is too large to attach to this e-mail >> message. I've attached some of the more relevant directories. This >> update required some minor patches to the gotools directory and the Go >> testsuite, also included here. Bootstrapped and ran Go testsuite on >> x86_64-pc-linux-gnu. Committed to mainline. > > I just found another issue: unlike Solaris 11, Solaris 10 lacks memmem, > breaking the build: > > /vol/gcc/src/hg/trunk/local/libgo/go/internal/bytealg/bytealg.c: In function > 'Index': > /vol/gcc/src/hg/trunk/local/libgo/go/internal/bytealg/bytealg.c:96:6: error: > implicit declaration of function 'memmem'; did you mean 'memset'? > [-Werror=implicit-function-declaration] > 96 | p = memmem(a.__values, a.__count, b.__values, b.__count); > | ^~~~~~ > | memset > /vol/gcc/src/hg/trunk/local/libgo/go/internal/bytealg/bytealg.c:96:4: error: > assignment to 'const byte *' {aka 'const unsigned char *'} from 'int' makes > pointer from integer without a cast [-Werror=int-conversion] > 96 | p = memmem(a.__values, a.__count, b.__values, b.__count); > | ^ > /vol/gcc/src/hg/trunk/local/libgo/go/internal/bytealg/bytealg.c: In function > 'IndexString': > /vol/gcc/src/hg/trunk/local/libgo/go/internal/bytealg/bytealg.c:111:4: error: > assignment to 'const byte *' {aka 'const unsigned char *'} from 'int' makes > pointer from integer without a cast [-Werror=int-conversion] > 111 | p = memmem(a.str, a.len, b.str, b.len); > | ^
Thanks for the note. This patch should fix the problem. Bootstrapped and ran Go tests on x86_64-pc-linux-gnu, both normally and pretending that the system had no memmem. Committed to mainline. Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 264793) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -098e36f4ddfcf50aeb34509b5f25b86d7050749c +bde5ac90e0b4efdf3e9a4d72af4eb23250608611 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/configure.ac =================================================================== --- libgo/configure.ac (revision 264772) +++ libgo/configure.ac (working copy) @@ -544,7 +544,7 @@ AC_CHECK_HEADERS([linux/filter.h linux/i AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes) -AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr) +AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr memmem) AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) Index: libgo/go/internal/bytealg/bytealg.c =================================================================== --- libgo/go/internal/bytealg/bytealg.c (revision 264648) +++ libgo/go/internal/bytealg/bytealg.c (working copy) @@ -10,6 +10,33 @@ #include "runtime.h" #include "array.h" +#ifndef HAVE_MEMMEM + +#define memmem goMemmem + +static const void *goMemmem(const void *in, size_t inl, const void *s, size_t sl) { + const char *p; + char first; + const char *stop; + + if (sl == 0) { + return in; + } + if (inl < sl) { + return nil; + } + first = *(const char *)(s); + stop = (const char *)(in) + (inl - sl); + for (p = (const char *)(in); p <= stop; p++) { + if (*p == first && __builtin_memcmp(p + 1, (const char *)(s) + 1, sl - 1) == 0) { + return (const void *)(p); + } + } + return nil; +} + +#endif + intgo Compare(struct __go_open_array, struct __go_open_array) __asm__(GOSYM_PREFIX "internal_bytealg.Compare") __attribute__((no_split_stack));