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

Jan C. Bernauer bernauer at mit.edu
Fri Jul 16 19:38:31 UTC 2010



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
...

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/

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.

I suppose the link command is wrong?

Best regards
Jan







More information about the users mailing list