Commit 78a6f752 authored by Shenghou Ma's avatar Shenghou Ma

cmd/ld: handle weak symbols

compiler_rt introduces a weak and hidden symbol compilerrt_abort_impl
into our pre-linked _all.o object, we have to handle it.

Fixes #4273.

R=iant, rsc, r
CC=golang-dev
https://golang.org/cl/6783050
parent be6afde3
// Copyright 2012 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.
#ifdef __ELF__
__attribute__((weak))
__attribute__((visibility("hidden")))
void _compilerrt_abort_impl(const char *file, int line, const char *func) {
}
#endif
// Copyright 2012 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.
#ifdef __ELF__
extern void _compilerrt_abort_impl(const char *file, int line, const char *func);
void __my_abort(const char *file, int line, const char *func) {
_compilerrt_abort_impl(file, line, func);
}
#endif
......@@ -807,6 +807,13 @@ readsym(ElfObj *obj, int i, ElfSym *sym, int needSym)
s->type = SHIDDEN;
}
break;
case ElfSymBindWeak:
if(needSym) {
s = newsym(sym->name, 0);
if(sym->other == 2)
s->type = SHIDDEN;
}
break;
default:
werrstr("%s: invalid symbol binding %d", sym->name, sym->bind);
return -1;
......
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