lkml.org 
[lkml]   [2004]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [TRIVIAL PATCH] /init/version.c
Gotcha. Thanks.

I'll redo it correctly a bit later, with
const char msg[]; and extern char msg[];
instead of
const char * msg; and extern char * msg;

-Vadim Lobanov

On Wed, 3 Nov 2004, Denis Vlasenko wrote:

> On Wednesday 03 November 2004 18:34, vlobanov wrote:
> > It seems to compile just fine. Here are the relevant snippets:
> >
> > UPD include/asm-i386/asm_offsets.h
> > CC init/main.o
> > CHK include/linux/compile.h
> > UPD include/linux/compile.h
> > CC init/version.o
> > CC init/do_mounts.o
> >
> > ...and...
> >
> > CC fs/proc/proc_tty.o
> > CC fs/proc/proc_misc.o
> > CC fs/proc/kcore.o
> >
> > Why did you believe it would not compile? (Just so I can be extra
> > careful about this kind of code in the future.)
>
> I was wrong. It compiles but won't work right:
>
> a.c:
> char msg[] = "boo";
>
> b.c:
> #include <stdio.h>
> extern char *msg;
> int main() {
> puts(msg);
> return 0;
> }
>
> # gcc b.c a.c
> # ./a.out
> Segmentation fault
>
> --
> vda
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.036 / U:21.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site