mcc

mcc is a machine code compiler.

Log | Files | << Repositories


tree 4a5ef09ce354c1ac51d37cf059b49cfe3226652a
parent b10fed667ee945288fc38ac7184ce43a98918f98
author esote <esote.net@gmail.com> 1558225361 -0500
committer esote <esote.net@gmail.com> 1558225361 -0500
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTXAxYDuIzimYoNSPuhTmRAjzzC8gUCXSArIAAKCRChTmRAjzzC
 8nnTAP9m3jPMs0K2Ibqc5QmrfAgDTSDpt5X2YU0xfN+6XAJYxwD6AoCUf1wsNO5K
 xEYCGV5cgwKyDuMrA+FTS0poGnbi5wo=
 =LE9K
 -----END PGP SIGNATURE-----

Manual page

 README | 40 +++++++++++++++++++++++++++----------
 mcc.1  | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 mcc.c  |  3 +--
 3 files changed, 102 insertions(+), 12 deletions(-)

diff --git a/README b/README
index 992a359..780b828 100644
--- a/README
+++ b/README
@@ -1,17 +1,37 @@
-Reads machine code text and produces x86-64 or i386 Linux-compatible ELF
-executables.
+NAME
+	mcc - machine code compiler
 
-Accepts ASCII text '0' and '1'. All other characters are ignored except the
-comment token ';'. Comments begin with ';' and continue until EOL.
+SYNOPSIS
+	mcc [-3s] [-m memsize] [-o file] file
 
-Programmer's manual:
-	In 64-bit mode .bss and .text start at 0x402000 and 0x401000
-	respectively, and in 32-bit mode 0x804a000 and 0x8049000 respectively.
+DESCRIPTION
+	mcc is a machine code compiler. It reads ASCII text '0' and '1' mapping
+	to machine code instructions. All other characters are ignored except
+	the comment token ';'. Comments begin with ';' and continue until EOL.
 
-	Program header segment alignment is set to 0x1000 (page size on most
-	systems).
+	Use the -o option to specify the output filename. The default is to put
+	the executable in a.out.
+
+	Supports little-endian x86-64 and i386 execution environments using the
+	System V application binary interface. 64-bit is the default mode,
+	32-bit mode is specified with the -s option.
+
+	When writing to the .bss section, specify the size of memory reserved
+	using the -m option. If the size is zero (default), no .bss section will
+	be written for the executable.
+
+	In 64-bit mode the .bss and .text sections start at 0x402000 and
+	0x401000 respectively, and in 32-bit mode 0x804a000 and 0x8049000
+	respectively. Program header segment alignment is set to 0x1000 (the
+	page size on most systems).
 
 	.bss is aligned to a 16-byte constraint and .text to an 8-byte
 	constraint.
 
-	If memsize is zero no .bss section will be written for the executable.
+AUTHORS
+	mcc was written by Esote.
+
+COPYRIGHT
+	Copyright (c) 2019 Esote. There is NO warranty. You may redistribute
+	this software under the terms of the GNU Affero General Public License.
+	For more information, see the LICENSE file.
diff --git a/mcc.1 b/mcc.1
new file mode 100644
index 0000000..c74c6f0
--- /dev/null
+++ b/mcc.1
@@ -0,0 +1,71 @@
+.\"
+.\" Copyright (C) 2019  Esote
+.\"
+.\" This program is free software: you can redistribute it and/or modify
+.\" it under the terms of the GNU Affero General Public License as published
+.\" by the Free Software Foundation, either version 3 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+.\" GNU Affero General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU Affero General Public License
+.\" along with this program.  If not, see <https://www.gnu.org/licenses/>.
+.\"
+.Dd $Mdocdate: May 18 2019 $
+.Dt MCC 1
+.Os
+.Sh NAME
+.Nm mcc
+.Nd machine code compiler
+.Sh SYNOPSIS
+.Nm mcc
+.Op Fl 3s
+.Op Fl m Ar memsize
+.Op Fl o Ar file
+file
+.Sh DESCRIPTION
+.Nm mcc
+is a machine code compiler.
+It reads ASCII text '0' and '1' mapping to machine code instructions.
+All other characters are ignored except the comment token ';'.
+Comments begin with ';' and continue until EOL.
+.Pp
+Use the
+.Fl o
+option to specify the output filename.
+The default is to put the executable in \fIa.out\fR.
+.Pp
+Supports little-endian x86-64 and i386 execution environments using the
+System V application binary interface. 64-bit is the default mode,
+32-bit mode is specified with the
+.Fl s
+option.
+.Pp
+When writing to the .bss section, specify the size of memory reserved
+using the
+.Fl m
+option.
+If the size is zero (default), no .bss section will be written for the
+executable.
+.Pp
+In 64-bit mode the .bss and .text sections start at 0x402000 and
+0x401000 respectively, and in 32-bit mode 0x804a000 and 0x8049000
+respectively.
+Program header segment alignment is set to 0x1000 (the page size on most
+systems).
+.Pp
+ .bss is aligned to a 16-byte constraint and .text to an 8-byte
+constraint.
+.Sh AUTHORS
+.Nm mcc
+was written by
+.An Esote
+.Sh COPYRIGHT
+Copyright (c) 2019 Esote.
+There is NO warranty.
+You may redistribute this software under the terms of the GNU Affero General
+Public License.
+For more information, see the LICENSE file.
diff --git a/mcc.c b/mcc.c
index 8da5209..4e526d3 100644
--- a/mcc.c
+++ b/mcc.c
@@ -86,8 +86,7 @@ main(int argc, char *argv[])
 			break;
 		default:
 			(void)fprintf(stderr,
-				"usage: %s [-3s] [-m memsize] [-o file] "
-				"[file]\n",
+				"usage: %s [-3s] [-m memsize] [-o file] file\n",
 				argv[0]);
 			return 1;
 		}