summaryrefslogtreecommitdiff
path: root/rld-elf.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-12-29 10:20:22 +1100
committerChris Johns <chrisj@rtems.org>2012-12-29 10:20:22 +1100
commitcc54579b0b54bd349f1d69f40aa89607e32bf614 (patch)
tree8d5fef66763090ebab459497d7302d0111b8e988 /rld-elf.cpp
parent0123e92cdeb732ae20c3a69047c7d05877cb0318 (diff)
Fix managing weak symbols.
Weak symbols where not being managed correctly. The symbols table is now a class with externals and weaks as separate symtabs so the externals can be searched first then the weaks and if not found an unresolved error is raised. This was found creating a libbsdport RAP file where the drivers in the all driver table resolved to the weak symbols and so linking in nothing. Fixing the weak symbols as found in the libbsdport library triggered a new resolver bug. The object files now contain the resolver state and this is used to determine if an object file has been resolved or is currently being resolved avoiding rescursive loops with dependent object files. The resolver trace output is a little easier to read.
Diffstat (limited to 'rld-elf.cpp')
-rw-r--r--rld-elf.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/rld-elf.cpp b/rld-elf.cpp
index 5cfcc8f..c8e7aa1 100644
--- a/rld-elf.cpp
+++ b/rld-elf.cpp
@@ -853,14 +853,14 @@ namespace rld
if (unresolved)
add = true;
}
- else if (!unresolved)
+ else
{
if (((stype == STT_NOTYPE) ||
(stype == STT_OBJECT) ||
(stype == STT_FUNC)) &&
- ((local && (sbind == STB_LOCAL)) ||
- (weak && (sbind == STB_WEAK)) ||
- (global && (sbind == STB_GLOBAL))))
+ ((weak && (sbind == STB_WEAK)) ||
+ (!unresolved && ((local && (sbind == STB_LOCAL)) ||
+ (global && (sbind == STB_GLOBAL))))))
add = true;
}