This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Where do number suffixes in symbol names come from?
- From: Goswin von Brederlow <goswin-v-b at web dot de>
- To: john smith <wempwer at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 30 Jun 2016 12:33:51 +0200
- Subject: Re: Where do number suffixes in symbol names come from?
- Authentication-results: sourceware.org; auth=none
- References: <CAKmQUfbLbNE5czEENat2xc8WuB6xmeoGChmo3JQ=1-Ee+n3Mbg at mail dot gmail dot com>
On Thu, Jun 30, 2016 at 11:55:27AM +0200, john smith wrote:
> All static symbol have a short number attached to its name, for example:
>
> static const int def[9999999] = {1};
>
> shows up as:
>
> 0000000000400920 r def.2802
>
> What does this number represent? I know I can change it using
> __asm__("def").
>
> I read this https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40831 and
> this https://patchwork.ozlabs.org/patch/118607/ but I couldn't find a
> definitive explanations of what these numbers mean.
I'm guessing that is just a unique number generated to avoid name
colisions in the binary. Think about this:
Say you have two compilation units (files) and both have:
static const int def[9999999] = {1};
Since the variable is static you actually do have 2 separate variables
called "def" and that is perfectly alright. But you can not have two
symbols called "def" in the binary. The extra ".xxxx" keeps them
distinct.
MfG
Goswin