This is the mail archive of the mailing list for the GCC 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]

Re: C++ name mangling for local entities

we should add a feature to the assembler like:

.asm_alias x = y

that says references to "x" are emitted as references to a new "y", distinct from all other "y" references.

On Darwin, all the DWARF information in .o files is matched by name¹ with symbols in the executable, so this won't work.

In that case, on Darwin, the assembler could leave the name "x" as "x", so that all the names in the object file were unique. Since this is only for local symbols, there's no ABI impact, as you mentioned. Then, we'd have better behavior on ELF platforms and would not have to make any change to the C++ ABI. You could use your suggested encoding in GCC as "x", but it would only show up in object files on systems that don't support multiple local symbols with the same name.

Now, with my C++ ABI hat on

That's true, but is there a reason not to use the discriminator encoding?

You mean

<local-source-name> ::= Z <source-name> <discriminator>


Yes, that's what I meant. I think that would be best, partly because it avoids having to reserve "L", but:

<local-source-name> ::= L <source-name> <discriminator>

will work and is more consistent, so consider the proposal amended to have that.

also seems OK, assuming that we need to do this at all.

Mark Mitchell
(650) 331-3385 x713

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