Last Comment Bug 485140 - Wrong command line flags used to build intel-aes.s with Solaris gas for x86_64
: Wrong command line flags used to build intel-aes.s with Solaris gas for x86_64
Status: RESOLVED FIXED
:
Product: NSS
Classification: Components
Component: Build (show other bugs)
: trunk
: x86_64 Solaris
: P3 normal (vote)
: 3.12.3
Assigned To: Julien Pierre
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-25 01:14 PDT by Julien Pierre
Modified: 2009-03-26 16:16 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Add -x assembler-with-cpp to ASFLAGS (458 bytes, patch)
2009-03-25 23:32 PDT, Julien Pierre
nelson: review+
Details | Diff | Splinter Review

Description Julien Pierre 2009-03-25 01:14:05 PDT
This happens on the trunk when setting NS_USE_GCC=1 and using gcc 3.4.3 :

gcc -o SunOS5.10_i86pc_gcc_64_OPT.OBJ/SunOS_SINGLE_SHLIB/intel-aes.o  -march=opteron -m64 -fPIC -c intel-aes.s
intel-aes.s: Assembler messages:
intel-aes.s:2: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:3: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:4: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:5: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:5: Error: no such instruction: `you may not use this file except in compliance with'
intel-aes.s:6: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:7: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:8: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:9: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:10: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:11: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:12: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:13: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:14: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:15: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:16: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:17: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:18: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:19: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:20: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:21: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:22: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:23: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:24: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:25: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:26: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:27: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:28: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:29: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:30: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:31: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:40: Error: junk `:buffer for expanded key' after register
intel-aes.s:41: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:77: Error: junk `:buffer for expanded key' after register
intel-aes.s:78: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:148: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:149: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:150: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:151: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:152: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:153: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:154: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:155: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:256: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:257: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:258: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:259: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:260: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:261: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:262: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:263: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:363: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:364: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:365: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:366: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:367: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:368: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:369: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:370: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:424: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:425: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:426: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:427: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:428: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:429: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:430: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:431: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:548: Error: junk `:buffer for expanded key' after register
intel-aes.s:549: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:582: Error: junk `:buffer for expanded key' after register
intel-aes.s:583: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:672: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:673: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:674: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:675: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:676: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:677: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:678: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:679: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:784: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:785: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:786: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:787: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:788: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:789: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:790: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:791: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:895: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:896: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:897: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:898: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:899: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:900: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:901: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:902: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:960: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:961: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:962: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:963: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:964: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:965: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:966: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:967: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:1088: Error: junk `:buffer for expanded key' after register
intel-aes.s:1089: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:1121: Error: junk `:buffer for expanded key' after register
intel-aes.s:1122: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:1205: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:1206: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:1207: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:1208: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:1209: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:1210: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:1211: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:1212: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:1321: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:1322: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:1323: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:1324: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:1325: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:1326: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:1327: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:1328: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:1436: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:1437: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:1438: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:1439: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:1440: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:1441: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:1442: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:1443: Error: junk at end of line, first unrecognized character is `*'
intel-aes.s:1504: Error: junk `:output - pointer to output buffer' after register
intel-aes.s:1505: Error: junk `:outputLen - pointer to variable for length of output' after register
intel-aes.s:1506: Error: junk at end of line, first unrecognized character is `('
intel-aes.s:1507: Error: junk `:maxOutputLen - length of output buffer' after register
intel-aes.s:1508: Error: junk `:input - pointer to input buffer' after register
intel-aes.s:1509: Error: junk `:inputLen - length of input buffer' after register
intel-aes.s:1510: Error: no such instruction: `on stack:blocksize - AES blocksize (always 16,unused)'
intel-aes.s:1511: Error: junk at end of line, first unrecognized character is `*'
gmake[3]: *** [SunOS5.10_i86pc_gcc_64_OPT.OBJ/SunOS_SINGLE_SHLIB/intel-aes.o] Error 1
gmake[3]: Leaving directory `/h/monstre/export/home/julien/nss/tip/mozilla/security/nss/lib/freebl'
gmake[2]: *** [libs] Error 2
gmake[2]: Leaving directory `/h/monstre/export/home/julien/nss/tip/mozilla/security/nss/lib/freebl'
gmake[1]: *** [libs] Error 2
gmake[1]: Leaving directory `/h/monstre/export/home/julien/nss/tip/mozilla/security/nss/lib'
gmake: *** [libs] Error 2
34.99u 2.70s 0:51.92 72.5%
[jp96085@monstre]/h/monstre/export/home/julien/nss/tip/mozilla/security/nss 125 %

This regression is due to bug 459248 .
We don't normally build with gcc on Solaris, but I wanted to do so for checking performance. It was possible on NSS_3_11_BRANCH and it still works there. It is now broken on the trunk and that should be considered a regression.
Comment 1 Nelson Bolyard (seldom reads bugmail) 2009-03-25 12:03:45 PDT
Wouldn't it be nice if Sun's gas assembler used the same syntax for 
x86 assembler files as gas does for those CPUs on other unix OSes?  

In the mean time, we've got much more important things to do now.
Comment 2 Julien Pierre 2009-03-25 18:06:12 PDT
Nelson,

I reported this bug for tracking purpose, because I ran into it. I agree that it's not a high priority bug. But there is no need for admonishment in bugs. Would you rather that I not file it at all ?

This problem surprised me, since the same assembler file apparently builds successfully when using Sun's assembler, but not with gas. 

I wonder how we plan on dealing with this type of bugs after we submit our code for FIPS validation.
Comment 3 Wan-Teh Chang 2009-03-25 21:04:14 PDT
You can probably fix this problem by adding -x assembler-with-cpp
to AS (which is just 'gcc' right now), so that gcc allows C comments,
C preprocessor macros, etc. in a .s file.  By default gcc only gives
that treatment if the file has the .S (capital S) suffix.
Comment 4 Wan-Teh Chang 2009-03-25 21:11:19 PDT
In coreconf/SunOS5.mk, we already add -x assembler-with-cpp to
ASFLAGS.  So that flag is lost in lib/freebl.  Try commenting
out line 385 in lib/freebl/Makefile:

380 else
381     # Solaris for non-sparc family CPUs
382     ifdef NS_USE_GCC
383         LD = gcc
384         AS = gcc
385         ASFLAGS =  <=== COMMENT OUT
386     endif
Comment 5 Julien Pierre 2009-03-25 21:34:00 PDT
Thanks, Wan-Teh ! That worked.
Comment 6 Nelson Bolyard (seldom reads bugmail) 2009-03-25 21:47:36 PDT
I'm pretty sure that line
   ASFLAGS =
was there for a reason, though I don't recall what it was now.
Could be it was just copied from some other platform.
Comment 7 Julien Pierre 2009-03-25 22:51:49 PDT
I did the checkin for that line, and it was done as part of bug 270742. It looks like Nelson wrote the patch. I don't think that line was required, since none of the other .s files break under Solaris with gcc, at least not in 64 bits mode. I just built in 32-bit mode and and it is fine too. I think as far as the build  is concerned, this is fine. but performance may be another story.

I compared one of the object files, with and without the change, and they were significantly different. With the change, mpi_i86pc.o went from 1161 to 2236 bytes - almost double. Some of that is debug info, but not all. That was 32 bits.

I tried with just settings ASFLAGS to -x assembler-with-cpp . But even that caused mpi_i86pc.o to grow to 1267 bytes. Discouraging to say the least.

We probably want a rule specific to intel-aes.s, for Solaris x64 only.
Comment 8 Julien Pierre 2009-03-25 23:32:11 PDT
Created attachment 369446 [details] [diff] [review]
Add -x assembler-with-cpp to ASFLAGS

This works and IMO is better than pulling in the page long of gcc compiler options for assembling those sources.

I have verified using the size command that all our object files from .s sources have the same code size, both for s10 x86 and x64, except for intel-aes, of course, which can't be built without, even though the stripped objects are still much bigger with this option.
Comment 9 Nelson Bolyard (seldom reads bugmail) 2009-03-25 23:34:04 PDT
Comment on attachment 369446 [details] [diff] [review]
Add -x assembler-with-cpp to ASFLAGS

should be fine.  r+
Comment 10 Julien Pierre 2009-03-25 23:46:31 PDT
Checking in Makefile;
/cvsroot/mozilla/security/nss/lib/freebl/Makefile,v  <--  Makefile
new revision: 1.102; previous revision: 1.101
done
Comment 11 Wan-Teh Chang 2009-03-26 09:08:56 PDT
Comment on attachment 369446 [details] [diff] [review]
Add -x assembler-with-cpp to ASFLAGS

Julien, your comment 7 and comment 8 contradict each other
about whether the -x assembler-with-cpp flag increases the
object code size or not.  I believe you're comparing removing
    ASFLAGS =
with changing that line to
    ASFLAGS = -x assembler-with-cpp

If you remove the "ASFLAGS =" line, ASFLAGS will be
    $(CFLAGS) -x assembler-with-cpp
(set by coreconf/command.mk and coreconf/SunOS5.mk), so
the larger object code size is most likely due to some
other flags in $(CFLAGS).
    
In any case, your patch is the right solution.
Comment 12 Julien Pierre 2009-03-26 16:16:47 PDT
Wan-Teh,

In comment 7 I was measuring the object size with ls, in comment 8 with the size command. There was an increase in the former case when changing assembler options, but not the later.

Note You need to log in before you can comment on or make changes to this bug.