From Jérôme Duval <jerome.duval@xxxxxxxxx>:
Jérôme Duval has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/5392 ;)
Change subject: runtime_loader: accept type STT_FUNC when STT_OBJECT is
requested
......................................................................
runtime_loader: accept type STT_FUNC when STT_OBJECT is requested
trying to load a PIE executable produced by golang show the following (for
pthread_create)
12: 0000000000000000 0 OBJECT GLOBAL DEFAULT UND pthread_create
12655: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND pthread_create
It's the same for Linux or Solaris, so I suppose we're being too picky.
---
M src/system/runtime_loader/elf_symbol_lookup.cpp
1 file changed, 4 insertions(+), 5 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/92/5392/1
diff --git a/src/system/runtime_loader/elf_symbol_lookup.cpp
b/src/system/runtime_loader/elf_symbol_lookup.cpp
index 4a46c6b..a63b7ea 100644
--- a/src/system/runtime_loader/elf_symbol_lookup.cpp
+++ b/src/system/runtime_loader/elf_symbol_lookup.cpp
@@ -127,7 +127,7 @@
uint32 type = symbol->Type();
if ((lookupInfo.type == B_SYMBOL_TYPE_TEXT && type !=
STT_FUNC)
|| (lookupInfo.type == B_SYMBOL_TYPE_DATA
- && type != STT_OBJECT)) {
+ && type != STT_OBJECT && type !=
STT_FUNC)) {
continue;
}
@@ -495,8 +495,6 @@
int32 type = B_SYMBOL_TYPE_ANY;
if (sym->Type() == STT_FUNC)
type = B_SYMBOL_TYPE_TEXT;
- else if (sym->Type() == STT_OBJECT)
- type = B_SYMBOL_TYPE_DATA;
if (sym->Bind() == STB_LOCAL) {
// Local symbols references are always resolved to the given
symbol.
@@ -537,8 +535,9 @@
sharedImage = NULL;
}
} else if (sym->Type() != STT_NOTYPE
- && sym->Type() != sharedSym->Type()) {
- // symbol not of the requested type
+ && sym->Type() != sharedSym->Type()
+ && (sym->Type() != STT_OBJECT || sharedSym->Type() !=
STT_FUNC)) {
+ // symbol not of the requested type, except object which can
match function
lookupError = ERROR_WRONG_TYPE;
sharedImage = NULL;
} else if (sharedSym->Bind() != STB_GLOBAL
--
To view, visit https://review.haiku-os.org/c/haiku/+/5392
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ibe817c231365aba8b2eb88eb3f556d2bd1db384a
Gerrit-Change-Number: 5392
Gerrit-PatchSet: 1
Gerrit-Owner: Jérôme Duval <jerome.duval@xxxxxxxxx>
Gerrit-MessageType: newchange