From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117001 invoked by alias); 27 Sep 2018 03:25:53 -0000 Mailing-List: contact gnu-gabi-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: gnu-gabi-owner@sourceware.org Received: (qmail 116977 invoked by uid 89); 27 Sep 2018 03:25:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=H*f:sk:d9BOR3c, H*f:ux4YRVbfWQBR, H*i:sk:d9BOR3c, H*i:ux4YRVbfWQBR X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mail-yw1-f42.google.com Received: from mail-yw1-f42.google.com (HELO mail-yw1-f42.google.com) (209.85.161.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Sep 2018 03:25:51 +0000 Received: by mail-yw1-f42.google.com with SMTP id e201-v6so516125ywa.3 for ; Wed, 26 Sep 2018 20:25:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=xxLXMXAKh1n3vKlyLiclS72zA8XzSheqNuQThpMvKSk=; b=r3RmaR8mgfBqHSc4AttU5CH+B2cRt45OYSlueAAJKR0ZqLdW5HMSvfgIjtLKQXoDg1 G4M42LFnAeLmkTr3/59tlx+AsQsk0aj/AhOP2gN6xfim+/KyzeQQogENg0wKRtgrsHXB hopzGKE23wxx1sQNXvR5zgPAd9rUbcBIdmPyLKsLaZMqbMIZu6PZwWxzV4xqF+JYOkMN pZ8QYxUELdqmI0CCushWJJ1p/Wz3JA02UlFdwxq20SWHWzDgdKCJEf1Q7dFd5Yj/g1Pv 4zRCzOhUnmD5TtqGSJ3/4vH6m5B4HqLBNl5ya3ukyLGsPqOjOM6ReB3p0o4lqxcS6pFV vUuQ== X-Gm-Message-State: ABuFfohdSZsxhqyzzIiJ1bgwbe/yzaiv6MvSyxN0iuQlwWIFXbjPsmfo 310Wk1E3mm0GarIBWBeGhLJsWg== X-Google-Smtp-Source: ACcGV61LIY6UiwkW1VhiQG3Asc7uJ/Dbogk9YRE0R0NXk24zLM5v+HCmuMwXhhz4F3/p+DuGNjXKaA== X-Received: by 2002:a81:9f07:: with SMTP id w7-v6mr4649678ywg.279.1538018750054; Wed, 26 Sep 2018 20:25:50 -0700 (PDT) Received: from [10.150.73.190] (247.sub-174-196-128.myvzw.com. [174.196.128.247]) by smtp.gmail.com with ESMTPSA id i142-v6sm965145ywe.11.2018.09.26.20.25.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 20:25:49 -0700 (PDT) Subject: Re: RFC: Add SHT_GNU_PHDRS To: "H.J. Lu" , gnu-gabi@sourceware.org, Binutils References: From: Carlos O'Donell Openpgp: preference=signencrypt Organization: Red Hat Message-ID: <15814b22-551c-91a9-4b23-397e374cfd18@redhat.com> Date: Mon, 01 Jan 2018 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-q3/txt/msg00007.txt.bz2 On 9/26/18 5:53 PM, H.J. Lu wrote: > When -z separate-code is used to create executable, ld won't place any > data in the code-only PT_LOAD segment. If there are no data sections > placed before the code-only PT_LOAD segment, the program headers > won't be mapped into any PT_LOAD segment. When the executable tries > to access it (based on the program header address passed in AT_PHDR), > it will lead to segfault. > > I am proposing > > #define SHT_GNU_PHDRS 0x6ffffff4 /* Dummy section for program header */ > > This is a special read-only SHF_ALLOC zero-size data section. It is the > first output section, which will force a data PT_LOAD segment with program > header before the code-only PT_LOAD segment, This seems like a huge hack to me. Either ld ensures that the page-aligned start of the PT_LOAD mapping includes the program headers, or we have to define SHT_GNU_PHDRS as having exactly that semantic and we need to clearly explain what a static linker needs to do to accomplish this task. What you have here needs more documentation. -- Cheers, Carlos.