Building programs with MODE=shared in L4Re

Paul Boddie paul at boddie.org.uk
Wed Jul 4 00:44:08 CEST 2018


On Wednesday 27. June 2018 00.43.33 Paul Boddie wrote:
> 
>  Global entries:
>    Address     Access  Initial Sym.Val. Type    Ndx Name
>   00025f80 -32176(gp) 00000000 00000000 FUNC    UND __register_frame_info
> 
> Here, we see the offending entry and what the program apparently expects to
> find. Other entries that are apparently undefined are the following:
> 
> _ITM_deregisterTMCloneTable
> _ITM_registerTMCloneTable
> __deregister_frame_info

Here, I should have realised that the declarations and "null" definitions in 
pkg/l4re-core/ldso/ldso/fixup.c were important in this context, having already 
looked at it amongst many other files while trying to understand what was 
happening.

Fortunately, my off-list helper, Jean Wolter, kindly pointed me to this file 
and suggested that I add definitions for these symbols being produced by my 
compiler (GCC 6.4.0 from Buildroot). Presumably, these symbols are not 
produced by earlier GCC versions, or perhaps not by the compilers employed in 
the MIPS porting exercise.

I did see if I could configure GCC to not use these symbols at all, given that 
there are tests in the code incorporated into executables (libgcc/crtstuff.c) 
for the presence of such symbols, but this was beyond me. So, I added the 
following to fixup.c:

void __deregister_frame_info(void);
void __register_frame_info(void);
void _ITM_deregisterTMCloneTable(void);
void _ITM_registerTMCloneTable(void);

void __deregister_frame_info(void) {}
void __register_frame_info(void) {}
void _ITM_deregisterTMCloneTable(void) {}
void _ITM_registerTMCloneTable(void) {}

Anyway, as a consequence, I got the shared-hello example to function and to 
write its output to fbterminal. Many thanks must go to Jean for suggesting 
things to look at over the course of a few mails.

It was, I suppose, interesting to go from a coprocessor error, related to the 
accidental execution of an ELF magic number word that happens to resemble a 
MIPS floating point instruction, through the different routines related to 
library loading and initialisation in an attempt to identify some mystery code 
(from crtstuff.c), examining global offset table entries and their potential 
misinterpretation, before arriving at such a simple solution.

Paul




More information about the l4-hackers mailing list