Re: m68k: Simple loop compiles into boundless recursion with -O2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Wed, Jan 13, 2021 at 05:30:35PM +0100, Fredrik Noring wrote:
> Many thanks, Alexander,
> 
> > Please invoke objdump with -dr instead to see the relocations.
> 
> Indeed:
> 
>   1a:	4eb9 0000 0000 	jsr 0 <memset2>
> 			1c: R_68K_32	memset

Yup, always always always use -dr :-)

> > The relocation associated with this instruction should point to memset.
> > Most likely the compiler is optimizing your memset2 function to call
> > the standard function 'memset'.
> > 
> > When implementing memset itself you need to pass -ffreestanding to GCC,
> > which will disable this optimization.
> 
> Yes, I had -nostdlib but -ffreestanding is apparently needed as well. Thanks
> again.

You probably want -ffreestanding anyway for your situation: -nostdlib
does not mean "there is no standard library", it just means "do not link
with it".

For the archives, no one has said it yet: to just disable the
optimisation transforming the loop into a memset, you can use
-fno-tree-loop-distribute-patterns .


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux