From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uBLSA/AT5mVMIAEAbAwnHQ (envelope-from ) for ; Mon, 04 Mar 2024 19:33:20 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 0LE3APAT5mWTlwAAqHPOHw (envelope-from ) for ; Mon, 04 Mar 2024 19:33:20 +0100 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=ZjL8zxTi; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=Jpu0Cg39; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1709577199; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=oCfY7HaHAP4MwsfO/tNw6wn7WnAjmn4g4pqnLt3IEKA=; b=I90Y8pjErfRO4s1bcl9NmAW1ogMPLHKWB9tzpJ+dytX90z4GFCduW0rhyxln3OmbYy2s3Q +IFaWj5V0OIZFpMAa9jB81AVzz0+qMdaUXD1BMnZFRyseNCs/W3UwE0UCT+7FRF5JS9PXj JTAFwkWhdnkjGmGiVG+9S31OZFFIi5v6G2I02uEZ7CwOzISm/Z9ntEoFrO6rdd1RaV69L2 nACNPMUazhN+ISDB5qLXpJ+yvbR4LtlycI/3O+HtoX4NFgrHdBUO7xw4F0cIpXRpeHyh8o sDN4H3cL2/+jNcJ+WmrEjcN18LG7LdfbxuibqY4pbRDYpI1uIaF3g2nf8g7hXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=ZjL8zxTi; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=Jpu0Cg39; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com ARC-Seal: i=1; s=key1; d=johnnyrichard.com; t=1709577199; a=rsa-sha256; cv=none; b=292vqzsIuzkWrWMwOjSlYwywfAU+TAbq5Jl34bOO2JDNIoQ/j3D5Ac32NeUR3UwELAu2uQ xijFtLDEDLXgqgdHMP6ozrzPCXMJRKKac774xqehGttqSrotMmQNJr5DqbhURhEdwsNbz+ FVKJjOtMAh3s69N1d2PnJbe9Og1usmcw8GKEZqEtT5SwqQmy1rDfzfxcnyubo5t6MumUNx 70bereJxJYMKPdnwXN06md7QtVlWH+sX39Ad/9jd7mcXMDFIrx2XBzyVVISEtlLfcsnMup 4+4KMKeJtv5qzbykN2TWLYLb38X57KLt/QwlXphghxBPCScXOWizuLueFWNudw== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 488231AD9B for ; Mon, 4 Mar 2024 19:33:16 +0100 (CET) DKIM-Signature: a=rsa-sha256; bh=bsipMKl2eXldkg7tRAwioSR1Wo2aY4T1GgUcedW8HtE=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1709577195; v=1; b=ZjL8zxTiCarC+cCvKbOw05rbzfll9A0JUzgNnypRivBT7oLAgvWslU5Yojmeopmok0PcGONG z8gjh4o2KKwddC3ELFSshwDi02yGttwCwaySrmxXydZ2w3I9WRN7bjv5vIqtP2tSfUWDYtpehr3 61Wvg35CZit/jiqSQD8oThfAF1FBX97rPY6d300rdr+0CpFgHM31yw+c3tCNgThkAaNderaFp+V PzwCJLdHgmDiG6Ur4O8N0z3jUpgJ8Yb3B0InoNaSf5KG7AIfOpOPEAJEyRINTHWGSDpIDR1dKDB qeAO6W5edu68zoiHOARdFXVoxf0/HbtQeqbr/ywS2VW8Q== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 3D98D20151 for ; Mon, 4 Mar 2024 18:33:15 +0000 (UTC) Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) by mail-a.sr.ht (Postfix) with ESMTPS id 6C82020125 for <~johnnyrichard/olang-devel@lists.sr.ht>; Mon, 4 Mar 2024 18:33:12 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1709577191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=oCfY7HaHAP4MwsfO/tNw6wn7WnAjmn4g4pqnLt3IEKA=; b=Jpu0Cg39ntNaikLJeThdViaQZDVRTWWtNHZVK3Gm/30Jj2sB3ejHcoH9hQ90Oj3Xgd745u cowcngefbdwHnWuAXLjh1NCmvr8yB0q8UKuy5d1AhxWao1cI23uvu5gxOgqu0LaHA8cFlG LGB7w5shMPUnNVh9OC4j8+BPI7dgrOIlS1lYKGm8VMD7sOGO8HfYw0hjh7A2KfsIC7qZKG sVDfyb1c1kSC9hvrIgCZVNTLQnQ7SMIhGTlC1/eaIRmkLxhMH7TLJ7D1sTTAorIkDYPZsr 9/q/bk9OQNXdGktkls/TCeFcj02dKe6KLtpFKPZlpQqtIp1ZzYiZ7/BnCW/qPQ== From: Johnny Richard To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Johnny Richard Subject: [PATCH olang v1 0/3] implement assembly linux x86_64 compiler Date: Mon, 4 Mar 2024 20:23:09 +0100 Message-ID: <20240304193313.961286-1-johnny@johnnyrichard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Country: NL X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -9.03 X-Spam-Score: -9.03 X-Migadu-Queue-Id: 488231AD9B X-TUID: 0cCqZAVSfk2O This patchset marks the completion of the compiler pipeline by introducing the crucial code generation component. With this addition, we achieve a fully operational compiler pipeline capable of compiling to x86_64 Linux assembly. To validate this implementation, follow these steps: $ make $ ./0c examples/main_exit.0 -o main_exit --save-temps $ ./main_exit $ echo $? # should return 0 You might notice that we are missing tests. Let's engage in discussions regarding the design of our compiler tests for future iterations. Your feedback and suggestions on this patchset are highly appreciated. Johnny Richard (3): be: create linux-x86_64 gas asm codegen string_view: add function to create from cstr cli: add compilation -o option with --save-temps docs/manpages/0c.md | 13 ++- src/codegen_linux_x86_64.c | 81 +++++++++++++++++ src/codegen_linux_x86_64.h | 25 ++++++ src/main.c | 180 ++++++++++++++++++++++++++++++------- src/string_view.c | 6 ++ src/string_view.h | 3 + 6 files changed, 272 insertions(+), 36 deletions(-) create mode 100644 src/codegen_linux_x86_64.c create mode 100644 src/codegen_linux_x86_64.h base-commit: 18ade2ac3dd60c13150828ecb4cfea6ca327bdd8 -- 2.44.0