Message ID | 20230213162009.15515-1-binutils@emagii.com |
---|---|
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2435657wrn; Mon, 13 Feb 2023 08:20:33 -0800 (PST) X-Google-Smtp-Source: AK7set/ALwAk/KCGEP4+cnYyLVZE2pkUe1p/kabJ1hMFkWr0arUF/viDtjeJE4XXkCOU0fH44nvV X-Received: by 2002:a17:906:fa18:b0:878:54e3:e3e1 with SMTP id lo24-20020a170906fa1800b0087854e3e3e1mr25373444ejb.73.1676305233481; Mon, 13 Feb 2023 08:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676305233; cv=none; d=google.com; s=arc-20160816; b=IhEOyNHCQqrYgVESl+XdzsI+yZUHrIq5sO++c6go3KET8oLjRh82GhPnxs3M7Rk8ou /ptNz4+BgTWevvIse3DqYAxjGKp9YYT/YyzmwmS3DbQtRpgBIWrnqu96xs6IVWPTj4O+ JypLz9/iOXlPPTjX8s+Zy22XDJOHFi3ZQDoFPA73cDAy469aSQAcOp8nMG6YufVvVT9q pUotm0C6K+vNLM4XrELxYfESciwwVsJPmdjNQ115dTLFy0v0+SE2s0WQ/CM7oNA/LoZ9 asoXX+hbk1Z0ze4JLaAqRS6pnD24I32D30e8dBHSeamGVhl+OX3jewrNEGtt8tMRKiZ7 w65Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id:date :subject:cc:to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=JZk20JZ3R1owmzoACN8/qgbOLp2QLjsRDh7513Odb2M=; b=yyXLJNona2Jk87gS9Aa3sN3+yTfBY9exM76bNSfTGWitLP6cQ5uVktPchbwhPaL3XI Pw54Dqwo4nM2LyWTOAZtBK3wuorzuD+TssAFaqKu9MgTHBFZKYCiPoxuPGHOVPhCvMHj Fc14/4Mtw7eq4UfGzlVPPn+4J818wszXUW276ywnU2+wmE0VNfZwNXcShYq5htmWoOKy 3VdH/18bT6AUFS0WS6eaIC/LyGRUJTkce3pbLDWYx19vuqBxWgVy/tRPW3jXlIwecJhK TOEoElO4s2YBXWOdMDPnqQLaYlf9J9u07E24Tn8YuhubqfehRsoo7QKB5AzxntrxmxpW mP9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=NeRx3qfU; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e17-20020a170906749100b0087760800a91si17730287ejl.424.2023.02.13.08.20.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Feb 2023 08:20:33 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=NeRx3qfU; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1ED5D3857838 for <ouuuleilei@gmail.com>; Mon, 13 Feb 2023 16:20:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1ED5D3857838 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676305232; bh=JZk20JZ3R1owmzoACN8/qgbOLp2QLjsRDh7513Odb2M=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=NeRx3qfUMuE3OiCKeBRBoRfvB9XlazkAoXIr8DKDf+vAbfBqOxsUrDvbl4mISvZVO lMDcTG5SDBbDkmfCBCk9nUcpI2KqRtYSbkWSLDYKFSxyA1obxvyWhSjpOL2SCf6tnr fvNpqfmX7smMKWrX6EVF5x0FnTDbO2Tu3GBbJZEs= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from emagii.se (www.emagii.com [185.133.207.17]) by sourceware.org (Postfix) with ESMTPS id 8FE0C3858D1E for <binutils@sourceware.org>; Mon, 13 Feb 2023 16:20:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FE0C3858D1E Received: from valinor.ownit.se (84-55-68-216.customers.ownit.se [84.55.68.216]) by emagii.se (Postfix) with ESMTPSA id 287A812019C; Mon, 13 Feb 2023 17:20:13 +0100 (CET) Received-SPF: pass (emagii.beebytevps.io: connection is authenticated) To: binutils@sourceware.org Cc: nickc@redhat.com Subject: [PATCH v4 0/6] ASCIZ Command for output section Date: Mon, 13 Feb 2023 17:20:03 +0100 Message-Id: <20230213162009.15515-1-binutils@emagii.com> X-Mailer: git-send-email 2.17.1 X-PPP-Message-ID: <167630521342.3743393.6677766267427923563@localhost.localdomain> X-PPP-Vhost: emagii.com X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_FAIL, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Ulf Samuelsson via Binutils <binutils@sourceware.org> Reply-To: binutils@emagii.com Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757718499673979652?= X-GMAIL-MSGID: =?utf-8?q?1757733436842169597?= |
Series |
ASCIZ Command for output section
|
|
Message
Frager, Neal via Binutils
Feb. 13, 2023, 4:20 p.m. UTC
Introduce an ASCIZ command for an output section When generating a header for an embedded system there is often a need to add text information. There are arguments for generating the header in the linker instead of compiling the header as part of the program. The lack of support for strings makes this process a bit unwieldy. The ASCIZ command allows you to specify a zero-terminated string as a parameter. Example: ASCIZ "This is a string" The string contains 16 characters, but a NUL character is added to the end, so the areas reserved is 16+1 = 17 characters. The string may contain '\n', '\r', '\t' and octals, but not hex characters. Ideally, there should be a command which reserves a fixed size area. I:E: ASCII 20, "This is a string" but I have failed to get make this work in 'ld', so this patch series is limited to ASCIZ. [PATCH v4 1/6] Document the ASCIZ command [PATCH v4 2/6] Add ASCIZ to NEWS [PATCH v4 3/6] Add ASCIZ to testsuite [PATCH v4 4/6] ldlex.l: Add ASCIZ token [PATCH v4 5/6] ldgram.y: Add 'ASCIZ <string>' command [PATCH v4 6/6] Parse ASCIZ command
Comments
Looks like I reached the mail limit PATCH V4 6/6 changed V3 like this: - int value = c; + int value = c - '0'; Best Regards Ulf Samuelsson Den 2023-02-13 kl. 17:20, skrev Ulf Samuelsson via Binutils: > Introduce an ASCIZ command for an output section > When generating a header for an embedded system > there is often a need to add text information. > > There are arguments for generating the header in the linker > instead of compiling the header as part of the program. > The lack of support for strings makes this process a bit unwieldy. > > The ASCIZ command allows you to specify a zero-terminated string as a parameter. > > Example: > > ASCIZ "This is a string" > > The string contains 16 characters, but a NUL character is added to the end, > so the areas reserved is 16+1 = 17 characters. > > The string may contain '\n', '\r', '\t' and octals, but not hex characters. > > Ideally, there should be a command which reserves a fixed size area. > > I:E: > > ASCII 20, "This is a string" > > but I have failed to get make this work in 'ld', > so this patch series is limited to ASCIZ. > > [PATCH v4 1/6] Document the ASCIZ command > [PATCH v4 2/6] Add ASCIZ to NEWS > [PATCH v4 3/6] Add ASCIZ to testsuite > [PATCH v4 4/6] ldlex.l: Add ASCIZ token > [PATCH v4 5/6] ldgram.y: Add 'ASCIZ <string>' command > [PATCH v4 6/6] Parse ASCIZ command >
Hi Ulf, > Introduce an ASCIZ command for an output section > When generating a header for an embedded system > there is often a need to add text information. Thanks for contributing this patch series. I have applied the patches with a few minor tweaks - mostly to the new test case so that it did not cause new failures on targets which pad code to an alignment greater than 4 bytes. Cheers Nick
Thank You. I will start to try to implement the "ASCII" command as well. ASCII <length> , <string> I had some problems with getting syntax errors on this so I think I will send in a preliminary patchset and see if anyone can spot an obvious error. One question: The lang_add_string contains an error message if the string does not fit into the allocated area. This will never get triggered by the ASCIZ command, since that will allocate the size of the string. If you specify a size to the ASCII command and then provide a longer string it will trigger. There are no translations for the string at the moment. Will the linker output the English string, or what? What is the procedure to get a translation? I can provide a Swedish translation at the least. Best Regards Ulf Samuelsson Den 2023-02-14 kl. 11:16, skrev Nick Clifton: > Hi Ulf, > >> Introduce an ASCIZ command for an output section >> When generating a header for an embedded system >> there is often a need to add text information. > > Thanks for contributing this patch series. I have applied > the patches with a few minor tweaks - mostly to the new > test case so that it did not cause new failures on targets > which pad code to an alignment greater than 4 bytes. > > Cheers > Nick > >
Hi Ulf, > One question: > The lang_add_string contains an error message if the string does not fit into the allocated area. > This will never get triggered by the ASCIZ command, since that will allocate the size of the string. > If you specify a size to the ASCII command and then provide a longer string it will trigger. Ah - you know that I mentioned that I had tidied up the code a little bit ? Well the other area I tidied was the lang_add_string function. I simplified it, removed the redundant size checking code and string padding code, and changed the stacked if-statements into a simpler switch-statement... So currently there are no messages that need translation, > There are no translations for the string at the moment. > Will the linker output the English string, or what? If a translation for a specific string is not available then it will just be displayed as-is. So in this case the English version will be used. > What is the procedure to get a translation? The hard way: Create a new ld/po/ld.pot file and send it to the Translation Project with a request for new translations: https://translationproject.org/html/maintainers.html The easy way: Wait for the next official release of the binutils. As part of the process for creating a release I take care of asking the Translation Project to update the translation files. Note - this does not mean that new translations will be created for all supported languages. The translation project runs on a volunteer basis and it is up the the volunteers to find time to create new translations and/or update old translations. > I can provide a Swedish translation at the least. If you would like to volunteer some time to the Translation Project I am sure that they would love to hear from you. Cheers Nick