SYSV / EABI compliance

Till Straumann strauman at SLAC.Stanford.EDU
Tue Feb 18 18:21:36 UTC 2003


Chris Johns wrote:
> Till Straumann wrote:
> 
>> I encountered one problem, however: Certain parts of
>> the system (mostly BSP specific stuff, but also
>> cpukit/libnetworking/kern/kern_sysctl.o) access
>> linker defined symbols in the following way:
> 
> 
> The sysctl related code is in:
> 
>  cpukit/libnetworking/sys/linker_set.h
> 
> and needs a linker script change to collect all the variables into an 
> array.
> 
>> /* with -msdata=eabi, the compiler assumes
>>  * this variable's address will be linked
>>  * in the short data area.
>>  */
>> extern int some_linker_defined_address;
>>
>> ...
>> /* use the address here */
>>
>> yyy( (unsigned) & some_linker_defined_address )
>>
>> When compiling with -msdata=eabi, a linker error results
>> because the compiler generates code who tries to locate
>> the address in a short data area while it is actually
>> an absolute address.
>>
>> I solved this by declaring the bogus variable
>> (only the address has a meaning) as an array of unknown
>> size:
>>
>> /* compiler doesn't know the size, hence access is
>>  * through an absolute address
>>  */
>> extern int some_linker_defined_address[];
>> ...
>> yyy( (unsigned)some_linker_defined_address )
>>
>> Does anyone have a better solution / suggestion?
> 
> 
> I do not understand what you needed to do for sysctl ?
> 

Well, for the moment, I just compiled the relevant file
without -msdata but what would need to be changed are the
'linker_set.h' macro definitions so they declare the
linker defined addresses in a way similar to my example
above.

I guess it would look like this:

#define SET_DECLARE(set, ptype)                     \
     extern ptype *__CONCAT(__start_set_,set)[];         \
     extern ptype *__CONCAT(__stop_set_,set)[]

#define SET_BEGIN(set)                          \
     (__CONCAT(__start_set_,set))
#define SET_LIMIT(set)                          \
     (__CONCAT(__stop_set_,set))

-- Till

> Did you have to provide definitions for each sysctl variable that uses 
> the TEXT_SET macro ?
> 






More information about the users mailing list