diff options
Diffstat (limited to 'src/cmd/ld/go.c')
-rw-r--r-- | src/cmd/ld/go.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/cmd/ld/go.c b/src/cmd/ld/go.c index 47fdbe944..39ffa3d87 100644 --- a/src/cmd/ld/go.c +++ b/src/cmd/ld/go.c @@ -37,13 +37,12 @@ static void imported(char *pkg, char *import); static int hashstr(char *name) { - int h; + uint32 h; char *cp; h = 0; for(cp = name; *cp; h += *cp++) h *= 1119; - // not if(h < 0) h = ~h, because gcc 4.3 -O2 miscompiles it. h &= 0xffffff; return h; } @@ -499,6 +498,9 @@ loadcgo(char *file, char *pkg, char *p, int n) local = expandpkg(local, pkg); s = lookup(local, 0); + if(flag_shared && s == lookup("main", 0)) + continue; + // export overrides import, for openbsd/cgo. // see issue 4878. if(s->dynimplib != nil) { @@ -613,7 +615,7 @@ markflood(void) } static char* -morename[] = +markextra[] = { "runtime.morestack", "runtime.morestackx", @@ -629,6 +631,12 @@ morename[] = "runtime.morestack32", "runtime.morestack40", "runtime.morestack48", + + // on arm, lock in the div/mod helpers too + "_div", + "_divu", + "_mod", + "_modu", }; static int @@ -674,10 +682,8 @@ deadcode(void) Bprint(&bso, "%5.2f deadcode\n", cputime()); mark(lookup(INITENTRY, 0)); - if(flag_shared) - mark(lookup(LIBINITENTRY, 0)); - for(i=0; i<nelem(morename); i++) - mark(lookup(morename[i], 0)); + for(i=0; i<nelem(markextra); i++) + mark(lookup(markextra[i], 0)); for(i=0; i<ndynexp; i++) mark(dynexp[i]); @@ -794,6 +800,8 @@ Zconv(Fmt *fp) return fmtstrcpy(fp, "<nil>"); se = s + strlen(s); + + // NOTE: Keep in sync with ../gc/go.c:/^Zconv. while(s < se) { n = chartorune(&r, s); s += n; @@ -822,6 +830,9 @@ Zconv(Fmt *fp) fmtrune(fp, '\\'); fmtrune(fp, r); break; + case 0xFEFF: // BOM, basically disallowed in source code + fmtstrcpy(fp, "\\uFEFF"); + break; } } return 0; |