summaryrefslogtreecommitdiff
path: root/src/cmd/6l/go.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/6l/go.c')
-rw-r--r--src/cmd/6l/go.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cmd/6l/go.c b/src/cmd/6l/go.c
index 10ebe3fdb..07a0f21d5 100644
--- a/src/cmd/6l/go.c
+++ b/src/cmd/6l/go.c
@@ -489,3 +489,35 @@ definetypesigs(void)
if(debug['v'])
Bprint(&bso, "%5.2f typesigs %d\n", cputime(), n);
}
+
+int
+isinitfunc(Sym *s)
+{
+ char *p;
+
+ p = utfrune(s->name, 0xb7); // 0xb7 = '·'
+ if(p == nil)
+ return 0;
+ if(memcmp(p, "·Init·", 8) == 0 || memcmp(p, "·init·", 8) == 0)
+ return 1;
+ return 0;
+}
+
+void
+ignoreoptfuncs(void)
+{
+ Prog *p;
+
+ // nop out calls to optional functions
+ // that were not pulled in from libraries.
+ for(p=firstp; p != P; p=p->link) {
+ if(p->to.sym != S && p->to.sym->type == SOPT) {
+ if(p->as != ACALL)
+ diag("bad use of optional function: %P", p);
+ p->as = ANOP;
+ p->from.type = D_NONE;
+ p->to.type = D_NONE;
+ }
+ }
+}
+