Patchwork libpayload: add defines to lpgcc

login
register
about
Submitter Patrick Georgi
Date 2010-06-22 15:16:52
Message ID <4C20D3E4.7080606@georgi-clan.de>
Download mbox | patch
Permalink /patch/1540/
State Accepted
Headers show

Comments

Patrick Georgi - 2010-06-22 15:16:52
Hi,

attached patch tells lpgcc to add two defines to the compiler it
invokes: __LIBPAYLOAD__ and an architecture specific one (__i386__ or
__powerpc__)


Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Peter Stuge - 2010-06-22 23:05:48
Patrick Georgi wrote:
> attached patch tells lpgcc to add two defines to the compiler it
> invokes: __LIBPAYLOAD__ and an architecture specific one (__i386__ or
> __powerpc__)
> 
> 
> Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>

Acked-by: Peter Stuge <peter@stuge.se>
Stefan Reinauer - 2010-06-23 12:46:12
On 6/22/10 5:16 PM, Patrick Georgi wrote:
> Hi,
>
> attached patch tells lpgcc to add two defines to the compiler it
> invokes: __LIBPAYLOAD__ and an architecture specific one (__i386__ or
> __powerpc__)
>
>
> Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
>   
Isn't __i386__ or __powerpc__ already set by the compiler?

Anyways,

Acked-by: Stefan Reinauer <stepan@coresystems.de>
ron minnich - 2010-06-23 12:52:49
On Wed, Jun 23, 2010 at 5:46 AM, Stefan Reinauer <stepan@coresystems.de> wrote:
> On 6/22/10 5:16 PM, Patrick Georgi wrote:
>
> Hi,
>
> attached patch tells lpgcc to add two defines to the compiler it
> invokes: __LIBPAYLOAD__ and an architecture specific one (__i386__ or
> __powerpc__)


Yes it is. Or something is. You should use what the compiler sets IMHO.

ron
Carl-Daniel Hailfinger - 2010-06-24 14:26:20
On 23.06.2010 14:52, ron minnich wrote:
> On Wed, Jun 23, 2010 at 5:46 AM, Stefan Reinauer <stepan@coresystems.de> wrote:
>   
>> On 6/22/10 5:16 PM, Patrick Georgi wrote:
>>
>>> attached patch tells lpgcc to add two defines to the compiler it
>>> invokes: __LIBPAYLOAD__ and an architecture specific one (__i386__ or
>>> __powerpc__)
>>
>> Isn't __i386__ or __powerpc__ already set by the compiler?
>>     
> Yes it is. Or something is. You should use what the compiler sets IMHO.
>   

I just checked and my gcc 4.2.1 always knows the following #defines on
i386, even if you specify -nostdlib -nostdinc.
#define __i386 1
#define __i386__ 1
#define i386 1

Patrick, which gcc version needs the additional __i386__ #define?

Regards,
Carl-Daniel
Patrick Georgi - 2010-06-24 14:31:55
Am 24.06.2010 16:26, schrieb Carl-Daniel Hailfinger:
> Patrick, which gcc version needs the additional __i386__ #define?
Hmm.. Tried it, none.. No idea why that didn't work last time.

Shall I revert it?


Patrick
Carl-Daniel Hailfinger - 2010-06-24 14:39:22
On 24.06.2010 16:31, Patrick Georgi wrote:
> Am 24.06.2010 16:26, schrieb Carl-Daniel Hailfinger:
>   
>> Patrick, which gcc version needs the additional __i386__ #define?
>>     
> Hmm.. Tried it, none.. No idea why that didn't work last time.
>
> Shall I revert it?
>   

I think the rest of your patch is OK, so I'm against a complete revert.
If you revert only the __i386__ hunk, you have my
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Thanks.

Regards,
Carl-Daniel

Patch

Index: bin/lpgcc

===================================================================
--- bin/lpgcc	(Revision 5638)

+++ bin/lpgcc	(Arbeitskopie)

@@ -103,14 +103,16 @@ 

 if [ "$CONFIG_TARGET_I386" = "y" ]; then
   _ARCHINCDIR=$_INCDIR/i386
   _ARCHLIBDIR=$_LIBDIR/i386
+  _TARGETCFLAGS="-D__i386__=1"
 fi
 
 if [ "$CONFIG_TARGET_POWERPC" = "y" ]; then
   _ARCHINCDIR=$_INCDIR/powerpc
   _ARCHLIBDIR=$_LIBDIR/powerpc
+  _TARGETCFLAGS="-D__powerpc__=1"
 fi
 
-_CFLAGS="-m32 -nostdinc -nostdlib -I$_INCDIR -I$_ARCHINCDIR"
+_CFLAGS="-m32 -nostdinc -nostdlib -I$_INCDIR -I$_ARCHINCDIR -D__LIBPAYLOAD__=1 $_TARGETCFLAGS"
 
 # Check for the -fno-stack-protector silliness