changeset 420:e6ddaffce6a8

Patch from Felix Nawothnig to zero the high bits of floating point constants that would otherwise write uninitialized data into generated binaries. This screws up bootstrap testing because two builds don't produce identical binaries, as noted by http://www.dwheeler.com/trusting-trust/
author Rob Landley <rob@landley.net>
date Thu, 22 Feb 2007 15:17:33 -0500
parents 064848fc143f
children ffd17713a155
files tcc.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tcc.c	Thu Feb 22 15:06:23 2007 -0500
+++ b/tcc.c	Thu Feb 22 15:17:33 2007 -0500
@@ -4830,6 +4830,13 @@
             offset = (data_section->data_offset + align - 1) & -align;
             data_section->data_offset = offset;
             /* XXX: not portable yet */
+#ifdef __i386__
+            /* long doubles are defined to be 96 bit wide by
+               the i386 ABI but the x87 only uses the first 80. The rest
+               is filled with garbage by now, so clear it before writing */
+            if(size == 12)
+                vtop->c.tab[2] &= 0xffff;
+#endif
             ptr = section_ptr_add(data_section, size);
             size = size >> 2;
 #if defined(TCC_TARGET_ARM) && !defined(TCC_ARM_VFP)