diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2018-10-08 15:19:23 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2018-10-09 00:56:49 +0000 |
commit | 2245cc50640cda3d695525a2fdd935f227615af1 (patch) | |
tree | e9e5e445d2e08c1c1881792da08581b41e3c285f | |
parent | 44492f8e438f8ce42a254699ba8496eb76075e00 (diff) | |
download | binutils-2245cc50640cda3d695525a2fdd935f227615af1.tar.gz |
Align __CTOR_LIST__ to 4 bytes for windows x86ndk-r19cndk-r19bndk-r19-beta2ndk-r19-beta1ndk-r19android-o-mr1-iot-release-smart-display-r9android-o-mr1-iot-release-smart-display-r8android-o-mr1-iot-release-smart-display-r5android-o-mr1-iot-release-smart-display-r40.1Jandroid-o-mr1-iot-release-smart-display-r4android-o-mr1-iot-release-smart-display-r39android-o-mr1-iot-release-smart-display-r30android-o-mr1-iot-release-smart-display-r3android-o-mr1-iot-release-smart-display-r22android-o-mr1-iot-release-smart-display-r14android-o-mr1-iot-release-smart-clock-r6android-o-mr1-iot-release-smart-clock-r2android-o-mr1-iot-release-smart-clock-fsiandroid-o-mr1-iot-release-smart-clock-fcsandroid-o-mr1-iot-release-cube_r2android-o-mr1-iot-release-cube-fsiandroid-o-mr1-iot-release-cube-fcsoreo-mr1-1.2-iot-releasendk-release-r19master-cuttlefish-testing-release
Bug: http://b/117439724
Without specifying alignment, if __CTOR_LIST__ is not aligned to 4
bytes, we end up with garbage after the -1. This causes access
violations in __do_global_ctors.
The 64-bit version aligns it to 8 bytes (ld/scrpittempl/pep.sc).
Test: With this fix, AOSP Windows tools built with Clang + MinGW +
libc++ no longer crash.
Change-Id: I76be11a265cdcf272d740fa8715024f1f6df3e1b
-rw-r--r-- | binutils-2.27/ld/scripttempl/pe.sc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/binutils-2.27/ld/scripttempl/pe.sc b/binutils-2.27/ld/scripttempl/pe.sc index 59e4e89e..299c4adf 100644 --- a/binutils-2.27/ld/scripttempl/pe.sc +++ b/binutils-2.27/ld/scripttempl/pe.sc @@ -92,6 +92,7 @@ SECTIONS ${RELOCATING+ *(.gnu.linkonce.t.*)} *(.glue_7t) *(.glue_7) + ${CONSTRUCTING+. = ALIGN(4);} ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); } ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; |