This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Libmudflap for sh-elf toolchain cannot access environment variable MUDFLAP_OPTIONS


Hi,

I successfully built the sh-elf cross compiler on the
x86/linux host enabled with libmudflap by specifying the 
correct entry point in libmudflap's configure file.
(newlib-1.15.0 was used)  
 
I compiled a simple c code with following options on 
linux shell:

sh-elf-gcc -fmudflap test.c -static -lmudflap -o test.out

Then I set the MUDFLAP_OPTIONS environment variable as 
-print-leaks and executed the generated test.out file on
the sh-elf simulator. Nothing got displayed.

Following code snippet from __mf_init() function present
in mf-runtime.c is causing problem:

/////////////////////////////////////////////////////
.
.
ov = getenv ("MUDFLAP_OPTIONS");
  if (ov)
    {
      int rc = __mfu_set_options (ov);
      if (rc < 0)
        {
          __mf_usage ();
          exit (1);
        }
    }

  /* Initialize to a non-zero description epoch. */
  __mf_describe_object (NULL);
.
.
/////////////////////////////////////////////////////

getenv("MUDFLAP_OPTIONS") function call returns NULL 
because __environ is pointing to null terminated pointer
array. Hence the options are not setting. 

How to make x86/linux shell's environment variable 
(MUDFLAP_OPTIONS) accessible to test.out while executing
it through the sh-elf simulator? 

  
Regards,
Deepen Mantri

KPIT Cummins InfoSystems Ltd.
Pune, India

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH,H8,
R8C, M16C and M32C Series. The following site also offers 
free technical support to its users. 
Visit http://www.kpitgnutools.com for details.
Latest versions of KPIT GNU tools were released on Feb 6, 07
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]