summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2018-09-29 16:29:12 +0000
committerkettenis <kettenis@openbsd.org>2018-09-29 16:29:12 +0000
commit2d7721fea8e102cf4d8eb7fc9ae39a2704f26f22 (patch)
treeb0ee62c12035548cfdcceb07c35318195ff16e63
parenttest that PWD and OLDPWD are exported (diff)
downloadwireguard-openbsd-2d7721fea8e102cf4d8eb7fc9ae39a2704f26f22.tar.xz
wireguard-openbsd-2d7721fea8e102cf4d8eb7fc9ae39a2704f26f22.zip
Allow preemption of functions with protected visibility. Disallowing this
makes no sense. Yes it breaks function address equality and therefore the expectations of the standard C language. However declaring symbols with protected visibility isn't standard C in the first place. Fixes linking non-PIC/PIE code with lld on amd64. ok millert@
-rw-r--r--gnu/llvm/tools/lld/ELF/Relocations.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/llvm/tools/lld/ELF/Relocations.cpp b/gnu/llvm/tools/lld/ELF/Relocations.cpp
index 37bc8bcbd57..abe5498ba51 100644
--- a/gnu/llvm/tools/lld/ELF/Relocations.cpp
+++ b/gnu/llvm/tools/lld/ELF/Relocations.cpp
@@ -630,7 +630,8 @@ static RelExpr adjustExpr(Symbol &Sym, RelExpr Expr, RelType Type,
if (!Sym.isShared() || Config->Shared)
return Expr;
- if (Sym.getVisibility() != STV_DEFAULT) {
+ if (Sym.getVisibility() != STV_DEFAULT &&
+ (Sym.getVisibility() != STV_PROTECTED || !Sym.isFunc())) {
error("cannot preempt symbol: " + toString(Sym) +
getLocation(S, Sym, RelOff));
return Expr;