Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > On Thu, Nov 19, 2020 at 09:51:41AM +0000, Richard Sandiford wrote: >> > I think we shouldn't do this except when targetting the (buggy) llvm >> > assembler. >> > Specifying section flags just on first .section directive and not others >> > is correct, there is no point repeating that and GNU as (but I think many >> > other assemblers) has been supporting it that way forever. >> >> But are there any negative effects with specifying the flags multiple >> times for GNU as? If not, then it seems simpler to generate the form >> that “all” assemblers accept. > > It makes the assembler files unnecessarily larger and harder to read.
It certainly makes them larger, but surely not by an amount that would cause anyone difficulty in practice. Not sure about harder to read though. Personally I've never found reading code that happens to be after the first switch to a section any harder to read than subsequent switches to the section. The problem with switching based on what assembler we think people are using is that we don't always know. It can often be useful to try something with a different tool for comparison purposes, and that includes using llvm-mc instead of gas. (Certainly done that myself a few times, and I know others have.) I'm not saying we should bend over backwards to support difficult quirks. But here we're talking about a choice between (a) doing something that works “everywhere” unconditionally (and keeping things simple) vs. (b) having both code that takes a shortcut and code that doesn't take a shortcut and trying to predict which one we should do. Thanks, Richard