]> granicus.if.org Git - yasm/commitdiff
"Fix" stabs to always output the same stab length in stabs_bc_stab_tobytes.
authorMichael Urman <mu@tortall.net>
Tue, 4 Nov 2003 19:52:02 +0000 (19:52 -0000)
committerMichael Urman <mu@tortall.net>
Tue, 4 Nov 2003 19:52:02 +0000 (19:52 -0000)
Previously only "symvalue" stabs did this, causing a mismatched output size
with amd64 and stabs.  However since it appears the actual stabs spec always
uses 12 byte stabs, this fix is already obsolete and will be superceded
shortly.

Reported By: Jeff Lawson <jlawson-yasm@bovine.net>

svn path=/trunk/yasm/; revision=1083

modules/dbgfmts/stabs/stabs-dbgfmt.c

index d4a5d6c34dc8bad1bdde8603ea46f8600a086af5..c168789c82f7d62c2db65bd25e84c8a9deb399d1 100644 (file)
@@ -431,6 +431,10 @@ stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
                      yasm_output_expr_func output_expr,
                      yasm_output_reloc_func output_reloc)
 {
+    /* This entire function, essentially the core of rendering stabs to a file,
+     * needs to become endian aware and more size agnostic.  Right now it works
+     * only for little-endian 32 and 64-bit systems */
+
     stabs_bc_stab *bc_stab = (stabs_bc_stab *)bc;
     unsigned char *buf = *bufp;
     const stabs_stab *stab = bc_stab->stab;
@@ -449,9 +453,13 @@ stabs_bc_stab_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
     }
     else if (stab->bcvalue != NULL) {
        YASM_WRITE_32_L(buf, stab->bcvalue->offset);
+        if (stabs_relocsize_bytes == 8)     /* Conditionally output the extra */
+           YASM_WRITE_32_L(buf, 0);        /* bytes a 64 bit system uses */
     }
     else {
        YASM_WRITE_32_L(buf, stab->value);
+        if (stabs_relocsize_bytes == 8)     /* Ditto for 64 bit systems */
+           YASM_WRITE_32_L(buf, 0);
     }
 
     *bufp = buf;