This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
fix vxworks TLS sections
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: binutils <binutils at sources dot redhat dot com>
- Date: Thu, 29 Oct 2009 16:49:04 +0000
- Subject: fix vxworks TLS sections
I've committed this patch to fix a problem with vxworks TLS sections. Vxworks
uses a scheme similar to the emulated TLS scheme GCC uses where proper TLS is
unavailable. I'd originally placed the initialization values in the read-only
text segment, but this is incorrect because an initialization value may be the
address of a global variable, and hence have a relocation. If that happens, the
text segment is no longer read-only and in some alignment-specific cases, you
can end up with only one loadable segment, rather than 2. The vxworks RTP
loader dies in that case -- I guess I just got lucky with the original set of
testcases I was using.
Anyway, this places it always in the data segment.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
2009-10-29 Nathan Sidwell <nathan@codesourcery.com>
* emulparams/vxworks.sh (OTHER_READONLY_SECTIONS): Move into ...
(OTHER_READWRITE_SECTIONS): ... here.
Index: emulparams/vxworks.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/vxworks.sh,v
retrieving revision 1.8
diff -c -3 -p -r1.8 vxworks.sh
*** emulparams/vxworks.sh 1 May 2009 15:23:42 -0000 1.8
--- emulparams/vxworks.sh 29 Oct 2009 16:42:46 -0000
*************** FINI_START='_fini = .;
*** 22,28 ****
FINI_END="KEEP (*(.fini\$99));
PROVIDE (${SYMPREFIX}_etext = .);"
! OTHER_READONLY_SECTIONS=".tls_data ${RELOCATING-0} : {${RELOCATING+
__wrs_rtp_tls_data_start = .;
___wrs_rtp_tls_data_start = .;}
*(.tls_data${RELOCATING+ .tls_data.*})
--- 22,28 ----
FINI_END="KEEP (*(.fini\$99));
PROVIDE (${SYMPREFIX}_etext = .);"
! OTHER_READWRITE_SECTIONS=".tls_data ${RELOCATING-0} : {${RELOCATING+
__wrs_rtp_tls_data_start = .;
___wrs_rtp_tls_data_start = .;}
*(.tls_data${RELOCATING+ .tls_data.*})
*************** OTHER_READONLY_SECTIONS=".tls_data ${REL
*** 30,38 ****
__wrs_rtp_tls_data_size = . - __wrs_rtp_tls_data_start;
___wrs_rtp_tls_data_size = . - __wrs_rtp_tls_data_start;
__wrs_rtp_tls_data_align = ALIGNOF(.tls_data);
! ___wrs_rtp_tls_data_align = ALIGNOF(.tls_data);}"
!
! OTHER_READWRITE_SECTIONS=".tls_vars ${RELOCATING-0} : {${RELOCATING+
__wrs_rtp_tls_vars_start = .;
___wrs_rtp_tls_vars_start = .;}
*(.tls_vars${RELOCATING+ .tls_vars.*})
--- 30,37 ----
__wrs_rtp_tls_data_size = . - __wrs_rtp_tls_data_start;
___wrs_rtp_tls_data_size = . - __wrs_rtp_tls_data_start;
__wrs_rtp_tls_data_align = ALIGNOF(.tls_data);
! ___wrs_rtp_tls_data_align = ALIGNOF(.tls_data);}
! .tls_vars ${RELOCATING-0} : {${RELOCATING+
__wrs_rtp_tls_vars_start = .;
___wrs_rtp_tls_vars_start = .;}
*(.tls_vars${RELOCATING+ .tls_vars.*})