scc, branch HEADsimple c99 compiler
4f498a90ad9f907eb9be6a09f79bdca9b3b14bce2024-10-16T20:02:01Z2024-10-16T20:05:44Ztests: Use command -v to find the assemblerRoberto E. Vargas Caballerok0ga@shike2.comcommit 4f498a90ad9f907eb9be6a09f79bdca9b3b14bce
parent 64f3c7719d5c78a2fb962d66ec7d04f7bb15db8f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 22:02:01 +0200
tests: Use command -v to find the assembler
Some shells are generating an error in stderr when
the assembler is not found, and it is better to use
command instead of trying to execute the assembler
with an empty file.
64f3c7719d5c78a2fb962d66ec7d04f7bb15db8f2024-10-16T15:42:49Z2024-10-16T15:42:49Zlibmach/coff32: Accept empty rels and linesRoberto E. Vargas Caballerok0ga@shike2.comcommit 64f3c7719d5c78a2fb962d66ec7d04f7bb15db8f
parent 961ee6c2ea156ff13f4dc54ddde5f1e9e4cffe35
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 17:42:49 +0200
libmach/coff32: Accept empty rels and lines
A stripped file don't have relocation and line info,
and in that case the pointers rels and lines are
NULL and they cannot be indirected.
961ee6c2ea156ff13f4dc54ddde5f1e9e4cffe352024-10-16T15:16:47Z2024-10-16T15:16:47Ztests/cc: Update 0018-voidparamRoberto E. Vargas Caballerok0ga@shike2.comcommit 961ee6c2ea156ff13f4dc54ddde5f1e9e4cffe35
parent 5cc95d70ec0a2797cc70e3900f0cb4e18e0c9adf
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 17:16:47 +0200
tests/cc: Update 0018-voidparam
After the commit be306281 this test has new detected errors.
5cc95d70ec0a2797cc70e3900f0cb4e18e0c9adf2024-10-16T15:03:09Z2024-10-16T15:03:09Ztests/libc: Remove 2nd test of 0017-strerrorRoberto E. Vargas Caballerok0ga@shike2.comcommit 5cc95d70ec0a2797cc70e3900f0cb4e18e0c9adf
parent 73eaa8badc9c987348ad6e739bc424ef959d9cb3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 17:03:09 +0200
tests/libc: Remove 2nd test of 0017-strerror
We don't have any warranty that all the values between 1 to
EUNKNOWN have a related string. The correct semantic is that
all the errno values returned by libc functions have a string
associated.
73eaa8badc9c987348ad6e739bc424ef959d9cb32024-10-16T15:00:25Z2024-10-16T15:00:25Ztests/ar: Don't use exit in the trapRoberto E. Vargas Caballerok0ga@shike2.comcommit 73eaa8badc9c987348ad6e739bc424ef959d9cb3
parent f7dc4baf7faaa0f70d7f6406c298e97c7323e776
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 17:00:25 +0200
tests/ar: Don't use exit in the trap
Using exit in the trap was overwriting the actual return
value from the shell script making that the tests were always
returning passing tests.
f7dc4baf7faaa0f70d7f6406c298e97c7323e7762024-10-16T14:37:44Z2024-10-16T14:37:44Zbuild: Don't use uname to select the archRoberto E. Vargas Caballerok0ga@shike2.comcommit f7dc4baf7faaa0f70d7f6406c298e97c7323e776
parent 1799a1ccb0dd9a37ef08ac768c495d1b497cd9c0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 16:37:44 +0200
build: Don't use uname to select the arch
Using uname to select the arch make impossible to cross compile,
and currently we are using a config target to autodetect the
host configuration as default configuration.
1799a1ccb0dd9a37ef08ac768c495d1b497cd9c02024-10-16T14:21:00Z2024-10-16T14:21:00Ztests/libc: Add include to get atoi() declarationRoberto E. Vargas Caballerok0ga@shike2.comcommit 1799a1ccb0dd9a37ef08ac768c495d1b497cd9c0
parent 2e9e1c983fcb90689350f0d8783bae8ef4dfae31
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 16:21:00 +0200
tests/libc: Add include to get atoi() declaration
2e9e1c983fcb90689350f0d8783bae8ef4dfae312024-10-16T13:26:45Z2024-10-16T13:26:45Ztests/libc: Add va_copy test to 0009-stdargRoberto E. Vargas Caballerok0ga@shike2.comcommit 2e9e1c983fcb90689350f0d8783bae8ef4dfae31
parent 3c7a64d19b6654f885beeef04dca15952066c615
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 15:26:45 +0200
tests/libc: Add va_copy test to 0009-stdarg
3c7a64d19b6654f885beeef04dca15952066c6152024-10-16T13:10:16Z2024-10-16T13:10:16Ztests/libc: Enable trap cleanupRoberto E. Vargas Caballerok0ga@shike2.comcommit 3c7a64d19b6654f885beeef04dca15952066c615
parent 686135e189c882b2b3e9f7837b002127be743ee1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 15:10:16 +0200
tests/libc: Enable trap cleanup
686135e189c882b2b3e9f7837b002127be743ee12024-10-16T13:09:23Z2024-10-16T13:09:23Ztests/libc: Fill 0017-strerrorRoberto E. Vargas Caballerok0ga@shike2.comcommit 686135e189c882b2b3e9f7837b002127be743ee1
parent 158e115b8b90463541073616f288f5b8b23a7490
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 15:09:23 +0200
tests/libc: Fill 0017-strerror
158e115b8b90463541073616f288f5b8b23a74902024-10-16T09:21:24Z2024-10-16T09:21:24Ztests/libc: Return 0 in main for 0007-signalRoberto E. Vargas Caballerok0ga@shike2.comcommit 158e115b8b90463541073616f288f5b8b23a7490
parent a4e5aceb7b07d0a5e0b2d80e674a84515ed56318
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 11:21:24 +0200
tests/libc: Return 0 in main for 0007-signal
a4e5aceb7b07d0a5e0b2d80e674a84515ed563182024-10-16T09:12:27Z2024-10-16T09:12:27Ztests/libc: Select path to gcc-sccRoberto E. Vargas Caballerok0ga@shike2.comcommit a4e5aceb7b07d0a5e0b2d80e674a84515ed56318
parent f28394385a32f7729620977bf5c3f09cec07f6de
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 11:12:27 +0200
tests/libc: Select path to gcc-scc
The Makefile was using gcc-scc expecting it to be in the PATH, but
the correct soluction is to select the tool from the bin directory.
Also, gcc-scc was using gcc, that it is not shipped anymore with
OpenBSD, and in this context we can assume that the system compiler
is cc.
f28394385a32f7729620977bf5c3f09cec07f6de2024-10-16T08:54:06Z2024-10-16T08:54:06Ztests/cc: Use scc in error/update.shRoberto E. Vargas Caballerok0ga@shike2.comcommit f28394385a32f7729620977bf5c3f09cec07f6de
parent 1dbce6a1af3146a9534cf84c1676923c00f5b090
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 10:54:06 +0200
tests/cc: Use scc in error/update.sh
Scc moves to be called scc long time ago.
1dbce6a1af3146a9534cf84c1676923c00f5b0902024-10-16T08:53:25Z2024-10-16T08:53:25Ztests/cc: Add error/0038-void.cRoberto E. Vargas Caballerok0ga@shike2.comcommit 1dbce6a1af3146a9534cf84c1676923c00f5b090
parent f9c47e070844f7752b18e63197f2819ce106386c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 10:53:25 +0200
tests/cc: Add error/0038-void.c
f9c47e070844f7752b18e63197f2819ce106386c2024-10-16T08:50:37Z2024-10-16T08:50:37Zcc1: Return from ctype()Roberto E. Vargas Caballerok0ga@shike2.comcommit f9c47e070844f7752b18e63197f2819ce106386c
parent be306281fac02e415d76081567520ffecad06adc
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 10:50:37 +0200
cc1: Return from ctype()
When an invalid case happen then we were calling error(), but we
can continue the execution and return int as default type when
an error happens.
be306281fac02e415d76081567520ffecad06adc2024-10-16T08:46:21Z2024-10-16T08:46:21Zcc1: Improve wrong void detectionRoberto E. Vargas Caballerok0ga@shike2.comcommit be306281fac02e415d76081567520ffecad06adc
parent bbc13f1280dc042f22868c2565602f5b01c2873f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 10:46:21 +0200
cc1: Improve wrong void detection
In case of appearing must be the first and only parameter of
the prototype, and while the code had checks for it, they were
wrong and they were failling in the majority of cases.
bbc13f1280dc042f22868c2565602f5b01c2873f2024-10-16T08:31:15Z2024-10-16T08:31:15Zcc1: Fix empty param list in newtype()Roberto E. Vargas Caballerok0ga@shike2.comcommit bbc13f1280dc042f22868c2565602f5b01c2873f
parent 010fd7349f3e3baeeea0344175cd351dd4692904
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 16 Oct 2024 10:31:15 +0200
cc1: Fix empty param list in newtype()
When a function does not have parameters (a void function)
then tp->n.elem is 0, and it was calling malloc with a size
of 0 and then later in eqfunc() we are accessing the pointer
returned by malloc(). It happens to work in linux, but
obviously, it was wrong.
Also, the malloc() call didn't allocate space for the NULL
pointer that must finish the list and it was expected by
eqfunc().
010fd7349f3e3baeeea0344175cd351dd46929042024-10-11T15:12:16Z2024-10-11T15:12:16ZMerge remote-tracking branch 'origin/master'Roberto E. Vargas Caballerok0ga@shike2.comcommit 010fd7349f3e3baeeea0344175cd351dd4692904
parent 53efcfa08238d8cd1d7b0db2a936a7a9f43c486e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 11 Oct 2024 17:12:16 +0200
Merge remote-tracking branch 'origin/master'
53efcfa08238d8cd1d7b0db2a936a7a9f43c486e2024-10-11T15:09:31Z2024-10-11T15:09:31Zbuild: Use -fno-stack-protector only for libcRoberto E. Vargas Caballerok0ga@shike2.comcommit 53efcfa08238d8cd1d7b0db2a936a7a9f43c486e
parent 54a70620b35380cf2ad6e225e6f8fdc522e6848a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 11 Oct 2024 17:09:31 +0200
build: Use -fno-stack-protector only for libc
We require no pie and without stack protector only for the libc,
because we want to link the libc with the output of qbe that is
not pie. Also, the libc does not support the symbols required
by the stack protector functionality from gcc, and for that reason
we have to disable it.
ebad24d45a3e5159cadad1fbde57a8a4bd09c36f2024-10-10T10:26:06Z2024-10-10T10:26:06Zbuild/obsd: Remove unneeded _ANSI_SOURCERoberto E. Vargas Caballerok0ga@shike2.comcommit ebad24d45a3e5159cadad1fbde57a8a4bd09c36f
parent 8adb487c31627692c9e706a5756b38fb54193be3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 10 Oct 2024 12:26:06 +0200
build/obsd: Remove unneeded _ANSI_SOURCE
8adb487c31627692c9e706a5756b38fb54193be32024-10-10T10:25:30Z2024-10-10T10:25:30Zcc1: Fix plus 1 error terminating stringRoberto E. Vargas Caballerok0ga@shike2.comcommit 8adb487c31627692c9e706a5756b38fb54193be3
parent 54a70620b35380cf2ad6e225e6f8fdc522e6848a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 10 Oct 2024 12:25:30 +0200
cc1: Fix plus 1 error terminating string
54a70620b35380cf2ad6e225e6f8fdc522e6848a2024-10-10T06:17:13Z2024-10-10T06:17:13ZMerge remote-tracking branch 'origin/master'Roberto E. Vargas Caballerok0ga@shike2.comcommit 54a70620b35380cf2ad6e225e6f8fdc522e6848a
parent 576fe84ed449291c5f3cb5b7a343cf92c00357ac
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 10 Oct 2024 08:17:13 +0200
Merge remote-tracking branch 'origin/master'
0ffa0e87ba113efd5d460be30c66cb11e1d17f3b2024-10-09T15:06:49Z2024-10-09T15:12:17Zbuild/bsd: Remove _ANSI_SOURCERoberto E. Vargas Caballerok0ga@shike2.comcommit 0ffa0e87ba113efd5d460be30c66cb11e1d17f3b
parent b26d16ddb425936fa71459860708c5b6747b4458
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 9 Oct 2024 17:06:49 +0200
build/bsd: Remove _ANSI_SOURCE
_ISOC99_SOURCE should already do the good job and it made NetBSD
failed in scc-make.
b26d16ddb425936fa71459860708c5b6747b44582024-10-09T15:05:39Z2024-10-09T15:12:05Zbuild: Generate cstd.h in configRoberto E. Vargas Caballerok0ga@shike2.comcommit b26d16ddb425936fa71459860708c5b6747b4458
parent 4b12fe6bce151c8f1d4d7d65a0b2461fc0f780af
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 9 Oct 2024 17:05:39 +0200
build: Generate cstd.h in config
This file is almost never modified, and the make from NetBSD
had some problems building it so the best solution is just
to generate it in config that is always checked.
4b12fe6bce151c8f1d4d7d65a0b2461fc0f780af2024-10-09T08:38:10Z2024-10-09T08:38:10Zbuild: Add paralelism to libc buildsRoberto E. Vargas Caballerok0ga@shike2.comcommit 4b12fe6bce151c8f1d4d7d65a0b2461fc0f780af
parent 2f9ee2943948454638d724feeacbbae63a63179c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 9 Oct 2024 10:38:10 +0200
build: Add paralelism to libc builds
The + command modifier has a side effect which enables parallel
build for the submake.
2f9ee2943948454638d724feeacbbae63a63179c2024-10-09T08:29:26Z2024-10-09T08:29:26Zbuild: Run config target with detected configurationRoberto E. Vargas Caballerok0ga@shike2.comcommit 2f9ee2943948454638d724feeacbbae63a63179c
parent 06a981d5ab044c5d73dd22d4420d4daa4b8c6f33
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 9 Oct 2024 10:29:26 +0200
build: Run config target with detected configuration
The flag NOPIE_FLAGS is set by the configuration script,
but the target config was not executed under the environment
generated by the config tool. This was creating a problem in
OpenBSD because it was executing the linker with pie creating
problems with the symbold end.
576fe84ed449291c5f3cb5b7a343cf92c00357ac2024-10-08T14:44:26Z2024-10-08T14:44:26Ztests/cc: Enable passing TODO testsRoberto E. Vargas Caballerok0ga@shike2.comcommit 576fe84ed449291c5f3cb5b7a343cf92c00357ac
parent 06a981d5ab044c5d73dd22d4420d4daa4b8c6f33
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 8 Oct 2024 16:44:26 +0200
tests/cc: Enable passing TODO tests
06a981d5ab044c5d73dd22d4420d4daa4b8c6f332024-10-08T14:22:16Z2024-10-08T14:22:16Zdoc: Add external QBE referenceRoberto E. Vargas Caballerok0ga@shike2.comcommit 06a981d5ab044c5d73dd22d4420d4daa4b8c6f33
parent ec6ce1e2a23d42e52697de6cb108d81edd1c0c0e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 8 Oct 2024 16:22:16 +0200
doc: Add external QBE reference
QBE is not anymore shipped with scc and it has to be installed
in the system.
ec6ce1e2a23d42e52697de6cb108d81edd1c0c0e2024-10-08T13:05:02Z2024-10-08T13:07:19ZRevert "cc1: Fix lexer for strings"Roberto E. Vargas Caballerok0ga@shike2.comcommit ec6ce1e2a23d42e52697de6cb108d81edd1c0c0e
parent 4ed4dac59ff781ba4bd54db585c2384595e175dc
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 8 Oct 2024 15:05:02 +0200
Revert "cc1: Fix lexer for strings"
This reverts commit eb8960812d92714eb568df36e09d8c76af5cd46c.
4ed4dac59ff781ba4bd54db585c2384595e175dc2024-10-08T10:51:19Z2024-10-08T10:51:19Zcc1: Fix sizeof expressionsRoberto E. Vargas Caballerok0ga@shike2.comcommit 4ed4dac59ff781ba4bd54db585c2384595e175dc
parent eb28f98e61cf995a7c1f9c85faf3431438018e03
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 8 Oct 2024 12:51:19 +0200
cc1: Fix sizeof expressions
The commit c863f707 tried to fix expressions like:
sizeof((int) 1)
and changed the reduction in sizeexp() from unary to cast,
but it had the side effect of allowing things like
sizeof (int) 1
that is invalid, and having problems with things like
sizeof "hello" - 1
The commit 4a0c2ccd tried to fix this last case reverting c863f707
that moved the code to the original point. The problem is that
to avoid the ambiguity when a '(' follows a sizeof (because
it can be a typename or an expression) then the rule chain
unary
-> SIZEOF unary
-> SIZEOF postfix
-> SIZEOF primary
-> SIZEOF ( expr )
was collapsed to
unary
-> SIZEOF ( unary )
because when a ( happend after a SIZEOF token then the next token
was looked to see if it was a typename or not to decide to apply
the chain:
unary
-> SIZEOF ( typename )
And it can be seen the problem is that the collapsing was wrong
because we should have SIZEOF ( expr ) instead of SIZEOF ( unary ),
but still SIZEOF unary when no ( follows the SIZEOF token.
eb28f98e61cf995a7c1f9c85faf3431438018e032024-10-08T08:17:50Z2024-10-08T10:41:18Zbuild: Remove qbe forkRoberto E. Vargas Caballerok0ga@shike2.comcommit eb28f98e61cf995a7c1f9c85faf3431438018e03
parent 856d3c7dbd889b25f3e5be8559f67ab3f65a0384
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 8 Oct 2024 10:17:50 +0200
build: Remove qbe fork
As mainstream qbe already supports common we don't have to maintain
our copy of qbe anymore and we can use the mainstream version,
which incorporated many new features and architectures.
856d3c7dbd889b25f3e5be8559f67ab3f65a03842024-10-07T16:27:00Z2024-10-08T10:41:18Zbuild: Do not target outer directoriesRoberto E. Vargas Caballerok0ga@shike2.comcommit 856d3c7dbd889b25f3e5be8559f67ab3f65a0384
parent 36b8769dd5c503c420bb9404c0f0c2d4bfd2db82
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 18:27:00 +0200
build: Do not target outer directories
Having rules that build things out of the current directory makes
everything more difficult, because when building in nested directories
then you have the binary in a different directory. Also, having the /
character in a target is not portable.
36b8769dd5c503c420bb9404c0f0c2d4bfd2db822024-10-07T15:18:31Z2024-10-07T15:18:31Ztests/cc: Add 0227-sizeof testRoberto E. Vargas Caballerok0ga@shike2.comcommit 36b8769dd5c503c420bb9404c0f0c2d4bfd2db82
parent 4a0c2ccd2a49423967a9f0826bdfc012739327c7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 17:18:31 +0200
tests/cc: Add 0227-sizeof test
4a0c2ccd2a49423967a9f0826bdfc012739327c72024-10-07T15:15:05Z2024-10-07T15:15:05Zcc1: Reduce to unary for sizeof expressionsRoberto E. Vargas Caballerok0ga@shike2.comcommit 4a0c2ccd2a49423967a9f0826bdfc012739327c7
parent eb8960812d92714eb568df36e09d8c76af5cd46c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 17:15:05 +0200
cc1: Reduce to unary for sizeof expressions
The grammar is clear and sizeof applies to a unary expression,
but the code was reducing to a cast expression, creating problems
with expresions like:
sizeof "hello" - 1
or accepting invalid expressions like:
sizeof (char *) 3
eb8960812d92714eb568df36e09d8c76af5cd46c2024-10-07T15:12:58Z2024-10-07T15:12:58Zcc1: Fix lexer for stringsRoberto E. Vargas Caballerok0ga@shike2.comcommit eb8960812d92714eb568df36e09d8c76af5cd46c
parent 9057ad5dbe07ea11e717cc08f69a26bd7e6abc60
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 17:12:58 +0200
cc1: Fix lexer for strings
There were some leftovers from older versions of the code and
the logic was inverted, making that escape sequences were wrongly
processed.
9057ad5dbe07ea11e717cc08f69a26bd7e6abc602024-10-07T15:10:00Z2024-10-07T15:10:00Zcc1: Fix parsing of octal escape sequencesRoberto E. Vargas Caballerok0ga@shike2.comcommit 9057ad5dbe07ea11e717cc08f69a26bd7e6abc60
parent 03dbb2f6ade20e9de9f3128f92c5a5496cf4183b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 17:10:00 +0200
cc1: Fix parsing of octal escape sequences
The octal escape sequences begins with a \ followed with a
number from 0 to 7 (as much 3 digits), but the code was expecting
\0 (due to a confusion with octal int constants that must begin
with a 0).
03dbb2f6ade20e9de9f3128f92c5a5496cf4183b2024-10-07T14:40:58Z2024-10-07T14:40:58Zcc1: Don't use strlen concatenating stringsRoberto E. Vargas Caballerok0ga@shike2.comcommit 03dbb2f6ade20e9de9f3128f92c5a5496cf4183b
parent 438fb6e08b28ac019fb017c5caf1967ef51d0e1f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 16:40:58 +0200
cc1: Don't use strlen concatenating strings
Adjacents strings must be concatenated, but the process was assuming
strings without embeddeding NUL characters (using strlen), but this
is not true as they can be embedded using character escape sequences.
For that reason we have to use the number of elements defined in the
type associated to the string constant.
438fb6e08b28ac019fb017c5caf1967ef51d0e1f2024-10-07T10:00:59Z2024-10-07T14:34:16Zbuild: Fix OpenBSD buildRoberto E. Vargas Caballerok0ga@shike2.comcommit 438fb6e08b28ac019fb017c5caf1967ef51d0e1f
parent 7541da3df27d27b30d7639c25dfbd0c192ddbd91
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Oct 2024 12:00:59 +0200
build: Fix OpenBSD build
OpenBSD lacks c99 compiler, and while it was handled correctly
in the target build, it was not handled correctly from the point
of view the host compiler and in the qbe build.
7541da3df27d27b30d7639c25dfbd0c192ddbd912024-04-13T19:51:44Z2024-04-15T09:05:09Ztests/cc: Fix 0225-func.c pointer typeMichael Forneymforney@mforney.orgcommit 7541da3df27d27b30d7639c25dfbd0c192ddbd91
parent 9f372e48c6cfbe30974069e3343a856135e43a47
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 13 Apr 2024 12:51:44 -0700
tests/cc: Fix 0225-func.c pointer type
According to C99 6.4.2.2p1, __func__ is declared as array of const
char, so when used as an initializer, it is converted to const char *.
An initializer for a scalar follows the same type constraints as
simple assignment, which for pointers requires that both are to
compatible types, and char and const char are not compatible since
the have different qualifiers.
9f372e48c6cfbe30974069e3343a856135e43a472024-03-26T07:36:44Z2024-03-26T07:36:44Ztests/cc: Fix 0155-struct_complRoberto E. Vargas Caballerok0ga@shike2.comcommit 9f372e48c6cfbe30974069e3343a856135e43a47
parent 15705a1447f2bcefc6839f272791bf1a78025174
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 26 Mar 2024 08:36:44 +0100
tests/cc: Fix 0155-struct_compl
The variable x was not defined in any place and the comparision in main
was inverted making it true only when &x was NULL.
15705a1447f2bcefc6839f272791bf1a780251742024-03-26T07:17:33Z2024-03-26T07:28:17Ztests/cc: Remove zero-sized array in 0166-desig.cMichael Forneymforney@mforney.orgcommit 15705a1447f2bcefc6839f272791bf1a78025174
parent 304a60f868d56b3a9fc6925d957526899ae55eb6
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 26 Mar 2024 00:17:33 -0700
tests/cc: Remove zero-sized array in 0166-desig.c
Empty initializers aren't valid in C before C23, and in C23 they
aren't allowed to initialize arrays with unknown size.
304a60f868d56b3a9fc6925d957526899ae55eb62024-03-26T06:43:29Z2024-03-26T07:11:53Ztests/cc: Don't use compound literal in file scope struct initializerMichael Forneymforney@mforney.orgcommit 304a60f868d56b3a9fc6925d957526899ae55eb6
parent 1d8969baa52c6ee8981869fd67c8c22cd0707fad
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 25 Mar 2024 23:43:29 -0700
tests/cc: Don't use compound literal in file scope struct initializer
Compound literal expressions are not necessarily constant expressions.
1d8969baa52c6ee8981869fd67c8c22cd0707fad2024-03-26T06:32:30Z2024-03-26T06:41:58Ztests/cc: Fix loop condition in execute/0169-string.c cmp() functionMichael Forneymforney@mforney.orgcommit 1d8969baa52c6ee8981869fd67c8c22cd0707fad
parent da15e0d9945be83baead323b081ec436d5852b57
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 25 Mar 2024 23:32:30 -0700
tests/cc: Fix loop condition in execute/0169-string.c cmp() function
We want to check that the strings are the same, not that every
character is different.
da15e0d9945be83baead323b081ec436d5852b572024-03-22T07:29:02Z2024-03-22T07:29:02Zbuild: Add make/deps.mkRoberto E. Vargas Caballerok0ga@shike2.comcommit da15e0d9945be83baead323b081ec436d5852b57
parent c63c6229624807c6248faa5e396a65cb0bdff70f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 08:29:02 +0100
build: Add make/deps.mk
c63c6229624807c6248faa5e396a65cb0bdff70f2024-03-22T07:16:56Z2024-03-22T07:25:38Zas: Initial function to write object filesRoberto E. Vargas Caballerok0ga@shike2.comcommit c63c6229624807c6248faa5e396a65cb0bdff70f
parent b72ae1daa29675c82e45d85776a40257a56241ff
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 08:16:56 +0100
as: Initial function to write object files
This is the first version of the function that writes an actual object
file instead of a dump of the different sections of the object.
b72ae1daa29675c82e45d85776a40257a56241ff2024-03-22T07:04:43Z2024-03-22T07:04:43Zlibmach/coff32: Avoid file pointer in non mapped sectionsRoberto E. Vargas Caballerok0ga@shike2.comcommit b72ae1daa29675c82e45d85776a40257a56241ff
parent d453c845befbaa9a03eb974df569ebd41c9d7a49
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 08:04:43 +0100
libmach/coff32: Avoid file pointer in non mapped sections
We have to avoid non mapped sections in the output file because there is
nothing to write to the output file.
d453c845befbaa9a03eb974df569ebd41c9d7a492024-03-22T07:02:16Z2024-03-22T07:02:16Zlibmach/coff32: Free lines and relocationsRoberto E. Vargas Caballerok0ga@shike2.comcommit d453c845befbaa9a03eb974df569ebd41c9d7a49
parent 38ab22d6380b1d1c6fa232fa2ee5ef42b4faa77d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 08:02:16 +0100
libmach/coff32: Free lines and relocations
Every section has a different set of line info and relocations, and for
that reason is required to free every groud independently but we were
freeing only the array of arrays.
38ab22d6380b1d1c6fa232fa2ee5ef42b4faa77d2024-03-22T04:12:04Z2024-03-22T04:12:04Zlibmach/coff32: Don't write non allocated sectionsRoberto E. Vargas Caballerok0ga@shike2.comcommit 38ab22d6380b1d1c6fa232fa2ee5ef42b4faa77d
parent 1d8b58777ed0e762dd3e79218ed951e05c5e2dff
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 05:12:04 +0100
libmach/coff32: Don't write non allocated sections
Sections not allocated don't have bytes in the output file, thus we have
to skip them we write the data section of them.
1d8b58777ed0e762dd3e79218ed951e05c5e2dff2024-03-22T04:09:37Z2024-03-22T04:09:37Zas: Set type of symbols associated to sectionsRoberto E. Vargas Caballerok0ga@shike2.comcommit 1d8b58777ed0e762dd3e79218ed951e05c5e2dff
parent fb3572d08e0fdc42b6432203085d3c84889159e2
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 05:09:37 +0100
as: Set type of symbols associated to sections
The type associated to a symbol related to a section is the same than
the type of the section itself, we only have to care about making the
symbol local to avoid collision with symbols from other objects.
fb3572d08e0fdc42b6432203085d3c84889159e22024-03-22T02:26:14Z2024-03-22T03:50:09Zbuild: Remove double scc scc indirectionRoberto E. Vargas Caballerok0ga@shike2.comcommit fb3572d08e0fdc42b6432203085d3c84889159e2
parent 49a15e6576f3227a8a94eca8a5e1a5fe60d2f86f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 03:26:14 +0100
build: Remove double scc scc indirection
Having a scc/scc directory was a bit inconvenient because
it didn't too much sense, and as curretly we have the bits
directory then we can reuse that directory for the same purpose.
This change also implies updating all the deps.mk files that were
anyway outdated.
49a15e6576f3227a8a94eca8a5e1a5fe60d2f86f2024-03-22T02:18:41Z2024-03-22T02:18:41Zas: Order default sections in expected orderRoberto E. Vargas Caballerok0ga@shike2.comcommit 49a15e6576f3227a8a94eca8a5e1a5fe60d2f86f
parent 4c8a466ddf23cf1db739c35b6cef305f053c83cb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 22 Mar 2024 03:18:41 +0100
as: Order default sections in expected order
Even when it is not actually required, the normal thing is to have text,
data and bss in this specific order, and it makes easier to compare the
results withs other assemblers.
4c8a466ddf23cf1db739c35b6cef305f053c83cb2024-03-21T09:41:29Z2024-03-21T09:41:29Zlibmach/coff32: Rename F_SYMS to F_LSYMSRoberto E. Vargas Caballerok0ga@shike2.comcommit 4c8a466ddf23cf1db739c35b6cef305f053c83cb
parent a10811325601d16f25a9afe146831e371b2fe076
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 21 Mar 2024 10:41:29 +0100
libmach/coff32: Rename F_SYMS to F_LSYMS
The documentation and other libraries use F_LSYMS and it is more
orthogonal with F_RELFLG and F_LMNO that use the letter L to mark
that they were stripped from the binary.
a10811325601d16f25a9afe146831e371b2fe0762024-03-21T08:06:28Z2024-03-21T08:06:28Zlibmach/coff32: REmove unneeded parameter in typeof()Roberto E. Vargas Caballerok0ga@shike2.comcommit a10811325601d16f25a9afe146831e371b2fe076
parent 29dc92ca622fc1a51d03db61131eed586fa370ab
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 21 Mar 2024 09:06:28 +0100
libmach/coff32: REmove unneeded parameter in typeof()
29dc92ca622fc1a51d03db61131eed586fa370ab2024-03-21T07:04:05Z2024-03-21T07:04:05Zas: Add symbols for every sectionRoberto E. Vargas Caballerok0ga@shike2.comcommit 29dc92ca622fc1a51d03db61131eed586fa370ab
parent c658360817ac84cd259dbff0ea836dac8b647ad1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 21 Mar 2024 08:04:05 +0100
as: Add symbols for every section
It is usually a good idea to have a symbol for every section because
relocations can reference them and because the code can use them
in some special cases.
c658360817ac84cd259dbff0ea836dac8b647ad12024-03-21T06:51:00Z2024-03-21T06:51:00Zas: Check that data and bss sections are readableRoberto E. Vargas Caballerok0ga@shike2.comcommit c658360817ac84cd259dbff0ea836dac8b647ad1
parent 7e58afa199c101cf286652c305ba91e63a8fc40c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 21 Mar 2024 07:51:00 +0100
as: Check that data and bss sections are readable
We should not consider a non readable section as bss or data. We
cannot check for writing because there are use cases where we want
to define read only data or bss sections.
7e58afa199c101cf286652c305ba91e63a8fc40c2024-03-21T06:43:35Z2024-03-21T06:43:35Zlibmach/coff32: Add setsym()Roberto E. Vargas Caballerok0ga@shike2.comcommit 7e58afa199c101cf286652c305ba91e63a8fc40c
parent 089001cf022662342949760e254ee19f09123350
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 21 Mar 2024 07:43:35 +0100
libmach/coff32: Add setsym()
This function is used to add a symbol to an object. Currently only
coff32 is supported and there are a lot of things that have to be
fixed, like for example the auxiliary entries.
089001cf022662342949760e254ee19f091233502024-03-21T06:24:06Z2024-03-21T06:29:34Zlibmach/coff32: Set f_symptr in coff2writeRoberto E. Vargas Caballerok0ga@shike2.comcommit 089001cf022662342949760e254ee19f09123350
parent 0f79c5f471ea50fbe25862dfdf257f2e93387ac9
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 21 Mar 2024 07:24:06 +0100
libmach/coff32: Set f_symptr in coff2write
The file f_symptr is a file offset that points to the symbol table, and
in case of having a symbol table it must be correctly set, but it was not.
0f79c5f471ea50fbe25862dfdf257f2e93387ac92024-03-16T09:23:44Z2024-03-16T09:23:44Zas: Fix section creationRoberto E. Vargas Caballerok0ga@shike2.comcommit 0f79c5f471ea50fbe25862dfdf257f2e93387ac9
parent f60f2f1a36f05d3352dad82bcddee3b4b0cac883
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 16 Mar 2024 10:23:44 +0100
as: Fix section creation
Parsing of section attributes mut be done only once, otherwise
we can have redifinition problems. Also, there was a confusion
between ALLOC and LOAD, while ALLOC means that memory space is
allocted for the region while LOAD menas that bytes are loaded
from the file.
f60f2f1a36f05d3352dad82bcddee3b4b0cac8832024-03-15T19:21:43Z2024-03-15T19:21:43Zlibmach: Remove whitespaceRoberto E. Vargas Caballerok0ga@shike2.comcommit f60f2f1a36f05d3352dad82bcddee3b4b0cac883
parent e082102024dc1b108b686cc7b0a5dcd4d4da3185
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 15 Mar 2024 20:21:43 +0100
libmach: Remove whitespace
e082102024dc1b108b686cc7b0a5dcd4d4da31852024-03-15T19:20:58Z2024-03-15T19:20:58Zas: Fix error checking calling setsec()Roberto E. Vargas Caballerok0ga@shike2.comcommit e082102024dc1b108b686cc7b0a5dcd4d4da3185
parent 76e99b74c0360b4b3c379339d64b0e873ad675ff
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 15 Mar 2024 20:20:58 +0100
as: Fix error checking calling setsec()
It returns NULL in case of error.
76e99b74c0360b4b3c379339d64b0e873ad675ff2024-03-15T12:37:55Z2024-03-15T12:37:55Zbuild: Fix uninstall target in arm64Roberto E. Vargas Caballerok0ga@shike2.comcommit 76e99b74c0360b4b3c379339d64b0e873ad675ff
parent 8bf178a38c08e806575890b7d97173b996b77d64
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 15 Mar 2024 13:37:55 +0100
build: Fix uninstall target in arm64
The target uninstall-arm64 was duplicated because
uninstall-aarch64 was missed.
8bf178a38c08e806575890b7d97173b996b77d642024-03-15T12:36:14Z2024-03-15T12:36:14ZMerge remote-tracking branch 'origin/master' into coffRoberto E. Vargas Caballerok0ga@shike2.comcommit 8bf178a38c08e806575890b7d97173b996b77d64
parent 0b5f87dcd9ac36f700c7718168e6378e90cb95fe
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 15 Mar 2024 13:36:14 +0100
Merge remote-tracking branch 'origin/master' into coff
0b5f87dcd9ac36f700c7718168e6378e90cb95fe2024-03-12T17:45:08Z2024-03-15T12:36:05Zlibc/arm64: Remove invalid int typeRoberto E. Vargas Caballerok0ga@shike2.comcommit 0b5f87dcd9ac36f700c7718168e6378e90cb95fe
parent 41f4e8a8414c3db705b3c730f933e8a980110f91
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Mar 2024 18:45:08 +0100
libc/arm64: Remove invalid int type
The definition of uint_fast8_t had an invalid "int"
that didn't make sense at all there.
13fabd7c1b99fc97c8fe9cfb58f4e898eb8599f92024-03-13T08:40:18Z2024-03-13T08:40:18Zlibc/arm64: Add include/bits/linux/arm64/arch/sigaction.hRoberto E. Vargas Caballerok0ga@shike2.comcommit 13fabd7c1b99fc97c8fe9cfb58f4e898eb8599f9
parent 82ea1289e2b1c663ec893ccf26ee48da023374d6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 13 Mar 2024 09:40:18 +0100
libc/arm64: Add include/bits/linux/arm64/arch/sigaction.h
82ea1289e2b1c663ec893ccf26ee48da023374d62024-03-12T18:10:17Z2024-03-12T18:10:17Zlibc: Fix name of __sigaction objectRoberto E. Vargas Caballerok0ga@shike2.comcommit 82ea1289e2b1c663ec893ccf26ee48da023374d6
parent 11aa13ade5645840f9d2d0fe42b778afa457eb9b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Mar 2024 19:10:17 +0100
libc: Fix name of __sigaction object
The syscall is named __sigaction because the file
src/libc/arch/linux/_sigaction.c has the wrapper over the syscall
to provide the expected generic interface.
11aa13ade5645840f9d2d0fe42b778afa457eb9b2024-03-12T17:54:51Z2024-03-12T17:54:51Zlibc/arm64: Add missed $sys/arch/inttypes.hRoberto E. Vargas Caballerok0ga@shike2.comcommit 11aa13ade5645840f9d2d0fe42b778afa457eb9b
parent fac3afee5f050f7ac9294584a98e8614cd0be2ff
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Mar 2024 18:54:51 +0100
libc/arm64: Add missed $sys/arch/inttypes.h
fac3afee5f050f7ac9294584a98e8614cd0be2ff2024-03-12T17:45:08Z2024-03-12T17:48:19Zlibc/arm64: Remove invalid int typeRoberto E. Vargas Caballerok0ga@shike2.comcommit fac3afee5f050f7ac9294584a98e8614cd0be2ff
parent 1156602edeb3876e50b1b8a3f038f0b4cae41e27
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Mar 2024 18:45:08 +0100
libc/arm64: Remove invalid int type
The definition of uint_fast8_t had an invalid "int"
that didn't make sense at all there.
1156602edeb3876e50b1b8a3f038f0b4cae41e272024-03-12T17:43:33Z2024-03-12T17:48:19Zbuild: Fix scripts/arm64.mkRoberto E. Vargas Caballerok0ga@shike2.comcommit 1156602edeb3876e50b1b8a3f038f0b4cae41e27
parent edd82a7380825ecc35d98c0db5ae602b977d3cbd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Mar 2024 18:43:33 +0100
build: Fix scripts/arm64.mk
This script was missing the targets for the aarch64 names, covering
only the cases where arm64 was used.
41f4e8a8414c3db705b3c730f933e8a980110f912024-03-10T15:30:58Z2024-03-10T15:39:33Zlibmach: Initialize coff file header in objnew()Roberto E. Vargas Caballerok0ga@shike2.comcommit 41f4e8a8414c3db705b3c730f933e8a980110f91
parent cb8145813e5414d66e2416feb0026f3d70ae9abb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 10 Mar 2024 16:30:58 +0100
libmach: Initialize coff file header in objnew()
This is needed if we want to write a new object file instead
of just reading an already created object file.
cb8145813e5414d66e2416feb0026f3d70ae9abb2024-03-10T12:30:50Z2024-03-10T12:40:37Zlibscc: Add system dependant functionsRoberto E. Vargas Caballerok0ga@shike2.comcommit cb8145813e5414d66e2416feb0026f3d70ae9abb
parent edd82a7380825ecc35d98c0db5ae602b977d3cbd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 10 Mar 2024 13:30:50 +0100
libscc: Add system dependant functions
These functions were placed in src/cmd/posix.c and it made
impossible to reuse them from a different place, for example
from libmach. To solve this problem all the functions were
moved to libscc to share them between all the modules.
edd82a7380825ecc35d98c0db5ae602b977d3cbd2024-03-09T10:08:48Z2024-03-09T10:08:48Zdoc: Clarify use of HOST, CONF and TOOLRoberto E. Vargas Caballerok0ga@shike2.comcommit edd82a7380825ecc35d98c0db5ae602b977d3cbd
parent b0b4485f6041a17dca20687a2e78002f7451e087
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 9 Mar 2024 11:08:48 +0100
doc: Clarify use of HOST, CONF and TOOL
These values get the correct value in the default target based
in the value of uname, so they don't have to be set manually.
b0b4485f6041a17dca20687a2e78002f7451e0872024-03-09T09:45:39Z2024-03-09T09:45:39Zbuild: Translate between aarch64 and amd64Roberto E. Vargas Caballerok0ga@shike2.comcommit b0b4485f6041a17dca20687a2e78002f7451e087
parent 38abc9a2afdbbac7dc6a0019212d71959d99fccd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 9 Mar 2024 10:45:39 +0100
build: Translate between aarch64 and amd64
Some linux distributions use aarch64 while other systems use
arm64 and scc decided to use arm64, and for that reason it
is required a translation between them.
38abc9a2afdbbac7dc6a0019212d71959d99fccd2024-03-05T08:46:13Z2024-03-05T08:46:13Zlibmach: Fix flags for coff read onlyRoberto E. Vargas Caballerok0ga@shike2.comcommit 38abc9a2afdbbac7dc6a0019212d71959d99fccd
parent 1542722ccdfba37389ccc09fb382df9f975e70e6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 5 Mar 2024 09:46:13 +0100
libmach: Fix flags for coff read only
The section types STYP_LIT and STYP_RDATA are read only
and they should not have write attributes.
1542722ccdfba37389ccc09fb382df9f975e70e62024-03-05T08:40:57Z2024-03-05T08:40:57Zas: Create object and attach sectionsRoberto E. Vargas Caballerok0ga@shike2.comcommit 1542722ccdfba37389ccc09fb382df9f975e70e6
parent 5fb4bf82c962c831624ee7d1c1c1e75bf67291d8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 5 Mar 2024 09:40:57 +0100
as: Create object and attach sections
This is a first step to be able to write out an actual binary
and not the dump that we are doing now.
5fb4bf82c962c831624ee7d1c1c1e75bf67291d82024-03-05T08:35:45Z2024-03-05T08:35:45Zlibmach: Add setsec()Roberto E. Vargas Caballerok0ga@shike2.comcommit 5fb4bf82c962c831624ee7d1c1c1e75bf67291d8
parent a5b21461738ce6ca8c80071ef594e931c77ffbe4
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 5 Mar 2024 09:35:45 +0100
libmach: Add setsec()
This function allows to inject a section in the object
described by the generic section interface. As there is
not a perfect mach between the generic struct and the
object struct then some heuristics have to be applied
to be able to transform between then. Anyway, there will
be cases when the assembler and the loader will have to
uses directly object types.
a5b21461738ce6ca8c80071ef594e931c77ffbe42024-03-05T08:13:51Z2024-03-05T08:13:51Zas: Remove unused cmp()Roberto E. Vargas Caballerok0ga@shike2.comcommit a5b21461738ce6ca8c80071ef594e931c77ffbe4
parent d394111bab814e96386aaf55023f26a4c59140e6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 5 Mar 2024 09:13:51 +0100
as: Remove unused cmp()
d394111bab814e96386aaf55023f26a4c59140e62024-03-04T09:30:15Z2024-03-04T09:30:15Zdoc: Fix typo in READMERoberto E. Vargas Caballerok0ga@shike2.comcommit d394111bab814e96386aaf55023f26a4c59140e6
parent 226c9b6665ee5cb3d0f50fad4be66a339af4f1d7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 4 Mar 2024 10:30:15 +0100
doc: Fix typo in README
226c9b6665ee5cb3d0f50fad4be66a339af4f1d72024-02-15T15:59:28Z2024-02-15T15:59:28Zlibmach: Add objtype()Roberto E. Vargas Caballerok0ga@shike2.comcommit 226c9b6665ee5cb3d0f50fad4be66a339af4f1d7
parent b0a24eced82c3e643a2722a1d8560338b653a51e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 16:59:28 +0100
libmach: Add objtype()
This function translate a textual description of a binary format
into the integer representation of that format that can be used
with newobj() to create a new object.
b0a24eced82c3e643a2722a1d8560338b653a51e2024-02-15T15:09:15Z2024-02-15T15:09:15Zlibmach: Fix objprobe()Roberto E. Vargas Caballerok0ga@shike2.comcommit b0a24eced82c3e643a2722a1d8560338b653a51e
parent 0743502801e60e87b15b2af32a314684f66fb472
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 16:09:15 +0100
libmach: Fix objprobe()
It was supposed to return the type encoding but it
was returning only the object position in the
object array that just happened to have the correct
byte order that we are testing and no arch,
but as we are not using arch for anything yet then
it didn't fail.
0743502801e60e87b15b2af32a314684f66fb4722024-02-15T14:18:49Z2024-02-15T14:18:49Zlibmach: Rename objtype() to objprobe()Roberto E. Vargas Caballerok0ga@shike2.comcommit 0743502801e60e87b15b2af32a314684f66fb472
parent b6459c65a740c350d9088c2e383909b035790b00
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 15:18:49 +0100
libmach: Rename objtype() to objprobe()
This function was actually probing and the name is better for a
functions that translate a string representation of the type to the
integer value used.
b6459c65a740c350d9088c2e383909b035790b002024-02-15T09:21:40Z2024-02-15T10:10:19Zlibmach: Remove pc from SectionRoberto E. Vargas Caballerok0ga@shike2.comcommit b6459c65a740c350d9088c2e383909b035790b00
parent d35d5fe22f66775de64c768ab1271430dbbf9eb5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 10:21:40 +0100
libmach: Remove pc from Section
The two values of pc were addede to section just
to make easier moving as to use libmach, but they
don't make too much sense to have them in the
libmach, and as we have the mechanism to store
additional data in the section of as then we can
safely remove it from libmach.
d35d5fe22f66775de64c768ab1271430dbbf9eb52024-02-15T06:52:47Z2024-02-15T10:09:35Zas: Remove binfmt.cRoberto E. Vargas Caballerok0ga@shike2.comcommit d35d5fe22f66775de64c768ab1271430dbbf9eb5
parent fba444a27d3a288a7180c980f48a0cd1bfdd88ee
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 07:52:47 +0100
as: Remove binfmt.c
This file was a bad idea because it was going to have only
one function and it was suffering because it couldn't see
the definition of the lsection structure.
fba444a27d3a288a7180c980f48a0cd1bfdd88ee2024-02-15T06:38:49Z2024-02-15T10:09:16Zas: Use a file pointer for sectionsRoberto E. Vargas Caballerok0ga@shike2.comcommit fba444a27d3a288a7180c980f48a0cd1bfdd88ee
parent 9d275a5c7bede08ee3ab2c2012ffeda5e011c137
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 07:38:49 +0100
as: Use a file pointer for sections
This helps to avoid having a memory pointer in the section
structure that is used only in the case of as, and it makes
easier to use libmach in the case of as.
9d275a5c7bede08ee3ab2c2012ffeda5e011c1372024-02-15T06:30:21Z2024-02-15T09:23:49Zas: Add libmach to the buildRoberto E. Vargas Caballerok0ga@shike2.comcommit 9d275a5c7bede08ee3ab2c2012ffeda5e011c137
parent cfd8977458f82d690f2d1af9e378b4f1b743514b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 15 Feb 2024 07:30:21 +0100
as: Add libmach to the build
The next step in as is to generate actual binaries
and for that reason we are going to use libmach.
cfd8977458f82d690f2d1af9e378b4f1b743514b2024-02-14T18:34:07Z2024-02-15T09:23:49Zlibmach: Resize Map in setmapRoberto E. Vargas Caballerok0ga@shike2.comcommit cfd8977458f82d690f2d1af9e378b4f1b743514b
parent 9fca757b99d81dd58763d1c2f5c59ab435923aa6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 14 Feb 2024 19:34:07 +0100
libmach: Resize Map in setmap
In many cases we will not know the number of
mappings at the very beginning, so resizing
it in setmap makes sense.
9fca757b99d81dd58763d1c2f5c59ab435923aa62024-02-14T18:32:34Z2024-02-14T18:40:55Zlibmach: Remove FILE parameter from newmapRoberto E. Vargas Caballerok0ga@shike2.comcommit 9fca757b99d81dd58763d1c2f5c59ab435923aa6
parent e163c88706af4d3f68c6f6b04d4980bc14f8f65c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 14 Feb 2024 19:32:34 +0100
libmach: Remove FILE parameter from newmap
This parameter was always overwritten by a later call to
setmap(), so it didn't take to much sense to pass the
parameter here.
e163c88706af4d3f68c6f6b04d4980bc14f8f65c2024-02-12T07:59:24Z2024-02-12T22:43:03Zas: Simplify lookupRoberto E. Vargas Caballerok0ga@shike2.comcommit e163c88706af4d3f68c6f6b04d4980bc14f8f65c
parent 6a6fc18fa4b061ae0389c370d7c416f17a883761
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 12 Feb 2024 08:59:24 +0100
as: Simplify lookup
6a6fc18fa4b061ae0389c370d7c416f17a8837612024-02-12T07:46:53Z2024-02-12T22:43:00Zas: Reuse symbol and section from libmachRoberto E. Vargas Caballerok0ga@shike2.comcommit 6a6fc18fa4b061ae0389c370d7c416f17a883761
parent 7b484ddf2a8546ce55949d81cb177bbef416dcff
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 12 Feb 2024 08:46:53 +0100
as: Reuse symbol and section from libmach
This is the next step in the migration to use the types
defined in libmach instead of using custom ones that
are almost identical to the one used in libmach.
A mem pointer was added to the type in libmach but it is
expected to be removed soon.
7b484ddf2a8546ce55949d81cb177bbef416dcff2024-02-11T15:19:30Z2024-02-12T22:41:19Zas: Align symbol and section with mach.hRoberto E. Vargas Caballerok0ga@shike2.comcommit 7b484ddf2a8546ce55949d81cb177bbef416dcff
parent 70b4d78d91cd330d951b919534c0da553489be55
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 16:19:30 +0100
as: Align symbol and section with mach.h
As uses types very similar to the types used
in mach.h and if we want to use libmach in
as then we have to align these structures
to avoid the collition between them.
70b4d78d91cd330d951b919534c0da553489be552024-02-11T14:29:14Z2024-02-12T22:41:19Zas: Remove String typeRoberto E. Vargas Caballerok0ga@shike2.comcommit 70b4d78d91cd330d951b919534c0da553489be55
parent 19c55486c5a8029655ecff7674de7b3167211df5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 15:29:14 +0100
as: Remove String type
This type was not used ever, and I don't remember why it was
added, and I cannot find a simple reason why it should be
preserved.
19c55486c5a8029655ecff7674de7b3167211df52024-02-11T11:40:53Z2024-02-11T11:40:53Zas: Sort makefile listsRoberto E. Vargas Caballerok0ga@shike2.comcommit 19c55486c5a8029655ecff7674de7b3167211df5
parent e7791a314b267cbf98655b888807013504c8de21
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 12:40:53 +0100
as: Sort makefile lists
e7791a314b267cbf98655b888807013504c8de212024-02-11T11:40:05Z2024-02-11T11:40:05Zas: Remove parameter names in as.hRoberto E. Vargas Caballerok0ga@shike2.comcommit e7791a314b267cbf98655b888807013504c8de21
parent 98857fdfe653b04c16f4d3520fe4d1d24a3cb4f0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 12:40:05 +0100
as: Remove parameter names in as.h
98857fdfe653b04c16f4d3520fe4d1d24a3cb4f02024-02-11T11:34:44Z2024-02-11T11:37:22Zas: Move writeout to binfmt.cRoberto E. Vargas Caballerok0ga@shike2.comcommit 98857fdfe653b04c16f4d3520fe4d1d24a3cb4f0
parent 6035e8511b69b44b65eb8771c3dd84ed21e50cb3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 12:34:44 +0100
as: Move writeout to binfmt.c
More changes are expected to be able to write out binaries
formats that are not just pure dumps.
6035e8511b69b44b65eb8771c3dd84ed21e50cb32024-02-11T10:57:55Z2024-02-11T11:21:36Zas: Add driver commandRoberto E. Vargas Caballerok0ga@shike2.comcommit 6035e8511b69b44b65eb8771c3dd84ed21e50cb3
parent 527601ad4c29e586f0ce307353583c5c09f3c321
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 11:57:55 +0100
as: Add driver command
The different as libexecs are designed to be used with a driver
that selects the correct executable to be used for every
architecture.
527601ad4c29e586f0ce307353583c5c09f3c3212024-02-11T09:54:22Z2024-02-11T10:57:12Zbuild: Move config.h to scc/sccRoberto E. Vargas Caballerok0ga@shike2.comcommit 527601ad4c29e586f0ce307353583c5c09f3c321
parent ab69827490c132558469bd0aebc3427c94edf870
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 10:54:22 +0100
build: Move config.h to scc/scc
This header can be useful for other binaries and it
makes sense to move it to the scc namespace.
ab69827490c132558469bd0aebc3427c94edf8702024-02-11T08:42:49Z2024-02-11T10:05:45Ztests/as: Add tests for local labelsRoberto E. Vargas Caballerok0ga@shike2.comcommit ab69827490c132558469bd0aebc3427c94edf870
parent 22cde750b3e0d4605e5fbdc127c03b8d28338ec0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 09:42:49 +0100
tests/as: Add tests for local labels
22cde750b3e0d4605e5fbdc127c03b8d28338ec02024-02-11T08:41:07Z2024-02-11T10:05:45Zas: Fix handling local labelsRoberto E. Vargas Caballerok0ga@shike2.comcommit 22cde750b3e0d4605e5fbdc127c03b8d28338ec0
parent b6a9d725edd7db0e2ef5e23db0d543242b989220
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 09:41:07 +0100
as: Fix handling local labels
Local labels had several problems:
- They were overring the current label
- They were not corrected located using lookup()
b6a9d725edd7db0e2ef5e23db0d543242b9892202024-02-11T08:14:29Z2024-02-11T08:14:29Zas: Accept local labels in expressionsRoberto E. Vargas Caballerok0ga@shike2.comcommit b6a9d725edd7db0e2ef5e23db0d543242b989220
parent cbbf9acc4e1db7ac87ee33eeb7148f2ed0e6ee54
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 09:14:29 +0100
as: Accept local labels in expressions
Local labels were accepted in line definitions but not in
expressions.
cbbf9acc4e1db7ac87ee33eeb7148f2ed0e6ee542024-02-11T08:13:06Z2024-02-11T08:13:06Ztests/as: Test .include pseudo instructionRoberto E. Vargas Caballerok0ga@shike2.comcommit cbbf9acc4e1db7ac87ee33eeb7148f2ed0e6ee54
parent 0592cb9f40061f023f974223ab3578fc2c606515
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 09:13:06 +0100
tests/as: Test .include pseudo instruction
All the pseudo instruction tests were also moved to pseudo.inc
because they can be reused in all the architectures (even when
the check of the side effects has to be done in every arch).
0592cb9f40061f023f974223ab3578fc2c6065152024-02-11T07:31:00Z2024-02-11T07:31:00Ztests/as: Add tests for EQU pseudo instructionsRoberto E. Vargas Caballerok0ga@shike2.comcommit 0592cb9f40061f023f974223ab3578fc2c606515
parent 251fc888acd5500b813fc2d861daa2cbab45f895
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 11 Feb 2024 08:31:00 +0100
tests/as: Add tests for EQU pseudo instructions