This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: Tom Rini <trini at kernel dot crashing dot org>
- To: Paul Mackerras <paulus at samba dot org>
- Cc: Momchil Velikov <velco at fadata dot bg>, linux-kernel at vger dot kernel dot org,gcc at gcc dot gnu dot org, linuxppc-dev at lists dot linuxppc dot org,Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>,Benjamin Herrenschmidt <benh at kernel dot crashing dot org>,Corey Minyard <minyard at acm dot org>
- Date: Wed, 2 Jan 2002 16:26:18 -0700
- Subject: Re: [PATCH] C undefined behavior fix
- References: <87g05py8qq.fsf@fadata.bg> <20020102190910.GG1803@cpe-24-221-152-185.az.sprintbbd.net> <15411.37817.753683.914033@argo.ozlabs.ibm.com>
On Thu, Jan 03, 2002 at 10:11:53AM +1100, Paul Mackerras wrote:
> Tom Rini writes:
>
> > Okay, here's a summary of all of the options we have:
> > 1) Change this particular strcpy to a memcpy
> > 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?)
> > 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)
> > 4) Introduce a function to do the calculations [2]. (Corey Minyard)
> > 5) 'Properly' set things up so that we don't need the RELOC() macros
> > (-mrelocatable or so?), and forget this mess altogether.
>
> I would add:
>
> 6) change strcpy to string_copy so gcc doesn't think it knows what the
> function does
> 7) code RELOC etc. in assembly, which would let us get rid of the
> offset = reloc_offset();
> at the beginning of each function which uses RELOC.
I think 7 sounds good for 2.4 at least, and maybe we can convince Franz
to look into 5 for 2.5 (since that would make things look a bit more
clean)..
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/