From 44c423fc79b4899cfa19bf7e52982897746a0fe6 Mon Sep 17 00:00:00 2001 From: Michael Urman Date: Tue, 4 Nov 2003 19:52:02 +0000 Subject: [PATCH] "Fix" stabs to always output the same stab length in stabs_bc_stab_tobytes. 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 svn path=/trunk/yasm/; revision=1083 --- modules/dbgfmts/stabs/stabs-dbgfmt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/dbgfmts/stabs/stabs-dbgfmt.c b/modules/dbgfmts/stabs/stabs-dbgfmt.c index d4a5d6c3..c168789c 100644 --- a/modules/dbgfmts/stabs/stabs-dbgfmt.c +++ b/modules/dbgfmts/stabs/stabs-dbgfmt.c @@ -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; -- 2.40.0