PATCH: cygwin/mingw32 PE Define useful TLS and compatibility symbols.

Aaron W. LaFramboise aaron98wiridge9@aaronwl.com
Sun Jun 6 09:33:00 GMT 2004


Hi,

This small patch adds some useful symbols for TLS support and MSVC 
compatibility.

___crt_xl_start__ is necessary for TLS callback support, something I'm 
hoping to do nice things with in the near future.

The other similarly named symbols make compatibility with MSVC-generated 
code a little easier to accomplish (in particular, ctors and dtors).

___tls_start__ and ___tls_end___ simplify the TLS support code.


2004-06-06  Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>

	* ld/scripttemp/pe.sc (.CRT): Define ___crt_xc_start__,
	___crt_xc_end__, ___crt_xi_start__, ___crt_xi_end__,
	___crt_xl_start__, ___crt_xp_start__, ___crt_xp_end__,
	___crt_xt_start__ and ___crt_xt_end__.
	(.tls): Define ___tls_start__ and ___tls_end__.

Index: src/ld/scripttempl/pe.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/pe.sc,v
retrieving revision 1.11
diff -c -3 -p -r1.11 pe.sc
*** src/ld/scripttempl/pe.sc	29 Apr 2004 16:40:18 -0000	1.11
--- src/ld/scripttempl/pe.sc	6 Jun 2004 09:18:06 -0000
*************** if test "${RELOCATING}"; then
*** 24,30 ****
       SORT(*)(.idata$5)
       SORT(*)(.idata$6)
       SORT(*)(.idata$7)'
!   R_CRT='*(SORT(.CRT$*))'
     R_TLS='
       *(.tls)
       *(.tls$)
--- 24,34 ----
       SORT(*)(.idata$5)
       SORT(*)(.idata$6)
       SORT(*)(.idata$7)'
!   R_CRT_XC='*(SORT(.CRT$XC*))  /* C initialization */'
!   R_CRT_XI='*(SORT(.CRT$XI*))  /* C++ initialization */'
!   R_CRT_XL='*(SORT(.CRT$XL*))  /* TLS callbacks */'
!   R_CRT_XP='*(SORT(.CRT$XP*))  /* Pre-termination */'
!   R_CRT_XT='*(SORT(.CRT$XT*))  /* Termination */'
     R_TLS='
       *(.tls)
       *(.tls$)
*************** SECTIONS
*** 130,141 ****
     }
     .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
     { 					
!     ${R_CRT}
     }

     .tls ${RELOCATING+BLOCK(__section_alignment__)} :
     { 					
       ${R_TLS}
     }

     .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
--- 134,161 ----
     }
     .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
     { 					
!     ${RELOCATING+___crt_xc_start__ = . ;}
!     ${R_CRT_XC}
!     ${RELOCATING+___crt_xc_end__ = . ;}
!     ${RELOCATING+___crt_xi_start__ = . ;}
!     ${R_CRT_XI}
!     ${RELOCATING+___crt_xi_end__ = . ;}
!     ${RELOCATING+___crt_xl_start__ = . ;}
!     ${R_CRT_XL}
!     /* ___crt_xl_end__ is defined in the TLS Directory support code */
!     ${RELOCATING+___crt_xp_start__ = . ;}
!     ${R_CRT_XP}
!     ${RELOCATING+___crt_xp_end__ = . ;}
!     ${RELOCATING+___crt_xt_start__ = . ;}
!     ${R_CRT_XT}
!     ${RELOCATING+___crt_xt_end__ = . ;}
     }

     .tls ${RELOCATING+BLOCK(__section_alignment__)} :
     { 					
+     ${RELOCATING+___tls_start__ = . ;}
       ${R_TLS}
+     ${RELOCATING+___tls_end__ = . ;}
     }

     .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :



More information about the Binutils mailing list