From patchwork Tue Jun 18 08:14:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 92358 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C87C3882671 for ; Tue, 18 Jun 2024 08:16:01 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D6870388267B for ; Tue, 18 Jun 2024 08:14:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6870388267B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D6870388267B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718698500; cv=none; b=DYIhcV0KACD8oyxUUJGes30K8mOcJxv7UPek63l7VCLtC+IntCyG2wL5FLDG4r9Nzx7AfEaC1i9MKdNKA7MFOOBWxqVktHnBJAnPejMTw+gOHYvZdU64hcIEr8zVcZF+LvojeliIwOjhQ0fljOVL/tLetW53G+R6VOU6nkoAiCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718698500; c=relaxed/simple; bh=jwyOclP+CsCozhkC7s+Cx9y+7e9F0J9vMoHeNCgX9tE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OmpQhv0w8qCPxU29so6AU7Ump8wT/Iy4/iHMEFBi4BDGvKZv08cLw/uc6SuVjjMgkC2qcaWiCwYNnkY/JgKbceIeM0EX+XHbKPeHn3GmGow1k8OdHKSDTQyHoDQXXxk6RusAcuwFrQap82Y1IOx9vG2jrED36N6S89AOqK7H62w= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718698496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=Xczn2+raENwFezXWXIpeitb3YHpbZoHly46Zo8z58BI=; b=TxstIfnL0e7avNYHWNhSfXYWuCutr48pV4JoUfPXhPftaLO5R0tdbmgCk8/wxzrwn2qRpw tV0cwE9LdQMjLXx/5iWo+jWEIHzVslGUk0YZAINhW93VE5OhLtDJRL9KLcrxKloQMW0bOC iNbwrc1njACYMKFcodPrw30vAQHZn4w= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-470-1-jh0IXgOhW1inXJIGzkbQ-1; Tue, 18 Jun 2024 04:14:55 -0400 X-MC-Unique: 1-jh0IXgOhW1inXJIGzkbQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1EA20195608B for ; Tue, 18 Jun 2024 08:14:54 +0000 (UTC) Received: from prancer.redhat.com (unknown [10.39.192.212]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 54F713000218 for ; Tue, 18 Jun 2024 08:14:52 +0000 (UTC) From: Nick Clifton To: binutils@sourceware.org Subject: Commit: --rosegment: Restore alignment of text segment Date: Tue, 18 Jun 2024 09:14:49 +0100 Message-ID: <87frtabrba.fsf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org Hi Guys, *sigh* I have found another snafu with my --rosegment feature. I had disabled the alignment of the text segment in the on-disk image, on the assumption that the loader would be able to load a partial page into memory. In turns out however that this is not correct, and that data following the text segment in the on-disk image can be loaded into the executable segment in memory. So I am checking in this patch to restore the alignment of the text segment in the on-disk image. Which means that the file size increase when using '-z separate-code' is not alleviated as much. (It can still be slightly improved since --rosegment reduces the number of data segments). Cheers Nick diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index f1a61e7bcee..54716110b61 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -372,7 +372,7 @@ if test -z "$TINY_READONLY_SECTION"; then *ro*textonly*) ALL_TEXT_BEFORE_RO=" " SEPARATE_TEXT=" " - TEXT_SEGMENT_ALIGN= + TEXT_SEGMENT_ALIGN=". = ALIGN(${MAXPAGESIZE});" ;; *textonly*) SEPARATE_TEXT=" "