find_undefined_symbol_add_on(): Resolve non-weak symbols defined in the add-on
to themselves. This works around the problem that those symbols could be resolved to symbols in the application, which is usually undesired. Weak symbols have the same problem, but the the runtime loader cannot decide which should be resolved locally and which mustn't. The root issue is that BeOS style add-ons simply cannot be supported by a standard-complying ELF loader. Affects gcc 4 only, since with gcc 2 we link everything symbolically. The best solution for the time being would be to build gcc 4 add-ons with default hidden visibility, exporting only the symbols that should be visible. Related ticket: #7114 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40248 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1071298672
commit
b7786ebd30
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
@ -401,6 +401,24 @@ find_undefined_symbol_add_on(image_t* rootImage, image_t* image,
|
||||
// library symbol references to symbol definitions in the add-on, as
|
||||
// libraries can be shared between different add-ons and we must not
|
||||
// introduce connections between add-ons.
|
||||
|
||||
// For the add-on image itself resolve non-weak symbols defined in the
|
||||
// add-on to themselves. This makes the symbol resolution order inconsistent
|
||||
// for those symbols, but avoids clashes of global symbols defined in the
|
||||
// add-on with symbols defined e.g. in the application. There's really the
|
||||
// same problem for weak symbols, but we don't have any way to discriminate
|
||||
// weak symbols that must be resolved globally from those that should be
|
||||
// resolved within the add-on.
|
||||
if (rootImage == image) {
|
||||
if (Elf32_Sym* symbol = lookupInfo.requestingSymbol) {
|
||||
if (symbol->st_shndx != SHN_UNDEF
|
||||
&& (ELF32_ST_BIND(symbol->st_info) == STB_GLOBAL)) {
|
||||
*_foundInImage = image;
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image_t* candidateImage = NULL;
|
||||
Elf32_Sym* candidateSymbol = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user