SELFSECT,
SMACHO, /* Mach-O __nl_symbol_ptr */
SMACHOGOT,
+ SWINDOWS,
SNOPTRDATA,
SINITARR,
SDATA,
- SWINDOWS,
SBSS,
SNOPTRBSS,
STLSBSS,
sp = linklookup(ctxt, p, 0);
free(p);
addstring(sp, value);
+ sp->type = SRODATA;
s = linklookup(ctxt, name, 0);
s->size = 0;
proggenskip(g, g->pos, s->value - g->pos);
g->pos += s->value - g->pos;
- if(s->gotype == nil && s->size >= PtrSize) {
+ // The test for names beginning with . here is meant
+ // to keep .dynamic and .dynsym from turning up as
+ // conservative symbols. They should be marked SELFSECT
+ // and not SDATA, but sometimes that doesn't happen.
+ // Leave debugging the SDATA issue for the Go rewrite.
+
+ if(s->gotype == nil && s->size >= PtrSize && s->name[0] != '.') {
// conservative scan
- diag("missing Go type information for global symbol: %s", s->name);
+ diag("missing Go type information for global symbol: %s size %d", s->name, (int)s->size);
if((s->size%PtrSize) || (g->pos%PtrSize))
diag("proggenaddsym: unaligned conservative symbol %s: size=%lld pos=%lld",
s->name, s->size, g->pos);
proggenarrayend(g);
}
g->pos = s->value + size;
- } else if(s->gotype == nil || decodetype_noptr(s->gotype) || s->size < PtrSize) {
+ } else if(s->gotype == nil || decodetype_noptr(s->gotype) || s->size < PtrSize || s->name[0] == '.') {
// no scan
if(s->size < 32*PtrSize) {
// Emit small symbols as data.
// Provided by the code that imports the package.
// Since we are simulating the import, we have to provide this string.
cgostrsym = "go.string.\"runtime/cgo\"";
- if(linkrlookup(ctxt, cgostrsym, 0) == nil)
+ if(linkrlookup(ctxt, cgostrsym, 0) == nil) {
addstrdata(cgostrsym, "runtime/cgo");
+ linklookup(ctxt, cgostrsym, 0)->type = SRODATA;
+ }
}
if(linkmode == LinkAuto) {
# This tests cgo -cdefs. That mode is not supported,
# so it's okay if it doesn't work on some systems.
# In particular, it works badly with clang on OS X.
-[ "$CGO_ENABLED" != 1 ] || [ "$GOOS" == darwin ] ||
-(xcd ../misc/cgo/testcdefs
-./test.bash || exit 1
-) || exit $?
+# It doesn't work at all now that we disallow C code
+# outside runtime. Once runtime has no C code it won't
+# even be necessary.
+# [ "$CGO_ENABLED" != 1 ] || [ "$GOOS" == darwin ] ||
+# (xcd ../misc/cgo/testcdefs
+# ./test.bash || exit 1
+# ) || exit $?
[ "$CGO_ENABLED" != 1 ] || [ "$GOOS" == darwin ] ||
(xcd ../misc/cgo/testgodefs
// license that can be found in the LICENSE file.
#include "runtime.h"
+#include "textflag.h"
// Look up symbols in the Linux vDSO.
Elf64_Verdef *verdef;
};
+#pragma dataflag NOPTR
static version_key linux26 = { (byte*)"LINUX_2.6", 0x3ae75f6 };
// initialize with vsyscall fallbacks
+#pragma dataflag NOPTR
void* runtime·__vdso_time_sym = (void*)0xffffffffff600400ULL;
+#pragma dataflag NOPTR
void* runtime·__vdso_gettimeofday_sym = (void*)0xffffffffff600000ULL;
+#pragma dataflag NOPTR
void* runtime·__vdso_clock_gettime_sym = (void*)0;
-#define SYM_KEYS_COUNT 3
+#pragma dataflag NOPTR
static symbol_key sym_keys[] = {
{ (byte*)"__vdso_time", 0xa33c485, &runtime·__vdso_time_sym },
{ (byte*)"__vdso_gettimeofday", 0x315ca59, &runtime·__vdso_gettimeofday_sym },
if(vdso_info->valid == false)
return;
- for(i=0; i<SYM_KEYS_COUNT; i++) {
+ for(i=0; i<nelem(sym_keys); i++) {
for(chain = vdso_info->bucket[sym_keys[i].sym_hash % vdso_info->nbucket];
chain != 0; chain = vdso_info->chain[chain]) {