Commit 33405ecc authored by Russ Cox's avatar Russ Cox

fix freebsd build

R=iant, r
CC=dho, golang-dev
https://golang.org/cl/3687041
parent 1a072f4b
...@@ -163,7 +163,6 @@ needlib(char *name) ...@@ -163,7 +163,6 @@ needlib(char *name)
int nelfsym = 1; int nelfsym = 1;
static void adddynsym(Sym*);
static void addpltsym(Sym*); static void addpltsym(Sym*);
static void addgotsym(Sym*); static void addgotsym(Sym*);
...@@ -437,7 +436,7 @@ addgotsym(Sym *s) ...@@ -437,7 +436,7 @@ addgotsym(Sym *s)
} }
} }
static void void
adddynsym(Sym *s) adddynsym(Sym *s)
{ {
Sym *d, *str; Sym *d, *str;
......
...@@ -245,6 +245,7 @@ main(int argc, char *argv[]) ...@@ -245,6 +245,7 @@ main(int argc, char *argv[])
else else
doprof2(); doprof2();
span(); span();
addexport();
textaddress(); textaddress();
pclntab(); pclntab();
symtab(); symtab();
......
...@@ -153,7 +153,6 @@ needlib(char *name) ...@@ -153,7 +153,6 @@ needlib(char *name)
int nelfsym = 1; int nelfsym = 1;
static void adddynsym(Sym*);
static void addpltsym(Sym*); static void addpltsym(Sym*);
static void addgotsym(Sym*); static void addgotsym(Sym*);
...@@ -420,7 +419,7 @@ addgotsym(Sym *s) ...@@ -420,7 +419,7 @@ addgotsym(Sym *s)
} }
} }
static void void
adddynsym(Sym *s) adddynsym(Sym *s)
{ {
Sym *d, *str; Sym *d, *str;
......
...@@ -313,6 +313,7 @@ main(int argc, char *argv[]) ...@@ -313,6 +313,7 @@ main(int argc, char *argv[])
else else
doprof2(); doprof2();
span(); span();
addexport();
textaddress(); textaddress();
pclntab(); pclntab();
symtab(); symtab();
......
...@@ -165,9 +165,9 @@ relocsym(Sym *s) ...@@ -165,9 +165,9 @@ relocsym(Sym *s)
if(r->type >= 256) if(r->type >= 256)
continue; 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 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) if(r->sym != S && !r->sym->reachable)
diag("unreachable sym in relocation: %s %s", s->name, r->sym->name); diag("unreachable sym in relocation: %s %s", s->name, r->sym->name);
......
...@@ -658,3 +658,12 @@ deadcode(void) ...@@ -658,3 +658,12 @@ deadcode(void)
else else
last->next = nil; last->next = nil;
} }
void
addexport(void)
{
int i;
for(i=0; i<ndynexp; i++)
adddynsym(dynexp[i]);
}
...@@ -161,6 +161,8 @@ void genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*)); ...@@ -161,6 +161,8 @@ void genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*));
vlong datoff(vlong); vlong datoff(vlong);
void adddynlib(char*); void adddynlib(char*);
int archreloc(Reloc*, Sym*, vlong*); int archreloc(Reloc*, Sym*, vlong*);
void adddynsym(Sym*);
void addexport(void);
int pathchar(void); int pathchar(void);
void* mal(uint32); void* mal(uint32);
......
...@@ -14,7 +14,7 @@ if [ -f $OUT ] && ! [ -w $OUT ]; then ...@@ -14,7 +14,7 @@ if [ -f $OUT ] && ! [ -w $OUT ]; then
fi fi
# Get list of directories from Makefile # Get list of directories from Makefile
dirs=$(make echo-dirs) dirs=$(gomake echo-dirs)
dirpat=$(echo $dirs C | sed 's/ /|/g; s/.*/^(&)$/') dirpat=$(echo $dirs C | sed 's/ /|/g; s/.*/^(&)$/')
for dir in $dirs; do ( for dir in $dirs; do (
......
...@@ -31,6 +31,12 @@ OFILES=\ ...@@ -31,6 +31,12 @@ OFILES=\
CGO_LDFLAGS=-lpthread CGO_LDFLAGS=-lpthread
ifeq ($(GOOS),freebsd)
OFILES+=\
freebsd.$O\
endif
endif endif
include ../../../Make.pkg include ../../../Make.pkg
......
// 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
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
static void* threadentry(void*); static void* threadentry(void*);
char *environ[] = { 0 };
char *__progname;
static void static void
xinitcgo(void) xinitcgo(void)
{ {
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
static void* threadentry(void*); static void* threadentry(void*);
char *environ[] = { 0 };
char *__progname;
static void static void
xinitcgo(void) xinitcgo(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment