summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-07-16 15:07:54 +1000
committerChris Johns <chrisj@rtems.org>2012-07-16 15:07:54 +1000
commit5d126da01db7c0e140ca35389dfe8f7227f10622 (patch)
treeec501af328f2fd23a4ae7cdd53991fb8743b831d /wscript
parent8f06d01b2c6e051d9b6f733f6673b796490983f9 (diff)
Resolve unresolved externals when loading object files.
Object files that depend on each other will cause an unresolved external. The change lets object files load with unresolved externals and will resolve them when the object file with the external is loaded. A common table of symbol strings and relocation records is maintained. The symbol string is shared by each object file that is unresolved. Each relocation record that references the symbol is held. The table is a series of small blocks that compact as symbols are resolved. The number of symbols left unresolved is typically small this design avoids fragmentation of the heap memory.
Diffstat (limited to 'wscript')
-rw-r--r--wscript42
1 files changed, 18 insertions, 24 deletions
diff --git a/wscript b/wscript
index 7ab2cbf..c58964f 100644
--- a/wscript
+++ b/wscript
@@ -17,6 +17,9 @@ def configure(conf):
conf.env.ASCIIDOC = conf.find_program(['asciidoc.py'], mandatory = False)
conf.env.ASCIIDOC_FLAGS = ['-b', 'html5', '-a', 'data-uri', '-a', 'icons', '-a', 'max-width=55em-a']
+ # hack on at the moment.
+ conf.env.GSYM_EMBEDDED = True
+
def build(bld):
bld.add_post_fun(rtl_post_build)
@@ -24,10 +27,14 @@ def build(bld):
arch = bld.get_env()['RTEMS_ARCH']
- bld.includes = ['.',
+ bld.includes = ['.',
'libbsd/include',
'libbsd/include/arch/' + arch]
+ bld.defines = ['PACKAGE_VERSION="' + version + '"']
+ if bld.env.GSYM_EMBEDDED:
+ bld.defines += ['RTL_GSYM_EMBEDDED=1']
+
rtl_source(bld, arch)
rtl_liba(bld, arch)
rtl_root_fs(bld)
@@ -39,7 +46,7 @@ def build(bld):
'main.c',
'fs-root-tarfile.o'],
includes = bld.includes,
- defines = ['PACKAGE_VERSION="' + version + '"'],
+ defines = bld.defines,
use = ['rtl', 'rootfs', 'rtld-gsyms'],
depends_on = 'gsyms')
@@ -72,15 +79,17 @@ def rtl_source(bld, arch):
'rtl-string.c',
'rtl-sym.c',
'rtl-trace.c',
+ 'rtl-unresolved.c',
'rtl-mdreloc-' + arch + '.c'])
def rtl_liba(bld, arch):
bld(target = 'x',
features = 'c cstlib',
includes = bld.includes,
+ defines = bld.defines,
source = ['xa.c',
'x-long-name-to-create-gnu-extension-in-archive.c'])
-
+
def mmap_source(bld, includes):
bld(target = 'mmap',
features = 'c',
@@ -111,35 +120,20 @@ def rtl_gsyms(bld):
import os
sb = os.stat(src)
if sb.st_size == 0:
+ if bld.env.GSYM_EMBEDDED:
+ flags = '--embed'
+ else:
+ flags = ''
bld(name = 'gsyms',
target = 'gsyms.c',
always = True,
- rule = '${NM} -g rtld | awk -f ../../mksyms.awk - > ${TGT}')
- else:
- open(src, 'a').close()
- bld(target = 'rtld-gsyms',
- features = 'c',
- includes = bld.includes,
- source = ['rtld-gsyms.c'],
- depends_on = 'gsyms')
-
-def x_rtl_gsyms(bld):
- import os.path
- src = os.path.join(bld.get_variant_dir(), 'gsyms.c')
- if os.path.exists(src):
- if os.path.exists(os.path.join(bld.get_variant_dir(), 'rtld')):
- import os
- sb = os.stat(src)
- if sb.st_size == 0:
- bld(name = 'gsyms',
- target = 'gsyms.c',
- always = True,
- rule = '${NM} -g rtld | awk -f ../../mksyms.awk - > ${TGT}')
+ rule = '${NM} -g rtld | awk -f ../../mksyms.awk - ' + flags + ' > ${TGT}')
else:
open(src, 'a').close()
bld(target = 'rtld-gsyms',
features = 'c',
includes = bld.includes,
+ defines = bld.defines,
source = ['rtld-gsyms.c'],
depends_on = 'gsyms')