summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-10-12 21:45:53 +0000
committerRui Ueyama <ruiu@google.com>2017-10-12 21:45:53 +0000
commitd32f06c37907c144fd5c3aa1b4bff75863a3baa1 (patch)
treee1f3df80c916659502acae2b6027dadb84333faa
parent91cc00bde6cb382ca96ce4beb3f1f343e43df6d9 (diff)
downloadbcm5719-llvm-d32f06c37907c144fd5c3aa1b4bff75863a3baa1.tar.gz
bcm5719-llvm-d32f06c37907c144fd5c3aa1b4bff75863a3baa1.zip
Add comment.
llvm-svn: 315625
-rw-r--r--lld/ELF/Symbols.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index a361498a940..cccbcda00ea 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -214,8 +214,23 @@ public:
const void *ElfSym, const void *Verdef)
: Defined(SymbolBody::SharedKind, Name, /*IsLocal=*/false, StOther, Type),
Verdef(Verdef), ElfSym(ElfSym) {
- // IFuncs defined in DSOs are treated as functions by the static linker.
- if (isGnuIFunc())
+ // GNU ifunc is a mechanism to allow user-supplied functions to
+ // resolve PLT slot values at load-time. This is contrary to the
+ // regualr symbol resolution scheme in which symbols are resolved just
+ // by name. Using this hook, you can program how symbols are solved
+ // for you program. For example, you can make "memcpy" to be resolved
+ // to a SSE-enabled version of memcpy only when a machine running the
+ // program supports the SSE instruction set.
+ //
+ // Naturally, such symbols should always be called through their PLT
+ // slots. What GNU ifunc symbols point to are resolver functions, and
+ // calling them directly doesn't make sense (unless you are writing a
+ // loader).
+ //
+ // For DSO symbols, we always call them through PLT slots anyway.
+ // So there's no difference between GNU ifunc and regular function
+ // symbols if they are in DSOs. So we can handle GNU_IFUCN as FUNC.
+ if (this->Type == llvm::ELF::STT_GNU_IFUNC)
this->Type = llvm::ELF::STT_FUNC;
}
OpenPOWER on IntegriCloud