X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: Andris Pavenis To: djgpp-workers AT delorie DOT com Subject: gcc-3.4 and djgpp/src/debug/common/dbgcom.c Date: Wed, 27 Oct 2004 19:28:05 +0300 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410271928.05413.pavenis@latnet.lv> Reply-To: djgpp-workers AT delorie DOT com 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);