From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psionic.psi5.com (psionic.psi5.com [185.187.169.70]) by sourceware.org (Postfix) with ESMTPS id 5C3E53858D28 for ; Fri, 17 Nov 2023 08:08:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C3E53858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hogyros.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hogyros.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C3E53858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.187.169.70 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700208534; cv=none; b=Xw61WbLlGd87BE6Ys8zzksk7yACR1V/ZlE3jBaa5hFLErs6SbZakztfNoU5KSygM2//9AL5QUBtKaSEHCkXJlcNgn+m0KDCnjL5cskcixFAlOFtgsAyJvPNo9VGpmsKzxx5MaaG8xY/qv/Wl0go9uQaUk8TDUxBcmZpOilThsaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700208534; c=relaxed/simple; bh=KD4KTYXxQJ2rZloq+bEyM4TzEI0FP8DS1rGc//xqR5Y=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=hwlSS/l26zNu2vtL2MolQjNSK+JBNjIZiu0/gucF7fGciDjf3kV+8/5jBuToP6AEMqsG+CDGi9eswOTdZcU95P7FH8dThCegUUmqFop4gSviwHV+zkK0xabkKD5Yzohh/fzTS8bk6e0nGXNi4Huw0sFVNXmml+CefQX59jy41k0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [IPV6:2400:2410:b120:f200:8de:445b:204d:c308] (unknown [IPv6:2400:2410:b120:f200:8de:445b:204d:c308]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by psionic.psi5.com (Postfix) with ESMTPSA id 3EFB23F109 for ; Fri, 17 Nov 2023 09:08:50 +0100 (CET) Message-ID: <765a162a-e44d-45c2-95d0-28c0ca47114f@hogyros.de> Date: Fri, 17 Nov 2023 17:08:47 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Feature request: spare program headers To: binutils@sourceware.org References: <03e9069f821eb383d1391f0a7f8b70f6@gmail.com> Content-Language: en-US From: Simon Richter In-Reply-To: <03e9069f821eb383d1391f0a7f8b70f6@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,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 List-Id: Hi, On 11/17/23 12:23, Matheus Afonso Martins Moreira wrote: > There turned out to be a simple and effective solution to my problem: > the linker appends a number of empty PT_NULL entries to the PHDRs table. > This allows post processing tools to overwrite those null headers > in any way they want without impacting normal linker operations. You can specify PHDRs in your linker script. For example, PHDRS { one 0; two 0; } $ ld -o test.elf -x test.x ld: warning: cannot find entry symbol _start; not setting start address $ objdump -p test.elf test.elf: file format elf64-x86-64 Program Header: NULL off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- NULL off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3 filesz 0x0000000000000000 memsz 0x0000000000000000 flags --- Simon