public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* New version of gnu assembler
@ 2023-07-01 12:06 jacob navia
  2023-07-01 12:33 ` Sam James
  2023-07-02  9:49 ` Jona Müller
  0 siblings, 2 replies; 6+ messages in thread
From: jacob navia @ 2023-07-01 12:06 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 3444 bytes --]

Hi

I have developed a new version of the gnu assembler for riscv machines.

Abstract:
———

The GNU assembler (gas) is centered on flexibility and portability. These two objectives have quite a cost in program readability, code size  and execution time. 

I have developed a « tiny » version of the GNU assembler focusing on simplicity and speed.

I have picked up from the several hundreds of megabytes of binutils just the routines that are needed to a functional assembler, for the use case of compiler generated assembler text for a single machine. That meant:

1) There is no linker code in this assembler. An assembler doesn’t need any linker code. It is an assembler, period.
2) There are no macros, no preprocessing, nothing that makes an assembler easier to use for a human developer. This is NOT a replacement of gas, that is obviously still available everywhere. If you want to develop in assembler use gas, not this tiny assembler.
3) Since there isn’t a human user, all the sophisticated error handling is not necessary. Messages are in English ONLY and if you do not know that language just do not make any mistakes!
4) All the vectorization for separating the front end and the backend are eliminated. There is no indirection through function tables the functions in the backend are called directly. This has the advantage that when you see a function call like statement like foo(42); it means that you are calling the « foo » function, not a macro that is expanded into something else then renamed to yet another name.
5) The BFD library has been disabled. Only some procedures of that library are in the code. The same for libierty, that has almost vanished.
6) The code has been cleaned up from all cruft like this:
          /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
         * flavoured AS.  The following bizarre behaviour is to be
         * compatible with above.  I guess they tried to take up to 8
         * bytes from a 4-byte expression and they forgot to sign
         * extend.  */
#define BSD_FILL_SIZE_CROCK_4 (4)

So, we are still in 2023 keeping bug compatibility with an  assembler for a machine that ceased production in 2000?

In a similar vein, all code that referenced the Motorola 68000 (an even older machine) the Z80, the SUN SPARC, etc is gone. This assembler will only produce 64 bits ELF code and compile for a 64 bit risk CPU.

Availability:
$ git clone https://github.com/jacob-navia/tiny-asm

Building the tiny assembler:
$ gcc -o asm asm.c

There is no Makefile

In some machines, the obstack  library is not a part of the libc. (Not linux, Apple, for instance). For those machines obtsack.c is provided in the distribution and the compilation command should be:
$ gcc -o asm asm.c obstack.c

star64:~/riscv-asm$ objdump -h asm | grep text
 11 .text         0002e53e  0000000000028060  0000000000028060  00028060  2**2

Just 189 758 bytes. The gnu assembler is:
star64:~/riscv-asm$ objdump -h ../binutils-gdb/gas/as-new | grep text
 11 .text         000d8d10  00000000000465a0  00000000000465a0  000465a0  2**2
888 080 bytes.

Further work:
The idea is to replace the system assembler in gcc and replaced with a linked assembler that speeds gcc: instead of writing an assembler file you just pass a pointer to the text buffer in memory.
But that is still much further down the road.

Enjoy!

jacob




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New version of gnu assembler
  2023-07-01 12:06 New version of gnu assembler jacob navia
@ 2023-07-01 12:33 ` Sam James
  2023-07-02 16:52   ` Dave Blanchard
  2023-07-02  9:49 ` Jona Müller
  1 sibling, 1 reply; 6+ messages in thread
From: Sam James @ 2023-07-01 12:33 UTC (permalink / raw)
  To: jacob navia; +Cc: gcc


jacob navia <jacob@jacob.remcomp.fr> writes:

> Hi
>
> I have developed a new version of the gnu assembler for riscv machines.
>
> Abstract:
> ———
>
> The GNU assembler (gas) is centered on flexibility and portability. These two objectives have quite a cost in program readability, code size  and execution time. 
>
> I have developed a « tiny » version of the GNU assembler focusing on simplicity and speed.
>
> I have picked up from the several hundreds of megabytes of binutils just the routines that are needed to a functional assembler, for the use case of compiler generated assembler text for a single machine. That meant:

If you've taken files from Binutils BFD, please make sure you preserve
the copyright headers too.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New version of gnu assembler
  2023-07-01 12:06 New version of gnu assembler jacob navia
  2023-07-01 12:33 ` Sam James
@ 2023-07-02  9:49 ` Jona Müller
  1 sibling, 0 replies; 6+ messages in thread
From: Jona Müller @ 2023-07-02  9:49 UTC (permalink / raw)
  To: jacob navia; +Cc: gcc

Hi Jacob,

interesting project. On my linux machine I also needed to link -lz. 

ys,
Jona

> On 1. Jul 2023, at 14:07, jacob navia <jacob@jacob.remcomp.fr> wrote:
> 
> Hi
> 
> I have developed a new version of the gnu assembler for riscv machines.
> 
> Abstract:
> ———
> 
> The GNU assembler (gas) is centered on flexibility and portability. These two objectives have quite a cost in program readability, code size  and execution time. 
> 
> I have developed a « tiny » version of the GNU assembler focusing on simplicity and speed.
> 
> I have picked up from the several hundreds of megabytes of binutils just the routines that are needed to a functional assembler, for the use case of compiler generated assembler text for a single machine. That meant:
> 
> 1) There is no linker code in this assembler. An assembler doesn’t need any linker code. It is an assembler, period.
> 2) There are no macros, no preprocessing, nothing that makes an assembler easier to use for a human developer. This is NOT a replacement of gas, that is obviously still available everywhere. If you want to develop in assembler use gas, not this tiny assembler.
> 3) Since there isn’t a human user, all the sophisticated error handling is not necessary. Messages are in English ONLY and if you do not know that language just do not make any mistakes!
> 4) All the vectorization for separating the front end and the backend are eliminated. There is no indirection through function tables the functions in the backend are called directly. This has the advantage that when you see a function call like statement like foo(42); it means that you are calling the « foo » function, not a macro that is expanded into something else then renamed to yet another name.
> 5) The BFD library has been disabled. Only some procedures of that library are in the code. The same for libierty, that has almost vanished.
> 6) The code has been cleaned up from all cruft like this:
>          /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
>         * flavoured AS.  The following bizarre behaviour is to be
>         * compatible with above.  I guess they tried to take up to 8
>         * bytes from a 4-byte expression and they forgot to sign
>         * extend.  */
> #define BSD_FILL_SIZE_CROCK_4 (4)
> 
> So, we are still in 2023 keeping bug compatibility with an  assembler for a machine that ceased production in 2000?
> 
> In a similar vein, all code that referenced the Motorola 68000 (an even older machine) the Z80, the SUN SPARC, etc is gone. This assembler will only produce 64 bits ELF code and compile for a 64 bit risk CPU.
> 
> Availability:
> $ git clone https://github.com/jacob-navia/tiny-asm
> 
> Building the tiny assembler:
> $ gcc -o asm asm.c
> 
> There is no Makefile
> 
> In some machines, the obstack  library is not a part of the libc. (Not linux, Apple, for instance). For those machines obtsack.c is provided in the distribution and the compilation command should be:
> $ gcc -o asm asm.c obstack.c
> 
> star64:~/riscv-asm$ objdump -h asm | grep text
> 11 .text         0002e53e  0000000000028060  0000000000028060  00028060  2**2
> 
> Just 189 758 bytes. The gnu assembler is:
> star64:~/riscv-asm$ objdump -h ../binutils-gdb/gas/as-new | grep text
> 11 .text         000d8d10  00000000000465a0  00000000000465a0  000465a0  2**2
> 888 080 bytes.
> 
> Further work:
> The idea is to replace the system assembler in gcc and replaced with a linked assembler that speeds gcc: instead of writing an assembler file you just pass a pointer to the text buffer in memory.
> But that is still much further down the road.
> 
> Enjoy!
> 
> jacob
> 
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New version of gnu assembler
  2023-07-01 12:33 ` Sam James
@ 2023-07-02 16:52   ` Dave Blanchard
  2023-07-02 21:27     ` Gabriel Ravier
  2023-07-03  1:15     ` Ian Lance Taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Blanchard @ 2023-07-02 16:52 UTC (permalink / raw)
  To: gcc

On Sat, 01 Jul 2023 13:33:07 +0100
Sam James via Gcc <gcc@gcc.gnu.org> wrote:

> If you've taken files from Binutils BFD, please make sure you preserve
> the copyright headers too.

Why? How is that important? That's all you have to say about this? 

Copyright is an abomination, and especially so the GPL; particularly the GPLv3. I hope he deleted the copyright notice.

OP: Good work and nice project. The GNU ecosystem is full of bloated shitware and cruft, and it's nice to see people working to get rid of all the junk so we can have software that is actually usable and maintainable.

Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New version of gnu assembler
  2023-07-02 16:52   ` Dave Blanchard
@ 2023-07-02 21:27     ` Gabriel Ravier
  2023-07-03  1:15     ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Gabriel Ravier @ 2023-07-02 21:27 UTC (permalink / raw)
  To: Dave Blanchard, gcc

On 7/2/23 18:52, Dave Blanchard wrote:
> On Sat, 01 Jul 2023 13:33:07 +0100
> Sam James via Gcc <gcc@gcc.gnu.org> wrote:
>
>> If you've taken files from Binutils BFD, please make sure you preserve
>> the copyright headers too.
> Why? How is that important? That's all you have to say about this?
>
> Copyright is an abomination, and especially so the GPL; particularly the GPLv3. I hope he put himself in legal jeopardy for no reason.
FTFY.
>
> OP: Good work and nice project. The GNU ecosystem is full of bloated shitware and cruft, and it's nice to see people working to get rid of all the junk so we can have software that is actually usable and maintainable.
>
> Dave



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: New version of gnu assembler
  2023-07-02 16:52   ` Dave Blanchard
  2023-07-02 21:27     ` Gabriel Ravier
@ 2023-07-03  1:15     ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2023-07-03  1:15 UTC (permalink / raw)
  To: Dave Blanchard; +Cc: gcc

On Sun, Jul 2, 2023 at 9:50 AM Dave Blanchard <dave@killthe.net> wrote:
>
> On Sat, 01 Jul 2023 13:33:07 +0100
> Sam James via Gcc <gcc@gcc.gnu.org> wrote:
>
> > If you've taken files from Binutils BFD, please make sure you preserve
> > the copyright headers too.
>
> Why? How is that important? That's all you have to say about this?
>
> Copyright is an abomination, and especially so the GPL; particularly the GPLv3. I hope he deleted the copyright notice.
>
> OP: Good work and nice project. The GNU ecosystem is full of bloated shitware and cruft, and it's nice to see people working to get rid of all the junk so we can have software that is actually usable and maintainable.

Please be respectful.  Thanks.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-03  1:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01 12:06 New version of gnu assembler jacob navia
2023-07-01 12:33 ` Sam James
2023-07-02 16:52   ` Dave Blanchard
2023-07-02 21:27     ` Gabriel Ravier
2023-07-03  1:15     ` Ian Lance Taylor
2023-07-02  9:49 ` Jona Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).