scc, branch HEAD simple c99 compiler 4f498a90ad9f907eb9be6a09f79bdca9b3b14bce 2024-10-16T20:02:01Z 2024-10-16T20:05:44Z tests: Use command -v to find the assembler Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 64f3c7719d5c78a2fb962d66ec7d04f7bb15db8f 2024-10-16T15:42:49Z 2024-10-16T15:42:49Z libmach/coff32: Accept empty rels and lines Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 961ee6c2ea156ff13f4dc54ddde5f1e9e4cffe35 2024-10-16T15:16:47Z 2024-10-16T15:16:47Z tests/cc: Update 0018-voidparam Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 5cc95d70ec0a2797cc70e3900f0cb4e18e0c9adf 2024-10-16T15:03:09Z 2024-10-16T15:03:09Z tests/libc: Remove 2nd test of 0017-strerror Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 73eaa8badc9c987348ad6e739bc424ef959d9cb3 2024-10-16T15:00:25Z 2024-10-16T15:00:25Z tests/ar: Don't use exit in the trap Roberto E. Vargas Caballero k0ga@shike2.com commit 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. f7dc4baf7faaa0f70d7f6406c298e97c7323e776 2024-10-16T14:37:44Z 2024-10-16T14:37:44Z build: Don't use uname to select the arch Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 1799a1ccb0dd9a37ef08ac768c495d1b497cd9c0 2024-10-16T14:21:00Z 2024-10-16T14:21:00Z tests/libc: Add include to get atoi() declaration Roberto E. Vargas Caballero k0ga@shike2.com commit 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 2e9e1c983fcb90689350f0d8783bae8ef4dfae31 2024-10-16T13:26:45Z 2024-10-16T13:26:45Z tests/libc: Add va_copy test to 0009-stdarg Roberto E. Vargas Caballero k0ga@shike2.com commit 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 3c7a64d19b6654f885beeef04dca15952066c615 2024-10-16T13:10:16Z 2024-10-16T13:10:16Z tests/libc: Enable trap cleanup Roberto E. Vargas Caballero k0ga@shike2.com commit 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 686135e189c882b2b3e9f7837b002127be743ee1 2024-10-16T13:09:23Z 2024-10-16T13:09:23Z tests/libc: Fill 0017-strerror Roberto E. Vargas Caballero k0ga@shike2.com commit 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 158e115b8b90463541073616f288f5b8b23a7490 2024-10-16T09:21:24Z 2024-10-16T09:21:24Z tests/libc: Return 0 in main for 0007-signal Roberto E. Vargas Caballero k0ga@shike2.com commit 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 a4e5aceb7b07d0a5e0b2d80e674a84515ed56318 2024-10-16T09:12:27Z 2024-10-16T09:12:27Z tests/libc: Select path to gcc-scc Roberto E. Vargas Caballero k0ga@shike2.com commit 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. f28394385a32f7729620977bf5c3f09cec07f6de 2024-10-16T08:54:06Z 2024-10-16T08:54:06Z tests/cc: Use scc in error/update.sh Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 1dbce6a1af3146a9534cf84c1676923c00f5b090 2024-10-16T08:53:25Z 2024-10-16T08:53:25Z tests/cc: Add error/0038-void.c Roberto E. Vargas Caballero k0ga@shike2.com commit 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 f9c47e070844f7752b18e63197f2819ce106386c 2024-10-16T08:50:37Z 2024-10-16T08:50:37Z cc1: Return from ctype() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. be306281fac02e415d76081567520ffecad06adc 2024-10-16T08:46:21Z 2024-10-16T08:46:21Z cc1: Improve wrong void detection Roberto E. Vargas Caballero k0ga@shike2.com commit 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. bbc13f1280dc042f22868c2565602f5b01c2873f 2024-10-16T08:31:15Z 2024-10-16T08:31:15Z cc1: Fix empty param list in newtype() Roberto E. Vargas Caballero k0ga@shike2.com commit 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(). 010fd7349f3e3baeeea0344175cd351dd4692904 2024-10-11T15:12:16Z 2024-10-11T15:12:16Z Merge remote-tracking branch 'origin/master' Roberto E. Vargas Caballero k0ga@shike2.com commit 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' 53efcfa08238d8cd1d7b0db2a936a7a9f43c486e 2024-10-11T15:09:31Z 2024-10-11T15:09:31Z build: Use -fno-stack-protector only for libc Roberto E. Vargas Caballero k0ga@shike2.com commit 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. ebad24d45a3e5159cadad1fbde57a8a4bd09c36f 2024-10-10T10:26:06Z 2024-10-10T10:26:06Z build/obsd: Remove unneeded _ANSI_SOURCE Roberto E. Vargas Caballero k0ga@shike2.com commit 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 8adb487c31627692c9e706a5756b38fb54193be3 2024-10-10T10:25:30Z 2024-10-10T10:25:30Z cc1: Fix plus 1 error terminating string Roberto E. Vargas Caballero k0ga@shike2.com commit 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 54a70620b35380cf2ad6e225e6f8fdc522e6848a 2024-10-10T06:17:13Z 2024-10-10T06:17:13Z Merge remote-tracking branch 'origin/master' Roberto E. Vargas Caballero k0ga@shike2.com commit 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' 0ffa0e87ba113efd5d460be30c66cb11e1d17f3b 2024-10-09T15:06:49Z 2024-10-09T15:12:17Z build/bsd: Remove _ANSI_SOURCE Roberto E. Vargas Caballero k0ga@shike2.com commit 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. b26d16ddb425936fa71459860708c5b6747b4458 2024-10-09T15:05:39Z 2024-10-09T15:12:05Z build: Generate cstd.h in config Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 4b12fe6bce151c8f1d4d7d65a0b2461fc0f780af 2024-10-09T08:38:10Z 2024-10-09T08:38:10Z build: Add paralelism to libc builds Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 2f9ee2943948454638d724feeacbbae63a63179c 2024-10-09T08:29:26Z 2024-10-09T08:29:26Z build: Run config target with detected configuration Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 576fe84ed449291c5f3cb5b7a343cf92c00357ac 2024-10-08T14:44:26Z 2024-10-08T14:44:26Z tests/cc: Enable passing TODO tests Roberto E. Vargas Caballero k0ga@shike2.com commit 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 06a981d5ab044c5d73dd22d4420d4daa4b8c6f33 2024-10-08T14:22:16Z 2024-10-08T14:22:16Z doc: Add external QBE reference Roberto E. Vargas Caballero k0ga@shike2.com commit 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. ec6ce1e2a23d42e52697de6cb108d81edd1c0c0e 2024-10-08T13:05:02Z 2024-10-08T13:07:19Z Revert "cc1: Fix lexer for strings" Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 4ed4dac59ff781ba4bd54db585c2384595e175dc 2024-10-08T10:51:19Z 2024-10-08T10:51:19Z cc1: Fix sizeof expressions Roberto E. Vargas Caballero k0ga@shike2.com commit 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. eb28f98e61cf995a7c1f9c85faf3431438018e03 2024-10-08T08:17:50Z 2024-10-08T10:41:18Z build: Remove qbe fork Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 856d3c7dbd889b25f3e5be8559f67ab3f65a0384 2024-10-07T16:27:00Z 2024-10-08T10:41:18Z build: Do not target outer directories Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 36b8769dd5c503c420bb9404c0f0c2d4bfd2db82 2024-10-07T15:18:31Z 2024-10-07T15:18:31Z tests/cc: Add 0227-sizeof test Roberto E. Vargas Caballero k0ga@shike2.com commit 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 4a0c2ccd2a49423967a9f0826bdfc012739327c7 2024-10-07T15:15:05Z 2024-10-07T15:15:05Z cc1: Reduce to unary for sizeof expressions Roberto E. Vargas Caballero k0ga@shike2.com commit 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 eb8960812d92714eb568df36e09d8c76af5cd46c 2024-10-07T15:12:58Z 2024-10-07T15:12:58Z cc1: Fix lexer for strings Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 9057ad5dbe07ea11e717cc08f69a26bd7e6abc60 2024-10-07T15:10:00Z 2024-10-07T15:10:00Z cc1: Fix parsing of octal escape sequences Roberto E. Vargas Caballero k0ga@shike2.com commit 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). 03dbb2f6ade20e9de9f3128f92c5a5496cf4183b 2024-10-07T14:40:58Z 2024-10-07T14:40:58Z cc1: Don't use strlen concatenating strings Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 438fb6e08b28ac019fb017c5caf1967ef51d0e1f 2024-10-07T10:00:59Z 2024-10-07T14:34:16Z build: Fix OpenBSD build Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 7541da3df27d27b30d7639c25dfbd0c192ddbd91 2024-04-13T19:51:44Z 2024-04-15T09:05:09Z tests/cc: Fix 0225-func.c pointer type Michael Forney mforney@mforney.org commit 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. 9f372e48c6cfbe30974069e3343a856135e43a47 2024-03-26T07:36:44Z 2024-03-26T07:36:44Z tests/cc: Fix 0155-struct_compl Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 15705a1447f2bcefc6839f272791bf1a78025174 2024-03-26T07:17:33Z 2024-03-26T07:28:17Z tests/cc: Remove zero-sized array in 0166-desig.c Michael Forney mforney@mforney.org commit 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. 304a60f868d56b3a9fc6925d957526899ae55eb6 2024-03-26T06:43:29Z 2024-03-26T07:11:53Z tests/cc: Don't use compound literal in file scope struct initializer Michael Forney mforney@mforney.org commit 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. 1d8969baa52c6ee8981869fd67c8c22cd0707fad 2024-03-26T06:32:30Z 2024-03-26T06:41:58Z tests/cc: Fix loop condition in execute/0169-string.c cmp() function Michael Forney mforney@mforney.org commit 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. da15e0d9945be83baead323b081ec436d5852b57 2024-03-22T07:29:02Z 2024-03-22T07:29:02Z build: Add make/deps.mk Roberto E. Vargas Caballero k0ga@shike2.com commit 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 c63c6229624807c6248faa5e396a65cb0bdff70f 2024-03-22T07:16:56Z 2024-03-22T07:25:38Z as: Initial function to write object files Roberto E. Vargas Caballero k0ga@shike2.com commit 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. b72ae1daa29675c82e45d85776a40257a56241ff 2024-03-22T07:04:43Z 2024-03-22T07:04:43Z libmach/coff32: Avoid file pointer in non mapped sections Roberto E. Vargas Caballero k0ga@shike2.com commit 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. d453c845befbaa9a03eb974df569ebd41c9d7a49 2024-03-22T07:02:16Z 2024-03-22T07:02:16Z libmach/coff32: Free lines and relocations Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 38ab22d6380b1d1c6fa232fa2ee5ef42b4faa77d 2024-03-22T04:12:04Z 2024-03-22T04:12:04Z libmach/coff32: Don't write non allocated sections Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 1d8b58777ed0e762dd3e79218ed951e05c5e2dff 2024-03-22T04:09:37Z 2024-03-22T04:09:37Z as: Set type of symbols associated to sections Roberto E. Vargas Caballero k0ga@shike2.com commit 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. fb3572d08e0fdc42b6432203085d3c84889159e2 2024-03-22T02:26:14Z 2024-03-22T03:50:09Z build: Remove double scc scc indirection Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 49a15e6576f3227a8a94eca8a5e1a5fe60d2f86f 2024-03-22T02:18:41Z 2024-03-22T02:18:41Z as: Order default sections in expected order Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 4c8a466ddf23cf1db739c35b6cef305f053c83cb 2024-03-21T09:41:29Z 2024-03-21T09:41:29Z libmach/coff32: Rename F_SYMS to F_LSYMS Roberto E. Vargas Caballero k0ga@shike2.com commit 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. a10811325601d16f25a9afe146831e371b2fe076 2024-03-21T08:06:28Z 2024-03-21T08:06:28Z libmach/coff32: REmove unneeded parameter in typeof() Roberto E. Vargas Caballero k0ga@shike2.com commit 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() 29dc92ca622fc1a51d03db61131eed586fa370ab 2024-03-21T07:04:05Z 2024-03-21T07:04:05Z as: Add symbols for every section Roberto E. Vargas Caballero k0ga@shike2.com commit 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. c658360817ac84cd259dbff0ea836dac8b647ad1 2024-03-21T06:51:00Z 2024-03-21T06:51:00Z as: Check that data and bss sections are readable Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 7e58afa199c101cf286652c305ba91e63a8fc40c 2024-03-21T06:43:35Z 2024-03-21T06:43:35Z libmach/coff32: Add setsym() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 089001cf022662342949760e254ee19f09123350 2024-03-21T06:24:06Z 2024-03-21T06:29:34Z libmach/coff32: Set f_symptr in coff2write Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 0f79c5f471ea50fbe25862dfdf257f2e93387ac9 2024-03-16T09:23:44Z 2024-03-16T09:23:44Z as: Fix section creation Roberto E. Vargas Caballero k0ga@shike2.com commit 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. f60f2f1a36f05d3352dad82bcddee3b4b0cac883 2024-03-15T19:21:43Z 2024-03-15T19:21:43Z libmach: Remove whitespace Roberto E. Vargas Caballero k0ga@shike2.com commit f60f2f1a36f05d3352dad82bcddee3b4b0cac883 parent e082102024dc1b108b686cc7b0a5dcd4d4da3185 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Fri, 15 Mar 2024 20:21:43 +0100 libmach: Remove whitespace e082102024dc1b108b686cc7b0a5dcd4d4da3185 2024-03-15T19:20:58Z 2024-03-15T19:20:58Z as: Fix error checking calling setsec() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 76e99b74c0360b4b3c379339d64b0e873ad675ff 2024-03-15T12:37:55Z 2024-03-15T12:37:55Z build: Fix uninstall target in arm64 Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 8bf178a38c08e806575890b7d97173b996b77d64 2024-03-15T12:36:14Z 2024-03-15T12:36:14Z Merge remote-tracking branch 'origin/master' into coff Roberto E. Vargas Caballero k0ga@shike2.com commit 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 0b5f87dcd9ac36f700c7718168e6378e90cb95fe 2024-03-12T17:45:08Z 2024-03-15T12:36:05Z libc/arm64: Remove invalid int type Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 13fabd7c1b99fc97c8fe9cfb58f4e898eb8599f9 2024-03-13T08:40:18Z 2024-03-13T08:40:18Z libc/arm64: Add include/bits/linux/arm64/arch/sigaction.h Roberto E. Vargas Caballero k0ga@shike2.com commit 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 82ea1289e2b1c663ec893ccf26ee48da023374d6 2024-03-12T18:10:17Z 2024-03-12T18:10:17Z libc: Fix name of __sigaction object Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 11aa13ade5645840f9d2d0fe42b778afa457eb9b 2024-03-12T17:54:51Z 2024-03-12T17:54:51Z libc/arm64: Add missed $sys/arch/inttypes.h Roberto E. Vargas Caballero k0ga@shike2.com commit 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 fac3afee5f050f7ac9294584a98e8614cd0be2ff 2024-03-12T17:45:08Z 2024-03-12T17:48:19Z libc/arm64: Remove invalid int type Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 1156602edeb3876e50b1b8a3f038f0b4cae41e27 2024-03-12T17:43:33Z 2024-03-12T17:48:19Z build: Fix scripts/arm64.mk Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 41f4e8a8414c3db705b3c730f933e8a980110f91 2024-03-10T15:30:58Z 2024-03-10T15:39:33Z libmach: Initialize coff file header in objnew() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. cb8145813e5414d66e2416feb0026f3d70ae9abb 2024-03-10T12:30:50Z 2024-03-10T12:40:37Z libscc: Add system dependant functions Roberto E. Vargas Caballero k0ga@shike2.com commit 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. edd82a7380825ecc35d98c0db5ae602b977d3cbd 2024-03-09T10:08:48Z 2024-03-09T10:08:48Z doc: Clarify use of HOST, CONF and TOOL Roberto E. Vargas Caballero k0ga@shike2.com commit 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. b0b4485f6041a17dca20687a2e78002f7451e087 2024-03-09T09:45:39Z 2024-03-09T09:45:39Z build: Translate between aarch64 and amd64 Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 38abc9a2afdbbac7dc6a0019212d71959d99fccd 2024-03-05T08:46:13Z 2024-03-05T08:46:13Z libmach: Fix flags for coff read only Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 1542722ccdfba37389ccc09fb382df9f975e70e6 2024-03-05T08:40:57Z 2024-03-05T08:40:57Z as: Create object and attach sections Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 5fb4bf82c962c831624ee7d1c1c1e75bf67291d8 2024-03-05T08:35:45Z 2024-03-05T08:35:45Z libmach: Add setsec() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. a5b21461738ce6ca8c80071ef594e931c77ffbe4 2024-03-05T08:13:51Z 2024-03-05T08:13:51Z as: Remove unused cmp() Roberto E. Vargas Caballero k0ga@shike2.com commit a5b21461738ce6ca8c80071ef594e931c77ffbe4 parent d394111bab814e96386aaf55023f26a4c59140e6 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Tue, 5 Mar 2024 09:13:51 +0100 as: Remove unused cmp() d394111bab814e96386aaf55023f26a4c59140e6 2024-03-04T09:30:15Z 2024-03-04T09:30:15Z doc: Fix typo in README Roberto E. Vargas Caballero k0ga@shike2.com commit 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 226c9b6665ee5cb3d0f50fad4be66a339af4f1d7 2024-02-15T15:59:28Z 2024-02-15T15:59:28Z libmach: Add objtype() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. b0a24eced82c3e643a2722a1d8560338b653a51e 2024-02-15T15:09:15Z 2024-02-15T15:09:15Z libmach: Fix objprobe() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 0743502801e60e87b15b2af32a314684f66fb472 2024-02-15T14:18:49Z 2024-02-15T14:18:49Z libmach: Rename objtype() to objprobe() Roberto E. Vargas Caballero k0ga@shike2.com commit 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. b6459c65a740c350d9088c2e383909b035790b00 2024-02-15T09:21:40Z 2024-02-15T10:10:19Z libmach: Remove pc from Section Roberto E. Vargas Caballero k0ga@shike2.com commit 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. d35d5fe22f66775de64c768ab1271430dbbf9eb5 2024-02-15T06:52:47Z 2024-02-15T10:09:35Z as: Remove binfmt.c Roberto E. Vargas Caballero k0ga@shike2.com commit 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. fba444a27d3a288a7180c980f48a0cd1bfdd88ee 2024-02-15T06:38:49Z 2024-02-15T10:09:16Z as: Use a file pointer for sections Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 9d275a5c7bede08ee3ab2c2012ffeda5e011c137 2024-02-15T06:30:21Z 2024-02-15T09:23:49Z as: Add libmach to the build Roberto E. Vargas Caballero k0ga@shike2.com commit 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. cfd8977458f82d690f2d1af9e378b4f1b743514b 2024-02-14T18:34:07Z 2024-02-15T09:23:49Z libmach: Resize Map in setmap Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 9fca757b99d81dd58763d1c2f5c59ab435923aa6 2024-02-14T18:32:34Z 2024-02-14T18:40:55Z libmach: Remove FILE parameter from newmap Roberto E. Vargas Caballero k0ga@shike2.com commit 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. e163c88706af4d3f68c6f6b04d4980bc14f8f65c 2024-02-12T07:59:24Z 2024-02-12T22:43:03Z as: Simplify lookup Roberto E. Vargas Caballero k0ga@shike2.com commit e163c88706af4d3f68c6f6b04d4980bc14f8f65c parent 6a6fc18fa4b061ae0389c370d7c416f17a883761 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Mon, 12 Feb 2024 08:59:24 +0100 as: Simplify lookup 6a6fc18fa4b061ae0389c370d7c416f17a883761 2024-02-12T07:46:53Z 2024-02-12T22:43:00Z as: Reuse symbol and section from libmach Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 7b484ddf2a8546ce55949d81cb177bbef416dcff 2024-02-11T15:19:30Z 2024-02-12T22:41:19Z as: Align symbol and section with mach.h Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 70b4d78d91cd330d951b919534c0da553489be55 2024-02-11T14:29:14Z 2024-02-12T22:41:19Z as: Remove String type Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 19c55486c5a8029655ecff7674de7b3167211df5 2024-02-11T11:40:53Z 2024-02-11T11:40:53Z as: Sort makefile lists Roberto E. Vargas Caballero k0ga@shike2.com commit 19c55486c5a8029655ecff7674de7b3167211df5 parent e7791a314b267cbf98655b888807013504c8de21 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Sun, 11 Feb 2024 12:40:53 +0100 as: Sort makefile lists e7791a314b267cbf98655b888807013504c8de21 2024-02-11T11:40:05Z 2024-02-11T11:40:05Z as: Remove parameter names in as.h Roberto E. Vargas Caballero k0ga@shike2.com commit 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 98857fdfe653b04c16f4d3520fe4d1d24a3cb4f0 2024-02-11T11:34:44Z 2024-02-11T11:37:22Z as: Move writeout to binfmt.c Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 6035e8511b69b44b65eb8771c3dd84ed21e50cb3 2024-02-11T10:57:55Z 2024-02-11T11:21:36Z as: Add driver command Roberto E. Vargas Caballero k0ga@shike2.com commit 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. 527601ad4c29e586f0ce307353583c5c09f3c321 2024-02-11T09:54:22Z 2024-02-11T10:57:12Z build: Move config.h to scc/scc Roberto E. Vargas Caballero k0ga@shike2.com commit 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. ab69827490c132558469bd0aebc3427c94edf870 2024-02-11T08:42:49Z 2024-02-11T10:05:45Z tests/as: Add tests for local labels Roberto E. Vargas Caballero k0ga@shike2.com commit 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 22cde750b3e0d4605e5fbdc127c03b8d28338ec0 2024-02-11T08:41:07Z 2024-02-11T10:05:45Z as: Fix handling local labels Roberto E. Vargas Caballero k0ga@shike2.com commit 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() b6a9d725edd7db0e2ef5e23db0d543242b989220 2024-02-11T08:14:29Z 2024-02-11T08:14:29Z as: Accept local labels in expressions Roberto E. Vargas Caballero k0ga@shike2.com commit 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. cbbf9acc4e1db7ac87ee33eeb7148f2ed0e6ee54 2024-02-11T08:13:06Z 2024-02-11T08:13:06Z tests/as: Test .include pseudo instruction Roberto E. Vargas Caballero k0ga@shike2.com commit 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). 0592cb9f40061f023f974223ab3578fc2c606515 2024-02-11T07:31:00Z 2024-02-11T07:31:00Z tests/as: Add tests for EQU pseudo instructions Roberto E. Vargas Caballero k0ga@shike2.com commit 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