This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR: 19885 [4.0/4.1 Regression] avr dwarf-2 support is broken for head 4.0/4.1
- From: Björn Haase <bjoern dot m dot haase at web dot de>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 May 2005 18:31:03 +0200
- Subject: Re: [PATCH] PR: 19885 [4.0/4.1 Regression] avr dwarf-2 support is broken for head 4.0/4.1
- References: <20050210232514.19885.bjoern.m.haase@web.de> <200505172357.06766.bjoern.m.haase@web.de> <20050517232414.GA1950@redhat.com>
Hello Richard,
I agree with you. Indeed, if the struct "targetm.asm_out.unaligned_op"
were filled with correct data, the bug would be fixed as well.
The origin of this bug could also be removed by making sure that the
targetm.asm_out structs are filled with correct values. This is
presently not the case since any definition of TARGET_ASM_UNALIGNED_HI_OP by
the target specific header files is overwritten by target-def.h.
I at the end of this mail I'm about to suggest two new alternative solutions
for resolving PR19885:
A) add one single line "#define OBJECT_FORMAT_ELF" to config/avr.h
B) implement a major re-organization of the macros in target-def.h
Detailed description:
The "targetm.asm_out_unaligned_op" struct is initialized by the value that
the MACRO
(target-def.h, lines 196ff)
#define TARGET_ASM_UNALIGNED_INT_OP \
{TARGET_ASM_UNALIGNED_HI_OP, \
TARGET_ASM_UNALIGNED_SI_OP, \
TARGET_ASM_UNALIGNED_DI_OP, \
TARGET_ASM_UNALIGNED_TI_OP}
expands to.
When looking after the contents of the struct in the debugger, I am observing
that the unaligned_op struct, contains only NULL pointers, despite avr.h's
definitions for TARGET_UNALIGNED_HI_OP and TARGET_UNALIGNED_SI_OP.
Reason is that any definition of these macros by the target specific header
is ignored completely due to
(target-def.h, lines 42ff)
/* GAS and SYSV4 assemblers accept these. */
#if defined (OBJECT_FORMAT_ELF)
#define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t"
#define TARGET_ASM_UNALIGNED_SI_OP "\t.4byte\t"
#define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t"
#define TARGET_ASM_UNALIGNED_TI_OP NULL
#else
#define TARGET_ASM_UNALIGNED_HI_OP NULL
#define TARGET_ASM_UNALIGNED_SI_OP NULL
#define TARGET_ASM_UNALIGNED_DI_OP NULL
#define TARGET_ASM_UNALIGNED_TI_OP NULL
#endif /* OBJECT_FORMAT_ELF */
. I don't know whether this is done by purpose. In case that it is assumed
that the target specific header files may define TARGET_ASM_UNALIGNED_HI_OP
and
friends, one would have to change target-def.h .
I have the impression that this indeed is a bug in target-def.h because I
would not expect that there is no object format allowing for unaligned
HI and SI mode constants except for ELF.
I'd appreciate comments on which solution is the better one. Personally,
obviously, I'd prefer A) since the patch is much shorter and AVR indeed
is using *only* elf, to my best knowledge.
Thank's again for your feedback,
Björn