List Info

Thread: removing init/fini_fallthru




removing init/fini_fallthru
user name
2006-06-20 03:37:53
On Jun 19, 2006, at 7:38 AM, Simon Burge wrote:

> MIPS with gcc4 is having some problems generating bad
code which we  
> sort
> of worked around but breaking gcc3 in the process. 
Nick Hudson and I
> have come up with the following which does away with
the init_fallthru
> and fini_fallthru functions and just puts _init and
_fini directly in
> the .init and .fini sections.  I've tested this with
gcc4 and Nick has
> tested this with gcc3 and c++ and threaded programs
work fine.

I don't see any problem with putting _init and _fini in
their  
correspondingly-named sections.  If you're going to do it
on one  
platform, we should do it on all.

That said, it would be nice to have a bug report filed on
the codegen  
problem.

>
> Further to this, is there any reason why we should use 

> init_fallthru and
> fini_fallthru on any architecture and not this method?
>
> Cheers,
> Simon.
>
> Index: lib/csu/common_elf/crti.c
>
============================================================
=======
> RCS file: /cvsroot/src/lib/csu/common_elf/crti.c,v
> retrieving revision 1.3
> diff -d -p -u -r1.3 crti.c
> --- lib/csu/common_elf/crti.c	19 May 2006 19:11:12
-0000	1.3
> +++ lib/csu/common_elf/crti.c	19 Jun 2006 14:29:15
-0000
>  -43,6 +43,7 
>  #include "sysident.h"
>  #include <dot_init.h>
>
> +#ifndef MD_DO_NOT_NEED_FALLTHRU
>  INIT_FALLTHRU_DECL;
>  FINI_FALLTHRU_DECL;
>
>  -62,6 +63,7  _fini(void)
>
>  	FINI_FALLTHRU();
>  }
> +#endif /* MD_DO_NOT_NEED_FALLTHRU */
>
>  MD_INIT_SECTION_PROLOGUE;
>  MD_FINI_SECTION_PROLOGUE;
> Index: lib/csu/mips/dot_init.h
>
============================================================
=======
> RCS file: /cvsroot/src/lib/csu/mips/dot_init.h,v
> retrieving revision 1.5
> diff -d -p -u -r1.5 dot_init.h
> --- lib/csu/mips/dot_init.h	12 Jun 2006 22:05:49
-0000	1.5
> +++ lib/csu/mips/dot_init.h	19 Jun 2006 14:29:15 -0000
>  -36,17 +36,6 
>
>  #include <sys/cdefs.h>			/* RCS ID &
Copyright macro defns */
>
> -/*
> - * These must be extern to avoid warnings
("declared static but  
> never defined")
> - * However, only the declaration is extern, the
actually __asm()  
> defines them
> - * as static.
> - */
> -#define	INIT_FALLTHRU_DECL void init_fallthru(void)
> -#define	FINI_FALLTHRU_DECL void fini_fallthru(void)
> -
> -#define	INIT_FALLTHRU()	init_fallthru()
> -#define	FINI_FALLTHRU()	fini_fallthru()
> -
>  #define	ra	"$31"
>
>  /*
>  -91,8 +80,10 
>  		"	.set	reorder			\n"\
>  		".previous")
>
> -#define	MD_INIT_SECTION_PROLOGUE
MD_SECTION_PROLOGUE(.init,  
> init_fallthru)
> -#define	MD_FINI_SECTION_PROLOGUE
MD_SECTION_PROLOGUE(.fini,  
> fini_fallthru)
> +#define	MD_INIT_SECTION_PROLOGUE
MD_SECTION_PROLOGUE(.init, _init)
> +#define	MD_FINI_SECTION_PROLOGUE
MD_SECTION_PROLOGUE(.fini, _fini)
>
>  #define	MD_INIT_SECTION_EPILOGUE
MD_SECTION_EPILOGUE(.init)
>  #define	MD_FINI_SECTION_EPILOGUE
MD_SECTION_EPILOGUE(.fini)
> +
> +#define	MD_DO_NOT_NEED_FALLTHRU

-- thorpej

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )