bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-binutils] Inconsistencies in symbol mapping output from 'ld'


From: Brad Mouring
Subject: Re: [bug-binutils] Inconsistencies in symbol mapping output from 'ld'
Date: Tue, 11 Jan 2011 09:06:07 -0600

Alan Modra <address@hidden> wrote on 01/10/2011 07:02:51 PM:

> From: Alan Modra <address@hidden>
> To: Brad Mouring <address@hidden>
> Cc: address@hidden
> Date: 01/10/2011 07:03 PM
> Subject: Re: [bug-binutils] Inconsistencies in symbol mapping outputfrom 
'ld'
> 
> On Mon, Jan 10, 2011 at 11:26:42AM -0600, Brad Mouring wrote:
> > Using a couple of different toolchains (the default x86 2.20.1 ld 
> > installed in Ubuntu and clones, a pre-built third-party ARM cross 
compile 
> > toolchain's 2.19.51) results in the same, inconsistent behavior 
regarding 
> > outputting symbol mapping information.
> > 
> > Basically, when I pass -M to ld, it behaves as I'd expect with regards 
to 
> > the --demangle and --no-demangle options.  However, when using the 
> > -Map=FILENAME option, it seems to ignore --(no-)demangle, always 
> > outputting mangled symbols into the file requested.
> > 
> > Is this expected behavior?  If so, is there a mechanism (short of 
> > redirecting stdout to a file) to get mangled symbol information into a 

> > file?
> 
> I can't see how this could happen, nor can I reproduce the problem
> with 2.20.1 or current mainline.  Furthermore, my x86 system ld does
> not exhibit this problem.
> 
> $ /usr/bin/ld --version
> GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303
> Copyright 2009 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms 
of
> the GNU General Public License version 3 or (at your option) a later 
version.
> This program has absolutely no warranty.
> 
> Is the --no-demangle option really making it to ld?
> 
> -- 
> Alan Modra
> Australia Development Lab, IBM

I likewise was bewildered, hence my message.

$ /usr/bin/ld --version
GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later 
version.
This program has absolutely no warranty.

$ cat test.cpp
#include<stdio.h>
#include<stdint.h>

__attribute__ ((visibility("default"))) int32_t perfectlyCromulent(int32_t 
foo, int32_t bar)
{
        return foo * bar;
}

int main()
{
        perfectlyCromulent(2,3);
        return 0;
}
$ g++ -o test -Wl,-M,--demangle test.cpp |grep Cromulent
                0x0000000008048494                perfectlyCromulent(int, 
int)
$ g++ -o test -Wl,-M,--no-demangle test.cpp |grep Cromulent
                0x0000000008048494                _Z18perfectlyCromulentii
$ rm -f test.map && g++ -o test -Wl,-Map=test.map,--no-demangle test.cpp 
&& grep Cromulent test.map
                0x0000000008048494                _Z18perfectlyCromulentii
$ rm -f test.map && g++ -o test -Wl,-Map=test.map,--demangle test.cpp && 
grep Cromulent test.map
                0x0000000008048494                _Z18perfectlyCromulentii

Granted, I did not directly call ld, but rather provided them to be 
passed.  If direct invocation is not reproducing the problem, it seems 
this may be a problem with gcc or my use of gcc

Brad Mouring



reply via email to

[Prev in Thread] Current Thread [Next in Thread]