www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000161

When Created: 06/19/1997 00:05:57
Against DJGPP version: 2.01
By whom: peterm@cae.com.au
Abstract: Bug assembling longjump.s for libc
When I try and build libc.a, I get an error from the assembly of the longjump.s
file as shown below:

ansi\setjmp\longjmp.s: Assembler messages:
ansi\setjmp\longjmp.s:46: Error: Bad expression
ansi\setjmp\longjmp.s:46: Error: Missing ')' assumed
ansi\setjmp\longjmp.s:46: Error: Ignoring junk 'esi) ' after expression
ansi\setjmp\longjmp.s:50: Error: Ignoring junk '(%esi) ' after expression
ansi\setjmp\longjmp.s:54: Error: Ignoring junk '(%esi) ' after expression
ansi\setjmp\longjmp.s:58: Error: Ignoring junk '(%esi) ' after expression
ansi\setjmp\longjmp.s:62: Error: Ignoring junk '(%esi) ' after expression
ansi\setjmp\longjmp.s:66: Error: Ignoring junk '(%esi) ' after expression
ansi\setjmp\longjmp.s:70: Error: Ignoring junk '(%esi) ' after expression

I am using the following configuration:

486 100MHz, 16MBytes RAM, Win95 and a 4DOS shell. I have downloaded all the 
current DJGPP 2.01 files from ftp.simtel.net just in case there was an 
incompatability problem with all the upgrades of different files and utilities 
but it made no difference to the error.

Thanks

Peter Milliken

Workaround added: 06/21/1997 09:35:36
By whom: graeme@interlink.or.jp
It seems that 'gas' is getting confused by C-style /* */ comments.
The problem is that 'gcc' should have called the C preprocessor, 'cpp',
before calling 'gas'. Why didn't it?

Well, 'gcc' uses the case of the file extension to decide what to do:
A lower case '.s' extension causes 'gcc' to call 'gas' directly.
An upper case '.S' extension tells 'gcc' that it needs to run the source
through 'cpp' first, and then call 'gas'.

I assume you had LFN=y and unzipped the source using a
case-sensitive utility like WinZip or unzip32. Unfortunately,
a quick look at the contents of djlsr201.zip shows that all
assembly files, longjmp.s included, have the (incorrect) lower
case '.s' extension. The result: 'cpp' is not called, the C-style
comments are not stripped, and 'gas' chokes.

I don't know of any flag to force 'gcc' to call the preprocessor even for
'.s' files, so the only permanent solution is to rename them all to have
the proper '.S' extension.

There are several workarounds:

(1) The quickest method is to set the environment variable LFN=n
before you recompile, or make the change in djgpp.env if you don't mind
making it permanent. Then all file names are treated as upper case.

(2) If you'd rather keep long file names turned on, try unzipping the
source with PKUNZIP or UNZIP (real mode), which force all file names
to upper case. (I haven't tried this).

(3) Rename all '.s' file extensions in the source tree to '.S'. Something like the following 'sed' command should produce a batch file which
does the trick. (I hope this mess of backslashes makes it through
the bug system). Run it from the 'src' directory of the djgpp hierachy.

dir /b /s *.s | sed -e 's/\(.\+\\\)\([^\\]\+\)\.\([sS]\)/ren \1\2.\3 \2.s/' > fixit.bat

Run fixit.bat and, voila! The problem is solved for good!

Solution added: 06/21/1997 09:44:58
By whom: graeme@interlink.or.jp
All assembly files in djlsr201.zip need to have their extension changed
from lower case '.s' to upper case '.S'.

Solution added: 07/07/1997 15:39:03
By whom: broeker@physik.rwth-aachen.de
Actually, there *is* an option to force gcc to feed assembly sources
through the preprocessor before passing them on to gas:

	gcc -x assembler-with-cpp filename.s

*does* work.

I'll see if I can resolve this issue in my current revision of the whole
library building machinery.

Fixed in version on 04/12/1999 11:00:53
By whom: eliz@is.elta.co.il

Note added: 04/12/1999 11:00:22
By whom: eliz@is.elta.co.il
This problem was due to v2.01 not being LFN-clean.  Fixed in later versions.



  webmaster     delorie software   privacy  
  Copyright © 2010   by DJ Delorie     Updated Jul 2010