This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: change behavior of elfos.h slightly


On Thu, May 04, 2000 at 12:15:44PM +0200, Franz Sirl wrote:

 > >         ASM_OUTPUT_IDENT: undef before redefining, so as to override
 > >         any definition which may have snuck in.
 > 
 > Why? elfos.h only includes dbxelf.h and so doesn't need this #undef. In 
 > fact I use elfos.h and svr4.h headers on my local machine with nearly all 
 > #undef/#ifndef removed and I don't get any redefinition warnings at all 
 > (powerpc-linux-gnu).

Here is the path that leads to the "redefined" warning:

	<i386/netbsd-elf.h> includes <i386/gstabs.h> includes <i386/gas.h>,
	which defines ASM_OUTPUT_IDENT.

	<i386/netbsd-elf.h> includes <netbsd.h> includes <elfos.h>,
	which defines ASM_OUTPUT_IDENT.

Now, it turns out that the definitions are equivalent, except the <elfos.h>
one is more general, using the IDENT_ASM_OP macro instead of hardcoding
".ident" (which is what the macro in <i386/gas.h> does).

 > >         LOCAL_LABEL_PREFIX: cause an error if this is not defined,
 > >         as it is required for correct local labels to be generated.
 > >
 > >         ASM_OUTPUT_INTERNAL_LABEL: use LOCAL_LABEL_PREFIX rather
 > >         than assuming one of ".".
 > >
 > >         ASM_GENERATE_INTERNAL_LABEL: Likewise.
 > >
 > >The latter two are required in order to be able to use elfos.h on
 > >e.g. MIPS and Alpha targets (assuming you want those targets to
 > >continue to use the "$" as their local label prefix).
 > 
 > I think you are heading in the wrong direction here. Though it might be a 
 > good idea to convert elfos.h to provide a default definition of 
 > LOCAL_LABEL_PREFIX and use it, you will still need to override the 
 > definitions in your target headers, because you can't define anything 
 > before including elfos.h. We want to get rid of the
 > 
 > #define SOMETHING
 > #include <someheader1.h>
 > #undef SOMETHING2
 > #include <someheader2.h>
 > 
 > style in the mid-term and use the configure based generation of tm.h and 
 > tm_p.h. I'm not the definitive authority on this, but I don't think your 
 > NetBSD patches will be accepted without conversion to this scheme. Your 
 > headers should look like this:
 > 
 > #include <someheader1.h>
 > #include <someheader2.h>
 > /* override definition in someheader1.h.  */
 > #undef SOMETHING
 > #define SOMETHING
 > /* delete definition in someheader2.h.  */
 > #undef SOMETHING2

So, this is some of the needless duplication I am trying to avoid.  The
problem here is that ASM_OUTPUT_INTERNAL_LABEL is now going to be exactly
the same in <netbsd.h> and <elfos.h>, with the exception of the <netbsd.h>
version being generalized to work with any LOCAL_LABEL_PREFIX.

To me, this seems silly, leading to needless maintenance overhead.

Actually, it seems even worse than that... If you're saying "you can't
define anything before including elfos.h", then that means that an
ASM_OUTPUT_INTERNAL_LABEL will have to be defined in each CPU configuration
header, each differing only by the LOCAL_LABEL_PREFIX that they use.

 > I remember a similar discussion when the OpenBSD stuff was updated, so you 
 > might want to check the archives for that first.

I'll check the archives, but it seems as if the issues might be a little
different here, as I don't think OpenBSD has to deal with two different
object formats on the same platform (at least a couple of NetBSD platforms
are making the switch from a.out to ELF in the NetBSD 1.5 release).

In any case, I'll rework things a little more and try refine things a bit
more.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>

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