|
From: <mic...@us...> - 2007-07-11 16:34:30
|
Revision: 151
http://svn.sourceforge.net/pearcolator/?rev=151&view=rev
Author: michael_baer
Date: 2007-07-11 09:34:25 -0700 (Wed, 11 Jul 2007)
Log Message:
-----------
- Make sure that the runtime linker does not return a local symbol when we're trying to resolve a global symbol.
Modified Paths:
--------------
src/org/binarytranslator/arch/arm/os/process/loader/ARM_RuntimeLinker.java
src/org/binarytranslator/generic/os/loader/elf/JavaRuntimeLinker.java
Modified: src/org/binarytranslator/arch/arm/os/process/loader/ARM_RuntimeLinker.java
===================================================================
--- src/org/binarytranslator/arch/arm/os/process/loader/ARM_RuntimeLinker.java 2007-07-09 10:42:27 UTC (rev 150)
+++ src/org/binarytranslator/arch/arm/os/process/loader/ARM_RuntimeLinker.java 2007-07-11 16:34:25 UTC (rev 151)
@@ -70,7 +70,7 @@
if (symbol.isUndefined()) {
String symbolName = strTab.lookup(symbol.nameIdx);
- value = resolveSymbolAddress(symbolName);
+ value = resolveSymbolAddress(symbolName, lib);
if (value == -1) {
//we allow only weak symbols to be unresolved
Modified: src/org/binarytranslator/generic/os/loader/elf/JavaRuntimeLinker.java
===================================================================
--- src/org/binarytranslator/generic/os/loader/elf/JavaRuntimeLinker.java 2007-07-09 10:42:27 UTC (rev 150)
+++ src/org/binarytranslator/generic/os/loader/elf/JavaRuntimeLinker.java 2007-07-11 16:34:25 UTC (rev 151)
@@ -119,6 +119,7 @@
* This function is the main entry point into the dynamic linker and will steer the whole
* linking process.
*/
+ @Override
public final void link() throws IOException {
ELF_File.DynamicSection dynSection = file.getDynamicSection();
@@ -193,7 +194,7 @@
*/
protected void callInitRoutines() throws IOException {
//the linker has a special symbol that determines if we're currently starting up
- int dl_starting_up = resolveSymbolAddress("_dl_starting_up");
+ int dl_starting_up = resolveSymbolAddress("_dl_starting_up", null);
if (dl_starting_up != -1)
ps.memory.store32(dl_starting_up, 1);
@@ -392,10 +393,13 @@
*
* @param symbol
* The name of the symbol that is to be resolved.
+ * @param obj
+ * The shared object for which we are trying to resolve the symbol address. Local symbols from
+ * this object will be returned as a match as well.
* @return
* The address of the symbol or -1, if the symbol's address could not be resolved.
*/
- protected final int resolveSymbolAddress(String symbol) throws IOException {
+ protected final int resolveSymbolAddress(String symbol, SharedObject obj) throws IOException {
Iterator<SharedObject> libs = libraries.iterator();
//iterate over the symbol table of every library that we already loaded
@@ -406,8 +410,10 @@
//see if <symbol> is defined within this library
SymbolTable.Entry entry = hashTab.lookup(symbol);
- if (entry != null && !entry.isUndefined())
- return entry.value + lib.loadedAt;
+ if (entry != null && !entry.isUndefined() && entry.binding != SymbolTable.STB_LOCAL) {
+ if (entry.binding == SymbolTable.STB_GLOBAL || lib == obj)
+ return entry.value + lib.loadedAt;
+ }
}
return -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|