Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: bart Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Sun, 2 Jun 2024 10:37:55 +0100 Organization: A noiseless patient Spider Lines: 45 Message-ID: References: <00297443-2fee-48d4-81a0-9ff6ae6481e4@gmail.com> <87msoh5uh6.fsf@nosuchdomain.example.com> <87y18047jk.fsf@nosuchdomain.example.com> <87msoe1xxo.fsf@nosuchdomain.example.com> <87ikz11osy.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 02 Jun 2024 11:37:54 +0200 (CEST) Injection-Info: dont-email.me; posting-host="67b8fee0090bd0bfbe16789769c90f58"; logging-data="3469481"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uYrWhi5cnE8i0WA1HCYmy" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:MwLq5o1KHZJMcGWPus2xVjLvUY8= In-Reply-To: Content-Language: en-GB Bytes: 3596 On 02/06/2024 04:27, Lawrence D'Oliveiro wrote: > On Sat, 1 Jun 2024 11:37:45 +0100, bart wrote: > >> My compilers don't routinely generate object files, which would also >> need an external dependency (a linker), but they can do if necessary >> (eg. to statically link my code into another program with another >> compiler). > > Modular code design would indicate that there is no point the compiler > duplicating functionality available in the linker. Python uses modules and yet doesn't have a linker. How on earth does it manage? Lots of languages get by without linkers. Or without having to pointlessly write out lots of discrete files, with a lot of useful info lost, then having to read them all in again. (Look at the mess that 'objcopy' gets into.) Quite a few compilers give the impression that they also do the job of linking: gcc x.c y.c z.c produces an executable. Does it really matter here whether the 'linking' is done by a separate program on discrete files, or completely internally? Having all modules in-memory gives you the opportunity for whole-program optimisation, will all useful info intact, without having to invent the far hairier and unwieldy concept of LTO. Here is also my assembler in action given modules x.asm y.asm z.asm produced by my C compiler: aa x y z It does the job of 'linking' but working from .asm files straight to ..exe or .dll. What's the effing point of a separate linker here? Personally I first designed out a traditional linker sometime around 1983. The special Loader I write to combined my object files into a single binary took seconds, even on floppies. A traditional linker would have taken minutes. God knows what they were doing.