tech-toolchain archive

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

Re: Incorrect demangling



>>>> z.c:(.text+0x12): undefined reference to `foo(long double *,...)( *)'
>>> well if you investigated a bit more you might find that it is not
>>> the C compiler that is doing this.
>> (a) I didn't say anything about what was doing it.
> "This looks to me like a misfire of C++ demangling, but that doesn't
> really help all that much, especially since there's no C++ involved."

I'm not quite sure how that amounts to a claim that it's the C compiler
doing it, but if you want to take it that way, then sure.

> in case you did not investigate further as yet:
> [...]
> % gcc -Wl,--no-demangle -o foo foo.c

Okay, so there's a workaround, at least.

I still maintain it's a bug; (a) I shouldn't have to tell it whether
symbols deserve demangling and (b) even the workaround is rather crude,
and won't work at all when using both C and C++ in the same program.
(Not to mention that this makes me suspect it's possible to get an name
conflict between a C symbol and a (mangled) C++ symbol when it really
shouldn't be.)  I'd say the right fix is for mangling to generate
symbols C can't generate; my first impluse is to use . instead of __ to
separate the name from the encoded data types.  Better would be to
encode the "this is a mangled C++ name" somewhere other than the
symbol's name in the first place.

At any rate, it appears the bug isn't one I introduced, since you seem
to be seeing it too.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index