Bug 14537 - sparc-rtems predefines unix
Summary: sparc-rtems predefines unix
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-11 19:42 UTC by Joel Sherrill
Modified: 2005-10-22 08:34 UTC (History)
6 users (show)

See Also:
Host:
Target: sparc-rtems
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-04-07 02:57:19


Attachments
patch to rewrite config/sparc/rtemself.h (3.04 KB, patch)
2004-03-11 19:47 UTC, Joel Sherrill
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Sherrill 2004-03-11 19:42:52 UTC
sparc-rtems is built using Solaris specific config/sparc/* files and 
as a result ends up with unix predefined.  

NOTE: sparc-elf may also suffer from this but this was not investigated.
Comment 1 Joel Sherrill 2004-03-11 19:47:04 UTC
Created attachment 5902 [details]
patch to rewrite config/sparc/rtemself.h

Please review so I can commit this before 3.4.0.
Comment 2 Joel Sherrill 2004-03-11 20:24:11 UTC
Based upon a review of config.gcc, I believe sparc-elf, sparc64-elf and 
sparclite-elf have the same problem since they include the solaris specific
config/sparc files.

The embedded sparc targets could probably be modified in a similar way and
longer term all share some common underlying file(s).

This has been a lurking issue but not a critical one.  We added a stub for
mprotect() to RTEMS a long time ago to workaround this the first time.  
But now the gnat run-time checks for defined(unix) and decides 
it is on a unix box instead of an embedded sparc.  This results
in real breakage.

Given the complexity of the conditionals in some of the Ada run-time code, I
wouldn't be surprised if they have discovered other cpp predefine 
inconsistencies and are covering them up.  Look at gcc/ada/init.c and
gcc/ada/sysdep.c have some pretty complicated conditionals.  I have to
wonder if some vxworks target doesn't have this problem based upon this
code from ctrl_c.c:

#if (defined (_AIX) || defined (unix)) && !defined (__vxworks)

which I read as meaning there is some VxWorks target with unix defined.

Comment 3 Mark Mitchell 2004-03-11 21:35:59 UTC
This is OK for 3.4.0.
Comment 4 Andrew Pinski 2004-04-07 02:57:15 UTC
This patch was okayed for 3.4.0 but never applied, Mark I know you do not want any 
patch which can cause many problems at this point as we are about to release but is this 
still okay to apply for 3.4.0? Joel if Mark says it is okay, then please apply right away as 
the release is near.
Comment 5 Joel Sherrill 2004-04-07 12:56:08 UTC
Subject: Re:  sparc-rtems predefines unix

pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-07 02:57 -------
> This patch was okayed for 3.4.0 but never applied, Mark I know you do not want any 
> patch which can cause many problems at this point as we are about to release but is this 
> still okay to apply for 3.4.0? Joel if Mark says it is okay, then please apply right away as 
> the release is near.
> 
I have not committed this because I do not have a working
3.4.x sparc-rtems toolset.  I got side-tracked with
the cross gnatmake and generic *-rtems run-time issues.
So this patch is off the table for 3.4.0.


Comment 6 Mark Mitchell 2004-05-28 22:15:34 UTC
Joel --

I'm removing the target milestone for this PR since this doesn't look to me like
it's a regression.  Still, if you get this working, you can apply the patch for
3.4.1.

-- Mark
Comment 7 Eric Botcazou 2005-10-22 08:34:36 UTC
2005-01-24  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR bootstrap/19364
	* config.gcc (sparc-*-elf*): Remove sol2.h, sparc/sol2.h and
	sparc/elf.h, add sparc/sp-elf.h.
	(sparc-*-rtems*): Likewise.
	(sparclite-*-elf*): Remove sol2.h, sparc/sol2.h, sparc/elf.h and
	tm-dwarf2.h, add sparc/sp-elf.h.
	(sparc86x-*-elf): Likewise.
	(sparc64-*-elf*): Remove sol2.h, sparc/sol2.h and tm-dwarf2.h.
	* config/sparc/liteelf.h (TARGET_SUB_OS_CPP_BUILTINS): Rename into
	TARGET_OS_CPP_BUILTINS.
	* config/sparc/sp86x-elf (TARGET_SUB_OS_CPP_BUILTINS): Likewise.
	* config/sparc/rtemself.h (TARGET_SUB_OS_CPP_BUILTINS): Likewise.
	Undefine it.
	* config/sparc/openbsd64.h (NO_IMPLICIT_EXTERN_C): Undefine.
	* config/sparc/sp64-elf.h (NO_IMPLICIT_EXTERN_C): New macro.
	(SWITCH_TAKES_ARG): Likewise.
	(LOCAL_LABEL_PREFIX): Likewise.
	(ASM_GENERATE_INTERNAL_LABEL): Likewise.
	(TARGET_N_FORMAT_TYPES): Delete.
	(TARGET_FORMAT_TYPES): Likewise.
	(ASM_DECLARE_FUNCTION_SIZE): Likewise.
	* config/sparc/elf.h: Delete.
	* config/sparc/sp-elf.h: New file.