Skip to contentSkip to conversation

gcc3 compatibility and debugger support

PATCH Kaoru Fukui 3 participants 3 messages Sep 7, 2001 – Sep 24, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Great Franz!

I could rebuild working kernel(2.4 devel) with gcc-3.0.2 pre

Thanks
Kaoru

From: Franz Sirl <[email protected]>
To: [email protected], [email protected]
Subject: [PATCH] gcc3 compatibility and debugger support
Date: Thu, 6 Sep 2001 21:32:59 +0200

Quoted 11 lines

Hi,

this patch fixes up the RELOC macro (which relies on implentation defined things in C), so it's possible again to boot a gcc3 compiled kernel. The patch guards the problematic code with a NOP inline asm, preventing the problematic (but legal) gcc3 optimization.
The second part makes sure that the current task ends up in a known memory location even for UP. This helps JTAG/BDM debuggers a lot (it's very expensive to stop CPU/peek CPU reg/restart CPU).

The patch is against 2_4. In 2_4_devel the gcc3 workaround in prom.c can

be

Quoted 3 lines

removed too.

Franz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 8 lines · Paul Mackerras

Review

Quoted 4 lines · Franz Sirl
(quoted diff) +2 -0
 	current_set[smp_processor_id()] = new;
+#else
+	current_set[0] = new;
 #endif /* CONFIG_SMP */

Yuck. Just put the #endif before the line that sets current_set[]. smp_processor_id() is 0 on UP.

OK, here is the updated patch.

Franz.

===== arch/ppc/kernel/process.c 1.29 vs edited =====

arch/ppc/kernel/process.c +3 -1
@@ -226,8 +226,10 @@
 	if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)))
 		giveup_altivec(prev);
 #endif /* CONFIG_ALTIVEC */
-	current_set[smp_processor_id()] = new;
 #endif /* CONFIG_SMP */
+
+	current_set[smp_processor_id()] = new;
+
 	/* Avoid the trap.  On smp this this never happens since
 	 * we don't set last_task_used_altivec -- Cort
 	 */

===== include/asm-ppc/prom.h 1.20 vs edited =====

include/asm-ppc/prom.h +1 -1
@@ -106,7 +106,7 @@
 
 #define PTRRELOC(x)	((typeof(x))((unsigned long)(x) + offset))
 #define PTRUNRELOC(x)	((typeof(x))((unsigned long)(x) - offset))
-#define RELOC(x)	(*PTRRELOC(&(x)))
+#define RELOC(x)	(*({ typeof(x) * __ptr  = PTRRELOC(&(x)); __asm__ ("" : "=r" (__ptr) : "0" (__ptr)); __ptr;}))
 
 #endif /* _PPC_PROM_H */
 #endif /* __KERNEL__ */