Subject: RE: [Patch] make 2.4 compile with GCC-3.4.3...

From: "David Daney" <[email-masked]>
Date: Thu, 2 Dec 2004 22:20:35 -0800

Thiemo Seufer wrote:
>David Daney wrote:
>[snip]
>> *** kernel/Makefile   2 Dec 2004 19:50:05 -0000       1.2
>> --- kernel/Makefile   3 Dec 2004 03:00:44 -0000
>> *************** obj-y         += branch.o cpu-probe.o irq.o pro
>> *** 18,23 ****
>> --- 18,27 ----
>>                  traps.o ptrace.o reset.o semaphore.o setup.o syscall.o \
>>                  sysmips.o ipc.o scall_o32.o time.o unaligned.o
>>  
>> + check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
>> +
>> + syscall.o signal.o : override CFLAGS += $(call check_gcc, -fno-unit-at-a-time,)
>
>What difference does this cause?

It causes -fno-unit-at-a-time to be added to CFLAGS when compiling
syscall.c and signal.c.  All other files are compiled with the "normal" CFLAGS.
 
-fno-unit-at-a-time prevents GCC from rearranging things in its output thus preventing
the save_static_function() from being separated from its companion.  As far as I could tell
only syscall.c and signal.c need this.
 
One small issue is that these two files now seem to get recompiled with each
make invocation.  But that is better than being miscompiled.
 
I am not sure if check_gcc is inherited from the higher level makefile so I put it in this one
as well.  If you think it is a good approach I will try to simplify the patch a little.

>[snip]
>> --- 77,84 ----
>>    * Atomically swap in the new signal mask, and wait for a signal.
>>    */
>>   save_static_function(sys_sigsuspend);
>> ! __attribute_used__ static int
>> ! _sys_sigsuspend(struct pt_regs regs)
>
>These should also use "noinline", like 2.6.

noinline was not defined for me :( so I removed it.  It seems that in 2.6 it is
just #defined to be nothing.  The alternative is to add:
 
#ifndef noinline
#define noinline
#endif
 
to compiler.h as is done in 2.6
 
David Daney.

---

From: Thiemo Seufer <[email-masked]>
Date: Fri, 3 Dec 2004 07:40:17 +0100

David Daney wrote:
[snip]
> only syscall.c and signal.c need this.

Ah, I missed that. It's probably better to use the same way as in 2.6,
that is, to add a jump at the end of save_static_function().

> to compiler.h as is done in 2.6

Yes, that's the better idea. gcc-4.0 ff may need it.

Thiemo

---

From: "Maciej W. Rozycki" <[email-masked]>
Date: Fri, 3 Dec 2004 13:50:49 +0000 (GMT)

> that is, to add a jump at the end of save_static_function().

 Note, that I've send a patch for this twice already.  Still no approval, 
though, for whatever (unstated) reason.

> Yes, that's the better idea. gcc-4.0 ff may need it.

 I'll update the patch accordingly and resend.

  Maciej