Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #127513

Re: Compile Assembly and C files together

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Compile Assembly and C files together
Date 2018-03-08 23:47 +0100
Organization A noiseless patient Spider
Message-ID <p7sehf$99s$1@dont-email.me> (permalink)
References (9 earlier) <QpYnC.154946$J36.16870@fx10.am4> <p7r729$seu$1@dont-email.me> <9yaoC.224890$5c2.55848@fx09.am4> <p7rgfr$tea$1@dont-email.me> <KmdoC.90664$kP6.83054@fx06.am4>

Show all headers | View raw


On 08/03/18 17:17, bartc wrote:
> On 08/03/2018 14:14, David Brown wrote:
>> On 08/03/18 14:05, bartc wrote:
>>> On 08/03/2018 11:33, David Brown wrote:
>>>> On 07/03/18 22:00, bartc wrote:
>>>
>>>> If you want to use assembly along with gcc, you need to learn how to do
>>>> it.
>>>
>>> This is the problem; I can't be arsed learning something so arcane, and
>>> IMO so badly designed. (I anyway would hardly ever use it.)
>>
>> If you want to use it at all, learn it.  If you don't want to use it,
>> don't learn it.  "Hardly ever use it" is your worst possible option.
>>
>> How do you manage to classify it as "arcane" and "badly designed" when
>> you have not learned it, not used it, and clearly have not made the
>> slightest attempt to understand it or the reasoning behind it?
> 
> Because, like a lot of things, you can take an instant dislike to a 
> language. Especially when you have extensive experience of how such a 
> language /could/ work.
> 
> Here are some other people's comments:
> 
> "...but there is a whole extra language you need to know to make the 
> connection between a chunk of asm code and the world outside that chunk 
> of asm code (especially local variables in the same function).
> 
> That extra language is difficult and generally not worth it."
> 

Extra "language" ?  That's an absurd exaggeration.  Do you consider 
printf format strings to be an extra language?

> "...the obscure syntax gcc has for connecting local variables into 
> inline asm."
> 
> 
> To you of course, 'difficult' and 'obscure' can NEVER be an indication 
> that something could do with looking at.

Certainly gcc's inline assembly syntax is a bit complex, and I expect 
that most people need to have the manual page open for reference when 
writing it.  I fail to see that as a problem - it is a feature you 
rarely need to use, and it does not matter if it is a bit difficult. 
(If you had to use it often, that would indicate a /real/ problem with 
the compiler.)

Could it be done differently?  Sure.  Could an alternative syntax have 
been neater, or easier to follow?  I expect so.  But I would not expect 
to get /that/ much better while keeping the features and the 
flexibility, and working on pretty much any processor.  (Your syntax is 
certainly no replacement, even though it might be convenient for simple 
cases.)

> 
> (Is that actually the case? Have you ever come across any system that 
> you considered to be poorly designed, over-engineered, over-complicated, 
> too hard to understand, or elicited any such opinion on your part? If 
> so, what was your response when simply told you have to RTFM?)

Of course I have come across such systems.  I can't think of any 
examples where it was something I wanted to use, with reasonable 
documentation, lots of tutorials and web pages, and which many people 
use quite successfully - and then thought that the best idea would be to 
avoid any reading, learning or thinking before deriding it in a public 
forum.

> 
>> this makes you look?  You have such a
>> strong case of "not invented here" syndrome that you can't see past your
>> own navel.
> 
> I know how it makes you look; I wouldn't come to you for constructive 
> opinions about how to make anything better, because it's always going to 
> be good enough. Unless perhaps it's too small, too fast, too simple or 
> too sensible!

gcc's inline assembly syntax /is/ good enough.  It has remained 
unchanged for a great many years, because for the great majority of uses 
it is good enough.  That doesn't mean it could not be improved, or that 
an alternative could not be better - but no one has felt enough need to 
change it to actually do anything about it.  There are many, many other 
things I would change about gcc first.

> 
>> I really don't care if you don't like gcc, or any other compiler that
>> you didn't write yourself.  But it bugs me that you publicly criticise
>> tools that you know /nothing/ about,
> 
> No, only to regulars in groups like this. Never to people I don't know 
> or to beginners.
> 

Why would you criticise them to /anyone/, when you have made no effort 
to understand them or to see why they are the way they are?  There are 
lots of things that you could sensibly criticise about C, gcc, or other 
tools that people regularly use here.  But instead you feel this urge to 
criticise /everything/ about them - any aspect that is mentioned by 
other posters.

>> The OP came here looking for some advice.  This is arguably not the
>> ideal place for such system-specific information, but we could do a lot
>> better if the folks that actually understand C, and can use toolchains,
>> were able to help rather than trying to battle the ludicrous
>> misunderstandings and prejudices that you spread.
> 
> What misunderstandings did I spread in my first couple of posts in the 
> thread? I don't remember that I expressed an opinion about gcc or its 
> assembly language, inline or otherwise.
> 
> I remember I made a throwaway comment about avoiding optimisation when 
> getting gcc to generate .s files for the purposes of tweaking, which 
> regulars chose to jump on.
> 
> You, presumably, would ALWAYS use -O2 or -O3 no matter what the 
> circumstances. Because you're clever enough to understand not only the 
> difficult code that is produced, but also all the code the compiler has 
> decided to leave out!

I usually use -O2, because code size is often relevant for me and -O3 
gives a poorer balance for my needs.  Sometimes I will use -O1 if I 
expect to step through the generated code slowly in a debugger, or study 
the assembly code.

> 
>> RTFM.
> 
> Interesting. When I write documentation, when I find some aspect 
> difficult to explain, it's usually an indication that something is not 
> quite right. So quite often I've simplified and improved an application 
> or whatever I was working on, so as to be able to describe it more easily.
> 
> Clearly that's something alien to the people who write your favourite 
> tools.

Have you actually /read/ the information about inline assembly in gcc? 
Or are you merely condemning it because they wrote a page about it in 
the reference manual?

> 
>>> Copied out of admiration, or because they had to in order to be able to
>>> able to compile the same code as gcc compiles?
>>
>> Go and ask Intel, Apple, Freescale, and other compiler writers.  I would
>> expect they followed it for both reasons.  It is the second most
>> powerful inline assembly system I know of (Diab Data compilers had a
>> couple of other features).  When you want to have a good inline assembly
>> syntax for your compiler, why not copy such a well-known, widely used,
>> and proven solution?
> 
> I'm currently involved in generating .asm files with up to 100,000 lines 
> of assembly code.
> 
> Up to the start of this year, I was using Nasm format and running the 
> Nasm assembler, which has millions of complicated features all of which 
> you would love, but I have no use for.
> 
> Using Nasm to assemble the 100Kloc file would take 40 seconds.
> 
> I now use /my own/ assembler; it takes 0.05 seconds. For, as far as I'm 
> concerned, exactly the same job: turning a .asm file to .obj.
> 
> These things /can be/ that simple.
> 

That is about speed, not simplicity.  I have no good idea why Nasm is 
slow for these files - presumably there is some algorithm in it that 
scales very badly.  I have suggested before that you talk to the Nasm 
folks - I don't remember having seen an answer from you.

Not that the speed of particular assemblers has the slightest bearing on 
your point, of course.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Compile Assembly and C files together Ilias Abrams <iliasabrams@gmail.com> - 2018-03-05 08:23 -0800
  Re: Compile Assembly and C files together "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-03-06 19:20 +0800
    Re: Compile Assembly and C files together druck <news@druck.org.uk> - 2018-03-06 13:53 +0000
      Re: Compile Assembly and C files together Rob Morley <nospam@ntlworld.com> - 2018-03-06 14:59 +0000
        Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-06 16:35 +0100
          Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-06 07:57 -0800
            Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-06 16:35 +0000
              Re: Compile Assembly and C files together Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-06 18:15 +0000
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-06 18:51 +0000
                Re: Compile Assembly and C files together Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-06 19:22 +0000
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-06 19:30 +0000
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-06 12:31 -0800
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-06 23:05 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 12:17 +0100
                Re: Compile Assembly and C files together Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-07 16:05 +0000
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-07 16:45 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 17:54 +0100
                Re: Compile Assembly and C files together Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-07 16:59 +0000
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-07 17:13 +0000
              Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 12:26 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-07 14:25 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 15:57 +0100
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-07 15:24 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 17:56 +0100
            Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 11:37 +0100
              Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-07 13:11 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-07 15:47 +0100
                Re: Compile Assembly and C files together Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-03-07 07:31 -0800
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-07 21:00 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-08 12:33 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-08 13:05 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-08 15:14 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-08 15:23 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-08 23:22 +0100
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-08 14:40 -0800
                Re: Compile Assembly and C files together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-03-08 23:59 +0000
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-08 16:54 -0800
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-09 10:37 +0100
                Re: Compile Assembly and C files together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-03-09 10:47 +0000
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-09 09:19 -0800
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-09 10:23 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-09 12:28 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-09 16:43 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-09 17:14 +0000
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-09 09:32 -0800
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-08 15:26 +0000
                Re: Compile Assembly and C files together Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-03-08 19:23 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-08 23:27 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-08 16:17 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-08 23:47 +0100
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-09 11:59 +0000
              Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-07 09:13 -0800
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-07 17:42 +0000
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-07 10:55 -0800
      Re: Compile Assembly and C files together "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-03-06 23:01 +0800
    Re: Compile Assembly and C files together ray carter <ray@zianet.com> - 2018-03-06 15:44 +0000
      Re: Compile Assembly and C files together "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-03-07 00:07 +0800
        Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-07 22:39 +0200
          Re: Compile Assembly and C files together "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2018-03-08 18:18 +0800
            Re: Compile Assembly and C files together Martin Gregorie <martin@mydomain.invalid> - 2018-03-08 12:37 +0000
              Re: Compile Assembly and C files together Martin Gregorie <martin@mydomain.invalid> - 2018-03-08 13:13 +0000
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-08 13:34 +0000
                Re: Compile Assembly and C files together Martin Gregorie <martin@mydomain.invalid> - 2018-03-08 15:27 +0000
                Re: Compile Assembly and C files together mm0fmf <none@invalid.com> - 2018-03-08 17:33 +0000
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-09 09:06 +0000
                Re: Compile Assembly and C files together Richard Kettlewell <invalid@invalid.invalid> - 2018-03-09 09:17 +0000
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-09 09:30 +0000
                Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-09 15:56 +0200
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-09 14:13 +0000
                Re: Compile Assembly and C files together Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2018-03-09 11:14 -0500
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-09 17:44 +0000
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-09 17:16 +0100
                Re: Compile Assembly and C files together Robert Wessel <robertwessel2@yahoo.com> - 2018-03-09 11:19 -0600
                Re: Compile Assembly and C files together bartc <bc@freeuk.com> - 2018-03-09 18:11 +0000
                Re: Compile Assembly and C files together Robert Wessel <robertwessel2@yahoo.com> - 2018-03-09 13:41 -0600
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-09 10:12 -0800
                Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-09 19:20 +0100
                Re: Compile Assembly and C files together supercat@casperkitty.com - 2018-03-09 11:45 -0800
                Re: Compile Assembly and C files together Robert Wessel <robertwessel2@yahoo.com> - 2018-03-09 13:48 -0600
                Re: Compile Assembly and C files together Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2018-03-09 13:16 -0500
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-09 18:29 +0000
                Re: Compile Assembly and C files together Jack Fearnley <jack@alcor.concordia.ca> - 2018-03-09 19:07 +0000
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-09 19:13 +0000
                Re: Compile Assembly and C files together Michael J. Mahon <mjmahon@aol.com> - 2018-03-10 13:16 -0600
                Re: Compile Assembly and C files together Martin Gregorie <martin@mydomain.invalid> - 2018-03-11 19:39 +0000
                Re: Compile Assembly and C files together Michael J. Mahon <mjmahon@aol.com> - 2018-03-12 01:16 -0500
                Re: Compile Assembly and C files together Martin Gregorie <martin@mydomain.invalid> - 2018-03-12 20:49 +0000
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-12 16:11 +0000
                Re: Compile Assembly and C files together Michael J. Mahon <mjmahon@aol.com> - 2018-03-12 14:58 -0500
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-12 20:38 +0000
                Re: Compile Assembly and C files together scott@slp53.sl.home (Scott Lurndal) - 2018-03-12 16:06 +0000
                Re: Compile Assembly and C files together Michael J. Mahon <mjmahon@aol.com> - 2018-03-12 14:58 -0500
                Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-09 21:27 +0200
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-09 17:40 +0000
                Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-09 21:30 +0200
                Re: Compile Assembly and C files together Richard Damon <Richard@Damon-Family.org> - 2018-03-09 13:16 -0500
                Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-09 21:33 +0200
                Re: Compile Assembly and C files together mm0fmf <none@invalid.com> - 2018-03-09 17:40 +0000
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-09 17:47 +0000
                Re: Compile Assembly and C files together mm0fmf <none@invalid.com> - 2018-03-09 18:05 +0000
                Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-09 09:05 +0000
                Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-09 16:01 +0200
            Re: Compile Assembly and C files together Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2018-03-08 17:25 +0200
    Re: Compile Assembly and C files together The Natural Philosopher <tnp@invalid.invalid> - 2018-03-07 07:36 +0000
  Re: Compile Assembly and C files together Richard Kettlewell <invalid@invalid.invalid> - 2018-03-06 15:29 +0000
    Re: Compile Assembly and C files together David Brown <david.brown@hesbynett.no> - 2018-03-06 16:38 +0100

csiph-web