Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <395095E9.F94D70EC@phekda.freeserve.co.uk> Date: Wed, 21 Jun 2000 11:16:09 +0100 From: Richard Dawe X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: Eli Zaretskii CC: djgpp AT delorie DOT com, rich AT phekda DOT freeserve DOT co DOT uk Subject: Re: Inline asm: lcall & various binutils versions References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Hello. Eli Zaretskii wrote: > > On Tue, 20 Jun 2000, Richard Dawe wrote: > > > #if GAS_MAJOR >= 2 && GAS_MINOR > 8 > > "nop \r\n" > > #endif /* IFDEFTEST */ > > "nop \r\n"); > > I understand that this is just an example, because in the actual problem > you had you will need a different condition for the versions (e.g., if > GAS_MAJOR is 3 or more, GAS_MINOR is not important). Yes, this is an example. For libsocket/libwin I would use: #if GAS_MINOR == 2 && GAS_MINOR == 8 && GAS_MINORMINOR == 1 "lcall _entrypoint" #else "lcall *_entrypoint" #endif Note that I haven't checked that 'as --version' with binutils 2.8.1 gives (2, 8, 1). I also assume no-one uses binutils versions earlier than 2.8.1 (reasonable, I think). More about the example: when you define IFDEFTEST, you get three 'nop's in the output (as seen by 'objdump -d'); otherwise, you get two 'nop's. > > Is this satisfactory? My sed knowledge is limited (*), but this seems > > to do the trick. > > The Sed scripts can be improved slightly, but they seem to be correct. Sure, please tell me how, when you have time. > > [ If you put '#ifdef' in the inline assembly, then it becomes an > > assembly comment and does nothing. > > AFAIK, inline assembly doesn't go through cpp; GCC emits it in the > form of preprocessed assembly. So you cannot have any preprocessor > directives inside the asm() block. Yes, this is what I saw when using the -save-temps option on gcc. The inline assembly appears as-is (or as-was). Re: safety - I think we're still relying on binutils 2.8.1 to generate the right code for 'lcall _entrypoint' (i.e. an absolutely-addressed call), it's just that the AT&T syntax to tell gas to do an absolutely-addressed call doesn't work (hence the current problem). So, at least we can be safe with binutils 2.9.5.1 beta. ;) Bye, Rich =] -- Richard Dawe [ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]