From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 014BE3858C78 for ; Fri, 17 Feb 2023 11:11:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 014BE3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676632274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ENwt+1rB9k0McamfqN7NLiptEi28PpVbWyUa36bOQ5o=; b=Xs34vsg40PtboKPXNcESJxd42BTDEjScCpNLjZaREQF4o6mUe/al49kE0sTFfbbANxlybF R1zRFQF44nOFI9Ao7GlWCZSRDXfumX8vXBdJPeCNF+wY2g4Gw6L0m/GhAirPv7m6Yoafd3 tdXI4CTQlpHUB/CqtGgNvDHs4SR+tM0= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-401-E_-XVZYFOB-TSb9mSFdvkQ-1; Fri, 17 Feb 2023 06:11:13 -0500 X-MC-Unique: E_-XVZYFOB-TSb9mSFdvkQ-1 Received: by mail-qv1-f70.google.com with SMTP id md3-20020a056214588300b0056ee5b123bbso370431qvb.7 for ; Fri, 17 Feb 2023 03:11:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ENwt+1rB9k0McamfqN7NLiptEi28PpVbWyUa36bOQ5o=; b=YpdMHZkMnQTGlDQ7LMziF75hZwxsqWI4w9VqZJuISdhuyeEvuA8+4cUqvtvcMZ1TS+ mFFkncGDhe+UmOa8vNBEiEmOkEXmYFDyh+9gDhOQkwFmagw5+phWeja0JMjy3VMknKWS sCYJ8UaXEcEOzsOoySjsQBpjIn3XM7PKV66j9EUOlZcRmrKyb1EgjEgzTuS/b7pKj8vW zM+G91pzeEAtkrZvCPNK6rDwd4NBiMQVbdsEpr6Dgk5EQ0GFQPmy4OMN4WuW0zI/zPud vgtAt3e2DhHjAui4PgztxtKchHMJ5gQa3YwBONGhjtZYucmxiKRb6EJYCmckGYP/KMFV IaGg== X-Gm-Message-State: AO0yUKUcRtBEorQ6aO3raBkxV74+arIMo66HzDBb7e9D2jOEneUbtRYZ PCZ7UlJE417sqVoBghylbZnR4fmMqCl6aLN5KolkPOyfMsHVR8tOuy87DK+tVrZBw6/poo0KrOV 4EBnKGBfbLZ43R4+Gvw== X-Received: by 2002:a05:622a:1208:b0:3b9:b6c8:6d5b with SMTP id y8-20020a05622a120800b003b9b6c86d5bmr1206841qtx.35.1676632272580; Fri, 17 Feb 2023 03:11:12 -0800 (PST) X-Google-Smtp-Source: AK7set8gyILW++1jNIy9fuwouSwCrKJNuHp0WqrcIrQkoaqFNU/UfDcRI7Y9XSETE3LEGqANZB8teQ== X-Received: by 2002:a05:622a:1208:b0:3b9:b6c8:6d5b with SMTP id y8-20020a05622a120800b003b9b6c86d5bmr1206827qtx.35.1676632272331; Fri, 17 Feb 2023 03:11:12 -0800 (PST) Received: from [192.168.1.18] ([79.123.86.193]) by smtp.gmail.com with ESMTPSA id p26-20020ac8409a000000b003bb822b0f35sm3076881qtl.71.2023.02.17.03.11.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Feb 2023 03:11:11 -0800 (PST) Message-ID: <328005c0-a162-764e-47ba-036dce0ecbe4@redhat.com> Date: Fri, 17 Feb 2023 11:11:10 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 To: Ulf Samuelsson , Fangrui Song Cc: binutils@sourceware.org References: <20230216204006.1977-1-binutils@emagii.com> <8c80d58c-8c43-90c9-9d0b-9a5de91c16ed@emagii.com> From: Nick Clifton Subject: Re: [RFC v0 0/1] Add support for CRC64 generation in linker In-Reply-To: <8c80d58c-8c43-90c9-9d0b-9a5de91c16ed@emagii.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-GB Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: Hi Ulf, >> Hi Ulf, can you state why a built-in support of ld is needed? If you >> want to embed a checksum, you can use Output Section Data to reserve a >> few bytes in the output, then use a post-link tool to compute the >> checksum and rewrite the reserved bytes. > In my experience, the post link tools usually work on the binary data and not the ELF file. The objcopy program can do most of this for you though. For example: % objcopy --dump-section .text=contents-of-text a.out % crc32 contents-of-text > crc32-of-text % objcopy --add-section .crc32=crc32-of-text a.out % readelf -x.crc32 a.out Hex dump of section '.crc32': 0x00000000 32323064 37636339 0a 220d7cc9. In this example the crc32 is stored as ascii text, but I am sure that you can find a version of the crc32 program that generates binary output. > Another thing is that the post-link tools I have seen are typically poorly maintained. ...and so you want to move that maintainership burden onto us, yes ? > Adding a post-link step seems like a kludge if the linker can provide the CRC inside the ELF file. But it also keeps things simple. No new code in the linker = no new bugs in the linker. Solving a problem using existing tools = no need for new versions of the linker when the already existing versions will work just fine. Cheers Nick