compiling ssh gcc


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):



From - Sun Dec 19 08:16:44 1999
Xref: world comp.unix.sco.misc:112235
Path: world!newsfeed.mathworks.com!arclight.uoregon.edu!logbridge.uoregon.edu!remarQ73!rQdQ!supernews.com!remarQ.com!corp.supernews.com!not-for-mail
From: Robert Lipe <robertlipe@usa.net>
Newsgroups: comp.unix.sco.misc
Subject: Re: SCO and SSH(d)
Date: Sun, 19 Dec 1999 06:15:21 GMT
Organization: Posted via Supernews, http://www.supernews.com
Lines: 97 Message-ID: <s5otvpk5ee6159@corp.supernews.com> References: <rpfa38.ut5.ln@jeeves.itte.net> <3859d0a4.0@198.161.96.27>
Reply-To: robertlipe@usa.net
X-Complaints-To: newsabuse@supernews.com
X-Newsreader: NN version 6.5.0 CURRENT #118
X-Mozilla-Status: 8010
X-Mozilla-Status2: 00000000


Hate these ads?



"Buddy Z" <diespammersdie-zed@wcs.ab.ca> writes:



>Anders Gulden Olstad <andersgo@alge.anart.no> wrote in message
>news:rpfa38.ut5.ln@jeeves.itte.net...
>> This has maybe been discussed before - but looking at the portability list
>> for SSH1, SCO Unix is listed as "client only".














sshd and ssh both work fine for me.   I use it daily.



>/usr/tmp/cca006wL.s:1594:invalid register for instruction: %edx in rolw
>/usr/tmp/cca006wL.s:1594:invalid register for instruction: %edx in rolw



The ssh source is broken when compiling with GCC and a strict assembler
such as OpenServer's native one or newer versions of GAS.  See attached
patch.




>From robertl@caldera.com Sat Oct  2 04:21:25 1999
Date: Sat, 2 Oct 1999 04:21:25 -0500
From: Robert Lipe <robertl@caldera.com>
To: ssh-bugs@ssh.fi
Subject: Re: ssh 2.0.13 & illegal asms Message-ID: <19991002042125.N25838@rjlhome.caldera.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 1.0pre1i
Status: RO
Content-Length: 2793
Lines: 66



Yesterday I submitted a patch to SSH 2.0.13.   Please replace it with
this one.









One of my peers who is much more the IA32 assembler wizard than myself
explained what these functions were trying to do and why my patch was
misguided.  He explained that they were just doing byteswapping.



> But neither is going to work right.  They're pulling a trick here which
> *requires* the assembler to do what SCO's fails to do: accept a size
> mismatch between opcode and operand.

> They're trying to build code similar to:

>                    //                   __byte__--byte--__byte__--byte--
>   movl (arg), %eax //             eax = wwwwwwwwxxxxxxxxyyyyyyyyzzzzzzzz
>   rolw    $8,  %ax // swap bytes: eax = wwwwwwwwxxxxxxxxzzzzzzzzyyyyyyyy
>   roll   $16, %eax // swap words: eax = zzzzzzzzyyyyyyyywwwwwwwwxxxxxxxx
>   rolw    $8,  %ax // swap bytes: eax = zzzzzzzzyyyyyyyyxxxxxxxxwwwwwwww

> They definitely intend to manipulate only the low two bytes in
> instructions #2 and 4.

> Unfortunately, this requires some textual manipulation of the argument
> "%0", and I don't know whether that's possible in the context of the C
> preprocessor + "__asm__" handling.  Their previous solution, now
> provoking warnings from GNU and failures from SCO, was to fudge it by
> spelling it "%eax" all the time; providing the size information in the
> opcode name; and hoping that the assembler would forgive the mismatch.



With that in mind, I believe thw following to be a better fix.   It adjusts
the constraints on the asm operands to more accurately reflect what we're
trying to do.




--- sshgetput.c_        Mon Feb  8 02:32:59 1999
+++ sshgetput.c Thu Sep 30 20:29:12 1999
@@ -47,7 +47,7 @@
 SshUInt32 SSH_GET_32BIT(const unsigned char *cp)                                {
   SshUInt32 result;                                                            -  __asm__ volatile ("movl (%1), %0; rolw $8, %0; roll $16, %0; rolw $8, %0;"
+  __asm__ volatile ("movl (%1), %0; rolw $8, %w0; roll $16, %0; rolw $8, %w0;"
           : "=&r" (result)
           : "r" (cp));    
   return result;
--- sshgetput.h_        Thu Sep 30 20:23:09 1999
+++ sshgetput.h Thu Sep 30 20:30:06 1999
@@ -181,7 +181,7 @@ 
 #define SSH_GET_32BIT(cp) \
 ({  \
   SshUInt32 __v__; \
-  __asm__ volatile ("movl (%1), %0; rolw $8, %0; roll $16, %0; rolw $8, %0;" \
+  __asm__ volatile ("movl (%1), %0; rolw $8, %w0; roll $16, %0; rolw $8, %w0;" \
           : "=&r" (__v__) \
           : "r" (cp)); \   
   __v__; \




Imposing the additional (word) constraint on the zero't argument does indeed
result in assembly code like this:



         movl (%edx), %eax; rolw $8, %ax; roll $16, %eax; rolw $8, %ax;




Thanx to the person that pointed this out.   Once I had that hint,
expressing it in GCC syntax wasn't too hard.



RJL







Comments /Bofcusm/199.html


Add your comments

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner

cartoon
Forget the expense of flying to New England. Forget hotel and meals costs.
Installation and light training Boston and New England


Views for this page
Today This Week This Month This Year  Overall
1626300 1,654

/Bofcusm/199.html copyright 1997-2004 (various authors) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

More:
       - Security




Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://www.loch-raven.com/ Over 18 years of experience Unix and Linux servers. Linux and Unix consulting, system administration, remote administration, custom scripting, web desing and hosting.


http://thatitguy.com Business networking servers, Linux and Unix experts. In business since 1997! Windows and Exchange to Samba and Scalix migration experts.


http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.




card_image








Change Congress


Related Posts