Mail Archives: djgpp-workers/2004/10/27/12:23:31
Noticed that gcc-3.4.2 optimizes out array forced_test when compiling
djgpp/src/debug/common/dbgcom.c. The result is that later assembler
interprets as external symbol and I'm getting it as unresolved symbol.
Using static variable in inline assembler is not enough for compiler
to see that it's used.
I see some possible workarounds for this problem:
1) make variables external after obfucating their names (like
__dj_forced_test)
2) reference them (for example, putting '(void) forced_test;' somewhere).
As far as I remeber, earlier Eli objected to this way.
I myself would prefer seconf way.
Andris
--- djgpp/src/debug/common/dbgcom.c~5 2002-10-17 23:00:24.000000000 +0000
+++ djgpp/src/debug/common/dbgcom.c 2004-10-26 21:04:50.000000000 +0000
@@ -1681,6 +1681,11 @@ _init_dbg_fsext(void)
int jft_ofs;
int jft_count;
+ /* forced_test must be referenced to avoid it from
+ optimising away. Use in inline assembler as
+ above is not enough */
+ (void) forced_test;
+
/* Get our PSP address. */
r.x.ax = 0x6200;
__dpmi_int (0x21, &r);
- Raw text -