This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the EGCS project.
Problem with cpplib: linux kernel won't compile with modules
- To: gcc-patches@gcc.gnu.org
- Subject: Problem with cpplib: linux kernel won't compile with modules
- From: Bernd Schmidt <bernds@cygnus.co.uk>
- Date: Wed, 4 Aug 1999 15:06:56 +0100 (BST)
- cc: zack@rabi.columbia.edu
Here's a small test case that demonstrates a failure when trying to build
the linux kernel with modules enabled (on i686-linux) using a cpplib-based
compiler.
-------------------
#define _set_ver(sym) sym
#define __ver_dequeue_signal smp_f98575e2
#define dequeue_signal _set_ver(dequeue_signal)
#define __EXPORT_SYMBOL(sym, str) \
const char __kstrtab_##sym[] \
__attribute__((section(".kstrtab"))) = str; \
const struct module_symbol __ksymtab_##sym \
__attribute__((section("__ksymtab"))) = \
{ (unsigned long)&sym, __kstrtab_##sym }
#define EXPORT_SYMBOL(var) __EXPORT_SYMBOL(var, "foo")
EXPORT_SYMBOL(dequeue_signal);
-------------------
The result after preprocessing (cut down to the interesting part):
const char __kstrtab_ dequeue_signal[]
__attribute__((section(".kstrtab"))) = "foo";
Note the extra whitespace after "__kstrtab_".
I'm fairly clueless when it comes to cpplib. The patch below appears to
fix the problem for me, but it was done without really understanding what
the code is trying to do. gdb showed that the string pointed to by p1
was "\r \r-dequeue_signal" at the point where things appeared to go wrong.
Can someone who understands cpplib please have a look?
Bernd
* cpphash.c (macroexpand): When concatenating tokens, delete all
preceding escape sequences.
Index: cpphash.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cpphash.c,v
retrieving revision 1.22
diff -u -p -r1.22 cpphash.c
--- cpphash.c 1999/06/07 10:35:24 1.22
+++ cpphash.c 1999/08/04 13:59:12
@@ -1366,7 +1366,7 @@ macroexpand (pfile, hp)
/* Delete any no-reexpansion marker that precedes
an identifier at the beginning of the argument. */
- if (p1[0] == '\r' && p1[1] == '-')
+ while (p1[0] == '\r' && (p1[1] == '-' || p1[1] == ' '))
p1 += 2;
bcopy (p1, xbuf + totlen, l1 - p1);