public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>
To: Al_Niessner@bigfoot.com
Cc: gcc-help@gcc.gnu.org
Subject: Re: gcc symbol names
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <200003010907.KAA00727@loewis.home.cs.tu-berlin.de> (raw)
Message-ID: <20000401000000.gvrC3vZqH2qWLhbX6sHqwhAndsSXO3jCxxs_sykOy5w@z> (raw)
In-Reply-To: <38BC9759.EC41E8AE@bigfoot.com>

> So, how do I make the symbols 'T' instead of 't'?

For the _GLOBAL_ symbols, the compiler decides whether to make them
static or not in gcc/cp/decl2.c:

#if defined(ASM_OUTPUT_CONSTRUCTOR) && defined(ASM_OUTPUT_DESTRUCTOR)
  /* It can be a static function as long as collect2 does not have
     to scan the object file to find its ctor/dtor routine.  */
  TREE_PUBLIC (current_function_decl) = 0;
#endif

Since they apparently got static, I conclude that
ASM_OUTPUT_CONSTRUCTOR is defined for your platform. It would be
really good if you had provided assembler output for a simple example
like

struct A{A();};
A a;

which would show what exactly the generated assembler code look
like. You can ask gcc to generate assembler code with the -S option.

On my platform (i586-pc-linux-gnu) it generates a fragment 

_GLOBAL_.I.a:
  ... here is the initialization of a
.section        .ctors,"aw"
  .long    _GLOBAL_.I.a

The section statement is the result of my target defining
ASM_OUTPUT_CONSTRUCTOR. On Linux, all constructor functions go into a
section .ctors. All those sections are combined by the linker to a
single section, which is at run-time processed from crtbegin.o, as
part of the .init processing. .init is an ELF section which is
automatically executed by the operating system before executing the
program entry.

> I compiled the code using the Solaris platform (g++ 2.7.2) targetted for
> VxWorks and everything works fine. I then reran "munch" which goes
> through the libx.a file and extracts the globals and puts them in a C
> accessable ctor/dtor file for compiling with a c compiler -- I am told
> this is a need of VxWorks.

Are you sure you really *need* to run "munch"? This is a historical
alternative for executing constructors, and it indeed needs the
symbols exported. Of course, if you have a real constructor section,
then the system could (and should) collect the ctors from the .ctors
section, not because their names start with _GLOBAL_.

If your target really does not support a true ctors section, then it
appears that it was incorrect to define ASM_OUTPUT_CONSTRUCTOR for
it. You need to locate the place where this is defined, and correct it
accordingly.

If you cannot find that place, you can also remove the line from
cp/decl.c as a work-around.

Regards,
Martin

  reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-29 20:05 Al Niessner
2000-03-01  1:18 ` Martin v. Loewis [this message]
2000-03-01 19:26   ` Al Niessner
2000-03-02  1:18     ` Martin v. Loewis
2000-04-01  0:00       ` Martin v. Loewis
2000-04-01  0:00     ` Al Niessner
2000-04-01  0:00   ` Martin v. Loewis
2000-04-01  0:00 ` Al Niessner
  -- strict thread matches above, loose matches on Subject: below --
2000-02-26 20:29 Al Niessner
2000-02-27 11:21 ` Martin v. Loewis
2000-02-27 12:17   ` Al Niessner
2000-02-27 12:58     ` Martin v. Loewis
2000-02-27 18:51       ` Al Niessner
2000-02-28  1:32         ` Martin v. Loewis
2000-04-01  0:00           ` Martin v. Loewis
2000-04-01  0:00         ` Al Niessner
2000-04-01  0:00       ` Martin v. Loewis
2000-04-01  0:00     ` Al Niessner
2000-04-01  0:00   ` Martin v. Loewis
2000-04-01  0:00 ` Al Niessner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200003010907.KAA00727@loewis.home.cs.tu-berlin.de \
    --to=martin@loewis.home.cs.tu-berlin.de \
    --cc=Al_Niessner@bigfoot.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).