Dynamic Libraries

Till Straumann strauman at slac.stanford.edu
Mon Sep 11 17:07:40 UTC 2006


Allan Hessenflow wrote:
>> I'm having a problem linking in the file generated by xsyms. Here is
>> what I do. I have a Loader application and then a TestApp which I want
>> to load at runtime.
>>
>> test: Loader.o TestAoo.o
>> 	@echo --------- Linking Loader application - first pass
>> 	$(CC) $(CFLAGS) Loader.o $(CEXP_LDFLAGS) $(CEXP_LIBS) $(LDFLAGS)
>> $(LDLIBS) -o Loader
>> 	@echo --------- Generating SYSTEM symbol table
>> 	$(XSYMS) -C Loader Symbols.c
>> 	@echo --------- Compiling SYSTEM symbol table
>> 	$(CC) $(CFLAGS) -c -fomit-frame-pointer -fasm -O Symbols.c
>> 	@echo --------- Linking Loader application - second pass
>> 	$(CC) $(CFLAGS) Symbols.o Loader.o $(CEXP_LDFLAGS) $(CEXP_LIBS)
>> $(LDFLAGS) $(LDLIBS) -o Loader 
>>
>> I successfully generate  system table from the Loader executable in
>> Symbols.c, but then when I'm linking Symbols.o I got the following error
>> messages:
>> Symbols.o(.data+0x4): undefined reference to `__cexp__dummy_alias_0'
>> Symbols.o(.data+0x1c): undefined reference to `__cexp__dummy_alias_1'
>> Symbols.o(.data+0x34): undefined reference to `__cexp__dummy_alias_2'
>> ...
>> Symbols.o(.data+0x1fc): undefined reference to `__cexp__dummy_alias_21'
>> Symbols.o(.data+0x214): undefined reference to `__cexp__dummy_alias_22'
>> collect2: ld returned 1 exit status
>>     
>
> When I was setting something like that up I ran into the same problem, but
> noticed that xsyms put out lines on stdout for each of the undefined
> __cexp__dummy_alias_* that would work as link commands.  So I redirected
> those to a temp file and used that as an additional linker script for the
> final link.
>
> allan
>
>   
Allan is correct. RTMF (see step 4), please [from the README]:

 >  1) compile and link all sources, libraries etc.; build an executable
 >  2) xsyms -C executable  mysymtab.c > link_helper
 >  3) compile mysymtab.c (set -I to Cexp source directory, since
 >     cexpsyms.h is included)
 >  4) link application again, but this time add 'mysymtab.c' to the
 >     list of sources and 'link_helper' to the list of files to
 >     be linked.
 >  NOTE: Step 1) linking succeeds without a symtab.o because there's
 >        a weak NULL-ptr alias for the builtin symtab.

HTH
-- Till



More information about the users mailing list