RTEMS (+epics) on a mvme167: Problems with environ

Eric Norum wenorum at lbl.gov
Fri Jul 16 19:43:00 UTC 2010


On Jul 16, 2010, at 12:38 PM, Jan C. Bernauer wrote:

> 
> 
> Hi,
> 
> thanks for the quick reply.
> ok, I searched further:
> 
> 
> On 16.07.10 13:08, Till Straumann wrote:
>> On 07/16/2010 05:19 PM, Jan C. Bernauer wrote:
>>>  Hi,
>>> 
>>>  I am struggling to get RTEMS+EPICS working on an mvme167 (m68k based
>>> vme cpu).
>>> 
>>> As far as I see, the environ pointer is 0.
>> 
>> You should try to find out where your 'environ' pointer comes from (use
>>  a linker map by adding -Wl,-Map,xxx.map).
>> 
> 
> It seems that it stays the way start.S is defining it:
> BEGIN_DATA
> 
>        PUBLIC (environ)
>        .align 2
> SYM (environ):
>        .long   0


That's weird.
I'd suggest just removing those four lines.

> ...
> 
> xxx.map:
> .data          0x00000000010a83b0        0x8
> /opt/rtems/m68k-rtems/mvme167/lib/start.o
>                0x00000000010a83b0                environ
> 
> 
>> It should never be NULL -- newlib (environ.c) sets it initially
>> 
>> /* Provide a definition of `environ' if crt0.o doesn't.  */
>> 
>> static char *initial_env[] = { 0 };
>> 
>> /* Posix says `environ' is a pointer to a null terminated list of
>> pointers.
>>    Hence `environ' itself is never NULL.  */
>> char **environ =&initial_env[0];
>> 
> Ok, I found the file, and its object code is contained in the libc.a
> which is used:
> 
> ar -t libc.a  |grep environ
> lib_a-environ.o/

Right -- the linker probably isn't pulling this from the library since the linker already has a definition for that symbol.

> 
> However, the linker does not seem to use it. My link command  is:
> m68k-rtems-gcc --pipe -B/opt/rtems/m68k-rtems/mvme167/lib/ -specs
> bsp_specs -qrtems   -g -Wall  -O2 -g -fno-omit-frame-pointer -g
> -mcpu=68040       -Wl,--defsym -Wl,HeapSize=0x80000 -Wl,-Map,xxx.map
> -mcpu=68040   -o o-optimize/hello.exe  o-optimize/init.o    -lnfs
> 
> appending -Wl,--verbose gives lines like:
> (/Volumes/MacData/opt/rtems/bin/../lib/gcc/m68k-rtems/4.4.2/../../../../m68k-rtems/lib/m68040/libc.a)lib_a-envlock.o
> 
> but not a line with lib_a-environ.o.

No need -- it will be pulled from the library if necessary.

> 
> I suppose the link command is wrong?

I think that the linker *script* is wrong.
> 

-- 
Eric Norum
wenorum at lbl.gov





More information about the users mailing list