[Bug ada/10670] gcc ignors 'pragma Machine_Attribute' directive
gnat-dev at buzco dot nyct dot net
gcc-bugzilla@gcc.gnu.org
Sat Nov 1 04:53:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10670
------- Additional Comments From gnat-dev at buzco dot nyct dot net 2003-11-01 04:53 -------
Subject: Re: gcc ignors 'pragma Machine_Attribute' directive
: r! uname -a
Linux buzco.nyct.net 2.2.16 #6 Sat Oct 26 10:26:53 EDT 2002 i586 unknown
: r! gcc --version
gcc (GCC) 3.3.2
On 03-10-28 11:57:49, berndtrog at yahoo dot com wrote:
| > Please, where in the LRM is a pragma Machine_Attribute() mentioned.
| It's an implementation defined pragma:
| http://gcc.gnu.org/onlinedocs/gnat_rm/Implementation-Defined-Pragmas.
| html#Implementation%20Defined%20Pragmas
OK, gotcha, should have thought of that before asking.
Except that that documentation +may+ have been correct for GNAT-3.x
based on gcc-2.8.1 but is wrong for GCC-3.x.
: This pragma is semantically equivalent to
: __attribute__((string_expression)) in GNU C, where string_expression
: is recognized by the GNU C macros VALID_MACHINE_TYPE_ATTRIBUTE and
: VALID_MACHINE_DECL_ATTRIBUTE which are defined in the configuration
: header file tm.h for each machine.
But the only place these macros are mentioned in current code are:
: /* Old target macros that have moved to the target hooks structure. */
: #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \
: [ ... ]
: VALID_MACHINE_DECL_ATTRIBUTE VALID_MACHINE_TYPE_ATTRIBUTE \
: [ ... ]
| > Please submit some sample test code that breaks.
| I've already submitted an example at the time when I opened this PR on
| 2003-05-07.
Yeah, new at this "bugzilla" thing and missed it.
| BTW, Geert Bosch wrote a comment on this issue in:
| http://gcc.gnu.org/ml/gcc/2003-05/msg00703.html
Yah, and he had a syntax error that didn't seem to be caught.
=== End quoted text ===
OK, bug verified as of this date w/ following stuff:
-- TITLE :
-- LANGUAGE : Ada
-- MODULE : Boot_A
-- COMPONENT OF : BuZco Software (Gazelle)
-- PARENT ORGANIZATION : BuzCo Systems
-- LATEST AUTHOR : Buz Cory
-- $RCSfile$
-- $Revision$
-- $Date$
-- --------------------------------------------------------------------
-- EXTERNAL MODULES USED
-- --------------------------------------------------------------------
-- PURPOSE :
-- --------------------------------------------------------------------
-- OVERVIEW:
-- --------------------------------------------------------------------
-- NOTICES, LICENSE follow; NOTES, HISTORY at end
-- ----------------------------------------
-- This software is part of the Gazelle suite of useful,
-- [ snip boilerplate :) ]
procedure
Boot_A ;
pragma Machine_Attribute
( Entity => Boot_A
, Attribute_Name => "section ("".bootloader"")"
) ;
-- TITLE :
-- LANGUAGE : Ada
-- MODULE : Boot_A
-- COMPONENT OF : BuZco Software (Gazelle)
-- PARENT ORGANIZATION : BuzCo Systems
-- LATEST AUTHOR : Buz Cory
-- $RCSfile$
-- $Revision$
-- $Date$
-- --------------------------------------------------------------------
-- EXTERNAL MODULES USED
with Gazelle ;
-- --------------------------------------------------------------------
-- PURPOSE :
-- --------------------------------------------------------------------
-- OVERVIEW:
-- --------------------------------------------------------------------
procedure Boot_A
is
body_RCSid : aliased constant Gazelle .RCS_String :=
"$Id$"
;
begin
null ;
end Boot_A ;
> : /usr/bin/gnatmake [ ... ] -c boot_a.adb
> : gcc -c [ ... ] boot_a.adb
> boot_a.ads:49: warning: `section (".bootloader")' attribute directive ignored
And similarly for :
pragma Linker_Section
( Entity => Boot_A_L
, Section => ".bootloader"
) ;
> : r! make boot_a_l.o
> /usr/bin/gnatmake [ ... ] -c boot_a_l.adb
> gcc -c [ ... ] boot_a_l.adb
> boot_a_l.adb:52:05: warning: constant "body_RCSid" is not referenced
> boot_a_l.ads:53:18: warning: section attributes are not supported for
> boot_a_l.ads:53:18: warning: this target
But :
> void boot(void) __attribute__ ((section (".bootloader"))) ;
> void boot(void)
> {
> int a ;
> a = a++ ;
> }
> : r! objdump -h boot_c.o
> Yields :
> boot_c.o: file format elf32-i386
> Sections:
> Idx Name Size VMA LMA File off Algn
> [ ... ]
> 3 .bootloader 00000013 00000000 00000000 00000034 2**0
> CONTENTS, ALLOC, LOAD, READONLY, CODE
and finally, the message for "attribute directive ignored" appears only
one place in the code, in gcc/attribs.c.
My best guess at the moment is that this is a +boundary+ (API) problem.
What the back end expects in 3.x is different from 2.8.x and the front
end failed to change w/ it.
I expect to follow this up more as soon as I get a visual debugger that
knows Ada working w/ the new object format.
It would please to be assigned to this bug.
--
Buz Cory of BuzCo Systems -- New York NY USA http://BuzCo.nyct.net
<gnat-dev@BuzCo.nyct.net> (Buz as GNAT Programmer)
write to <helpdesk@BuzCo.nyct.net> for FREE help with:
Installing/Configuring Linux
Getting started with the Ada Programming Language.
More information about the Gcc-bugs
mailing list