]> Cypherpunks repositories - gostls13.git/commitdiff
fix freebsd build
authorRuss Cox <rsc@golang.org>
Wed, 15 Dec 2010 22:20:26 +0000 (17:20 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 15 Dec 2010 22:20:26 +0000 (17:20 -0500)
R=iant, r
CC=dho, golang-dev
https://golang.org/cl/3687041

12 files changed:
src/cmd/6l/asm.c
src/cmd/6l/obj.c
src/cmd/8l/asm.c
src/cmd/8l/obj.c
src/cmd/ld/data.c
src/cmd/ld/go.c
src/cmd/ld/lib.h
src/pkg/deps.bash
src/pkg/runtime/cgo/Makefile
src/pkg/runtime/cgo/freebsd.c [new file with mode: 0644]
src/pkg/runtime/cgo/freebsd_386.c
src/pkg/runtime/cgo/freebsd_amd64.c

index de18b3e299221fd491af73fad8fae37ae6e83957..bd25d7942b33498377347e05ccece929d135b108 100644 (file)
@@ -163,7 +163,6 @@ needlib(char *name)
 
 int nelfsym = 1;
 
-static void    adddynsym(Sym*);
 static void addpltsym(Sym*);
 static void addgotsym(Sym*);
 
@@ -437,7 +436,7 @@ addgotsym(Sym *s)
        }
 }
 
-static void
+void
 adddynsym(Sym *s)
 {
        Sym *d, *str;
index 41c0f93cc646aa06d71328df6c42459b3a4cfeb2..96d78c3b99b1185f6cf9d89583e563d2a9dfde5f 100644 (file)
@@ -245,6 +245,7 @@ main(int argc, char *argv[])
                else
                        doprof2();
        span();
+       addexport();
        textaddress();
        pclntab();
        symtab();
index 882f5d447d3be2ae7f2b3ccca90431d9fd46c4f4..8ffa43e02e5ceeb24f6f92e6bbe56216bf9dbe80 100644 (file)
@@ -153,7 +153,6 @@ needlib(char *name)
 
 int    nelfsym = 1;
 
-static void    adddynsym(Sym*);
 static void    addpltsym(Sym*);
 static void    addgotsym(Sym*);
 
@@ -420,7 +419,7 @@ addgotsym(Sym *s)
        }
 }
 
-static void
+void
 adddynsym(Sym *s)
 {
        Sym *d, *str;
index 4a724d10cc2919e82e8f8abd7ba1e1591710425c..18b2112fe18db429be46855b224a56de0a465a66 100644 (file)
@@ -313,6 +313,7 @@ main(int argc, char *argv[])
                else
                        doprof2();
        span();
+       addexport();
        textaddress();
        pclntab();
        symtab();
index eedfd7930e5157cc36d056802c6e3c38de548873..043798c4555e3efc72c3f23786ed7b6a1e867985 100644 (file)
@@ -165,9 +165,9 @@ relocsym(Sym *s)
                if(r->type >= 256)
                        continue;
 
-               if(r->sym != S && (r->sym->type == SDYNIMPORT || r->sym->dynimpname != nil))
+               if(r->sym != S && r->sym->type == SDYNIMPORT)
                        if (thechar != '8' || HEADTYPE != 10) // Windows PE supports relocation references to dynamic import symbols
-                               diag("unhandled relocation for %s (rtype %d)", r->sym->name, r->type);
+                               diag("unhandled relocation for %s (type %d rtype %d)", r->sym->name, r->sym->type, r->type);
 
                if(r->sym != S && !r->sym->reachable)
                        diag("unreachable sym in relocation: %s %s", s->name, r->sym->name);
index 607cc3f3adebc5c757123261f3a0719e96b2f3cf..00318fe1154d555c43cd103f9b1b81a2e1befa35 100644 (file)
@@ -658,3 +658,12 @@ deadcode(void)
        else
                last->next = nil;
 }
+
+void
+addexport(void)
+{
+       int i;
+       
+       for(i=0; i<ndynexp; i++)
+               adddynsym(dynexp[i]);
+}
index 0f933013dffb4a42253df90d84592e6d8de2ee96..450135a7f55136d29995e9680a3f60051d3b5dcd 100644 (file)
@@ -161,6 +161,8 @@ void        genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*));
 vlong  datoff(vlong);
 void   adddynlib(char*);
 int    archreloc(Reloc*, Sym*, vlong*);
+void   adddynsym(Sym*);
+void   addexport(void);
 
 int    pathchar(void);
 void*  mal(uint32);
index 8e51f40b17076e5c44273316f4bb5bb50be945db..3a29188ce57e8a827742fc9b8087a0fa1ef3c185 100755 (executable)
@@ -14,7 +14,7 @@ if [ -f $OUT ] && ! [ -w $OUT ]; then
 fi
 
 # Get list of directories from Makefile
-dirs=$(make echo-dirs)
+dirs=$(gomake echo-dirs)
 dirpat=$(echo $dirs C | sed 's/ /|/g; s/.*/^(&)$/')
 
 for dir in $dirs; do (
index 749927638719d264f8898fb315ee4c12359c6436..917166e06979413d56486adf72341aaf2f050f6a 100644 (file)
@@ -31,6 +31,12 @@ OFILES=\
 
 CGO_LDFLAGS=-lpthread
 
+ifeq ($(GOOS),freebsd)
+OFILES+=\
+       freebsd.$O\
+
+endif
+
 endif
 
 include ../../../Make.pkg
diff --git a/src/pkg/runtime/cgo/freebsd.c b/src/pkg/runtime/cgo/freebsd.c
new file mode 100644 (file)
index 0000000..dfcfa3a
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2010 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Supply environ and __progname, because we don't
+// link against the standard FreeBSD crt0.o and the
+// libc dynamic library needs them.
+
+char *environ[1];
+char *__progname;
+
+#pragma dynexport environ environ
+#pragma dynexport __progname __progname
index 449a8ef108d647fdb8ca0a441952f63fb8aafd2a..d08e1dee8cb6e250df9fb93b998040f2865b7d3e 100644 (file)
@@ -7,9 +7,6 @@
 
 static void* threadentry(void*);
 
-char *environ[] = { 0 };
-char *__progname;
-
 static void
 xinitcgo(void)
 {
index daac403c11ce62390c0fabf2b5739bfb07af8b6a..a02fbf1519d56d9a62c3e52fabc88d484e4362c8 100644 (file)
@@ -7,9 +7,6 @@
 
 static void* threadentry(void*);
 
-char *environ[] = { 0 };
-char *__progname;
-
 static void
 xinitcgo(void)
 {