lkml.org 
[lkml]   [2002]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] C undefined behavior fix
From
Date
Tom Rini <trini@kernel.crashing.org> writes:

> 1) Change this particular strcpy to a memcpy

That doesn't fix the undefined behavior.

> 2) Add -ffreestanding to the CFLAGS of arch/ppc/kernel/prom.o (If this
> optimization comes back on with this flag later on, it would be a
> compiler bug, yes?)

That doesn't fix the undefined behavior.

> 3) Modify the RELOC() marco in such a way that GCC won't attempt to
> optimize anything which touches it [1]. (Franz, again by Jakub)

That *does* fix the undefined behavior, and it seems that GCC is going
to stay the same in the future, so this is a feasible workaround.

> 4) Introduce a function to do the calculations [2]. (Corey Minyard)

That doesn't fix the undefined behavior.

> 5) 'Properly' set things up so that we don't need the RELOC() macros
> (-mrelocatable or so?), and forget this mess altogether.

This is the clean approach, and thus preferable in the long term. (3)
seems to be the best short-time solution.
-
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 13:18    [W:0.278 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site