readelf utility concatenates underscores to fortran variables with underscores - Help

This is a discussion on readelf utility concatenates underscores to fortran variables with underscores - Help ; Hello, C File test.f program main integer test1 integer test_10 common /test/ test1,test_10 end C compile : C f77 -g test.f When I do readelf -w --debug-dump=info a.out, and look at the ouput. All my Fortran common variables containing at ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: readelf utility concatenates underscores to fortran variables with underscores

  1. readelf utility concatenates underscores to fortran variables with underscores

    Hello,

    C File test.f

    program main
    integer test1
    integer test_10
    common /test/ test1,test_10
    end

    C compile :
    C f77 -g test.f

    When I do readelf -w --debug-dump=info a.out, and look at the ouput. All my
    Fortran common variables containing at least 1 underscore get converted into
    having 2 extra underscores in the output. Is there any way that I can prevent
    readelf from adding the additional underscores?

    I.E.: In the output, "test1" is "test1", but "test_10" becomes "test_10__"!
    And, I want to try and avoid having to do this acknowledgement in my own
    scripts.

    Thank you,
    Christopher Lusardi

  2. Re: readelf utility concatenates underscores to fortran variables with underscores

    clusardi2k@aol.com (Christopher M. Lusardi) writes:
    >Hello,
    >
    >C File test.f
    >
    > program main
    > integer test1
    > integer test_10
    > common /test/ test1,test_10
    > end
    >
    >C compile :
    >C f77 -g test.f
    >
    > When I do readelf -w --debug-dump=info a.out, and look at the ouput. All my
    >Fortran common variables containing at least 1 underscore get converted into
    >having 2 extra underscores in the output. Is there any way that I can prevent
    >readelf from adding the additional underscores?


    Readelf is _not_ adding the extra underscores. The compiler is. Why does it
    matter to you?

    scott


  3. Re: readelf utility concatenates underscores to fortran variables with underscores

    scott@slp53.sl.home (Scott Lurndal) wrote in message news:...
    > clusardi2k@aol.com (Christopher M. Lusardi) writes:
    > >Hello,
    > >
    > >C File test.f
    > >
    > > program main
    > > integer test1
    > > integer test_10
    > > common /test/ test1,test_10
    > > end
    > >
    > >C compile :
    > >C f77 -g test.f
    > >
    > > When I do readelf -w --debug-dump=info a.out, and look at the ouput. All my
    > >Fortran common variables containing at least 1 underscore get converted into
    > >having 2 extra underscores in the output. Is there any way that I can prevent
    > >readelf from adding the additional underscores?

    >
    > Readelf is _not_ adding the extra underscores. The compiler is. Why does it
    > matter to you?
    >
    > scott


    I'm creating a debugger program, and I was hoping to make my program more
    portable. Anyway, I can force my program to look for a trailing "__" and a "_"
    before that and then strip off the "__". I'll do this unless you can suggest
    a better way to do this.

    Christopher Lusardi

  4. Re: readelf utility concatenates underscores to fortran variables with underscores

    clusardi2k@aol.com (Christopher M. Lusardi) writes:
    >scott@slp53.sl.home (Scott Lurndal) wrote in message news:...
    >> clusardi2k@aol.com (Christopher M. Lusardi) writes:
    >> >Hello,
    >> >
    >> >C File test.f
    >> >
    >> > program main
    >> > integer test1
    >> > integer test_10
    >> > common /test/ test1,test_10
    >> > end
    >> >
    >> >C compile :
    >> >C f77 -g test.f
    >> >
    >> > When I do readelf -w --debug-dump=info a.out, and look at the ouput. All my
    >> >Fortran common variables containing at least 1 underscore get converted into
    >> >having 2 extra underscores in the output. Is there any way that I can prevent
    >> >readelf from adding the additional underscores?

    >>
    >> Readelf is _not_ adding the extra underscores. The compiler is. Why does it
    >> matter to you?
    >>
    >> scott

    >
    >I'm creating a debugger program, and I was hoping to make my program more
    >portable. Anyway, I can force my program to look for a trailing "__" and a "_"
    >before that and then strip off the "__". I'll do this unless you can suggest
    >a better way to do this.
    >
    >Christopher Lusardi


    For reasons such as the above, debuggers are generally specific to the
    compiler suite which generates the object code being debugged. C++
    name demangling is another area in which portability will no be
    assured. There may also be platform specific areas such as signal
    trampolining and c-runtime startup code (crt.0) which are not generally
    portable that the debugger will need to be aware of.

    You should be able to abstract out the non-portable features into a
    platform dependent layer of your debugger.

    scott

  5. Re: readelf utility concatenates underscores to fortran variables with underscores

    scott@slp53.sl.home (Scott Lurndal) wrote in message news:...
    >
    > For reasons such as the above, debuggers are generally specific to the
    > compiler suite which generates the object code being debugged. C++
    > name demangling is another area in which portability will no be
    > assured. There may also be platform specific areas such as signal
    > trampolining and c-runtime startup code (crt.0) which are not generally
    > portable that the debugger will need to be aware of.
    >
    > You should be able to abstract out the non-portable features into a
    > platform dependent layer of your debugger.
    >
    > scott


    How about a tutorial? Can you post simple examples to clarify your view about
    crt.0?

    I, myself, have never dealt with it before! But, I am curious.

    What is it? How does it enter into the picture? Where is it? How can I
    manipulate it to see what it can do? What are the common dangers of modifying
    it? What should I never do to it? What uses it? When does it get used? Where
    can I go to get a simple understanding on its reason for existance? Are there
    different versions of it, et cetera?


    Thanks
    Christopher Lusardi

  6. Re: readelf utility concatenates underscores to fortran variables with underscores

    clusardi2k@aol.com (Christopher M. Lusardi) writes:
    >scott@slp53.sl.home (Scott Lurndal) wrote in message news:...
    >>
    >> For reasons such as the above, debuggers are generally specific to the
    >> compiler suite which generates the object code being debugged. C++
    >> name demangling is another area in which portability will no be
    >> assured. There may also be platform specific areas such as signal
    >> trampolining and c-runtime startup code (crt.0) which are not generally
    >> portable that the debugger will need to be aware of.
    >>
    >> You should be able to abstract out the non-portable features into a
    >> platform dependent layer of your debugger.
    >>
    >> scott

    >
    >How about a tutorial? Can you post simple examples to clarify your view about
    >crt.0?


    'tis not a shallow topic, unfortunately.

    When the ELF exec handler in the kernel receives control from the
    exec(2) system call, it will load the elements of the program into
    memory (text and data) and allocate space for the bss section. It
    will extract the program entry point from an ELF header. This entry
    point is generally a function called start, or _start which resides
    in the crt0.o object file. The responsibility of _start is to
    handle various startup tasks (platform and architecture dependent).
    On some platforms this may include invoking static constructors in
    C++ programs, for instance. crt0.o will eventually call the main()
    function to invoke the program.

    Note that there are other forms of initialization code utilizing the init and fini
    text sections in the ELF executable and any dynamic libraries. This code
    also gets executed (usually by the run-time dynamic linker). This is
    how libraries get code executed upon startup. It is quite complicated
    for a debugger to interact with the dynamic linker to ensure that such
    code can be debugged (it requires coordination between both the
    debugger and dynamic linker, generally).

    You can examine the crt0.o startup code and the dynamic linker by
    loading the source for glibc and poring through it.

    scott


+ Reply to Thread