From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ronald F. Guilmette" To: dj@delorie.com (DJ Delorie) Cc: gcc2@cygnus.com, gas2@cygnus.com Subject: Re: Lxx vs .Lxxx - gcc vs gas Date: Sat, 17 Jun 1995 17:00:00 -0000 Message-id: <26871.803433382@segfault> References: <199506172158.RAA25682@delorie.com> X-SW-Source: 1995/msg00107.html In message < 199506172158.RAA25682@delorie.com >, you wrote: > >[Be careful when replying; this was sent to two mailing lists - DJ] > >There are two types of "local" labels used by gcc and gas: > >(1) Lfoo: >(2) .Lfoo: > >gcc chooses which to use based on whether the target prepends an >underscore to external symbols or not. I'm not sure if that is a proper way to make the distinction, but it might be. Then again, it might not. What I _can_ tell you is that the convention on ELF-based systems is _not_ to put an underscore before a user-declared identifier (when converting it from the C level to the assembly level). This differs from the older UNIX tradition of putting one underscore in front of each user-declared name (at the assembly level). I believe that for most COFF-based systems, the convention was to prepend a leading underscore to the names of all entities which were declared by the user at the C-language level. (But I might be wrong about that. It has been a LONG time since I used COFF.) Separately, there is the question of what prefix will force the assembler NOT to write a given label into the symbol table of the object file. In the case of all ELF assemblers that I am familiar with, a leading period will cause the relevant label NOT to appear in the symbol table of the resulting object file... but these conventions are highly assembler- dependent, and I don't knon that there is any hard-and-fast rule by which you could predict (for any given assembler) what the ``hiding prefix'' is. You just have to try some experiments and see. >gas chooses which to use based on whether the output object format is >COFF or not (for the i386, at least). I think that's probably wrong. If you had said that GAS uses leading periods as the ``hiding prefix'' for _both_ COFF and ELF, then I might believe that gas was doing the Right Thing. Even then however, I think that the wisest thing to do (in _both_ gas and gcc) would be to establish an entirely separate and independent target macro to control/determine the ``hiding prefix''. >DJGPP is coff with underscores, and the two don't agree on which is >right, so I end up with all the local labels in the object's symbol >table. > >Which should I fix? Is there a global solution, or will I need a >special case for djgpp? See above. I think that _somebody_ should fix both gas and gcc so that the assembly-level ``hiding prefix'' can be specified independently from everything else. I really don't think that there is 100% correlation between the object file format and the hiding prefix. Any correlations which seem to relate one to the other are, I believe, simply the product of luck rather than the product of universal rules or universally obeyed conventions. -- Ron Guilmette, Sunnyvale, CA -------- RG Consulting --------------------- ---- E-mail: rfg@segfault.us.com --------Purveyors of Compiler Test Suites - ---- finger: rfg@rahul.net -------------------------------------------------