This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[RFA] "etext/_etext" may be missing, add configure check


Hello,

When building GDB hosted on LynxOS 3 (in my attempts to build the
gdbserver), I had a GDB link failure because of an undefined reference
to the "etext" symbol. It comes from maint.c for the code taking care
of profiling:

    #ifdef HAVE__ETEXT
    extern char _etext;
    #define TEXTEND &_etext
    #else
    extern char etext;
    #define TEXTEND &etext
    #endif

I couldn't find anywhere either of these symbol, and a search on
the internet didn't help either.

I propose to add a check in configure for "etext", and then
change the above to define TEXTEND only if at least either of
the etext symbol is defined. Then we can add the definition of 
TEXT to the conditionalization that decides whether or not to
include the profiling functionality.

On a side-note, I also think that --enable-profiling=no should
have deactivated this code as well, but that's a different thread.
For now, I think it's more useful to auto-detect than force to
find the appropriate option to set at configure time.

2007-09-19  Joel Brobecker  <brobecker@adacore.com>

        * configure.ac: Add check for "etext".
        * configure, config.in: Regenerate.
        * maint.c (TEXTEND): Only define if either _etext or etext
        are available.
        Disable the profiling functionality if TEXTEND is not defined.

This was tested on x86-linux, without any regressions. On LynxOS, it
allows me to complete the GDB build (although it's a dummy GDB at this
point, since my primary interest is in the gdbserver).

Would that be OK to commit?

-- 
Joel

Attachment: etext.diff
Description: Text document


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