From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1255 invoked by alias); 22 Feb 2020 02:37:47 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 1239 invoked by uid 89); 22 Feb 2020 02:37:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:1049 X-HELO: mail-pg1-f176.google.com Received: from mail-pg1-f176.google.com (HELO mail-pg1-f176.google.com) (209.85.215.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 22 Feb 2020 02:37:46 +0000 Received: by mail-pg1-f176.google.com with SMTP id 6so1949110pgk.0 for ; Fri, 21 Feb 2020 18:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=DbGDFZm5WkEnnY6gNo5JzIShNvLFOaDd5IYtqXbskz0=; b=I/gxVPpfahafqNQo5FtjQ7HEPDnqnQ+XvOKICYfqV83Q03jCiqKlQ3MBq1ompEiOs/ TxcriLL+MNLl06QvoIFH2wcORzMEBaUJ3UfKOT9yKtJZeFVF/s8hiLsmlbU/AxoxUoCn G8Oy7wVwWuo0fsfAONpaq/q3JyxkSuvHuifkxPgtbqCXBOmJx+dlbzOB6ElbzbwRR448 kK5V5gIRZSMTJqnt44UfWtOXvIR/HvEf+UebEdtSTdH9Z7uvyBj5JXxKq3p4ozLygQbi sdm/hxVCUXPy6eu33ZbVm3E/RbthoeGfPhVaqC9f/E/iXv66VKUSBN5FIqFiHwKWhIxa zwCQ== Return-Path: Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:1049:a19b:757:8f38]) by smtp.gmail.com with ESMTPSA id m101sm3767989pje.13.2020.02.21.18.37.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 18:37:43 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 8782B82E0C; Sat, 22 Feb 2020 13:07:39 +1030 (ACDT) Date: Sat, 22 Feb 2020 02:37:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: PR25585, PHDR segment not covered by LOAD segment Message-ID: <20200222023739.GB5570@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00511.txt.bz2 I closed this bug as invalid, but I think it is worth mentioning in NEWS that older linkers didn't check PT_PHDR very well. The patch also allows people to force an output file with --noinhibit-exec after the error. bfd/ PR 25585 * elf.c (assign_file_positions_for_load_sections): Continue linking on "PHDR segment not covered by LOAD segment" errors. ld/ PR 25585 * NEWS: Mention better "PHDR segment not covered by LOAD segment" checking. diff --git a/bfd/elf.c b/bfd/elf.c index 4342e84752..4a6d31a75e 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -5926,7 +5926,11 @@ assign_file_positions_for_load_sections (bfd *abfd, _bfd_error_handler (_("%pB: error: PHDR segment not covered" " by LOAD segment"), abfd); - return FALSE; + if (link_info == NULL) + return FALSE; + /* Arrange for the linker to exit with an error, deleting + the output file unless --noinhibit-exec is given. */ + link_info->callbacks->info ("%X"); } /* Check that all sections are in a PT_LOAD segment. diff --git a/ld/NEWS b/ld/NEWS index f659ccfc06..7734d23d5b 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -2,6 +2,12 @@ Changes in 2.34: +* The ld check for "PHDR segment not covered by LOAD segment" is more + effective, catching cases that were wrongly allowed by previous versions of + ld. If you see this error it is likely you are linking with a bad linker + script or the binary you are building is not intended to be loaded by a + dynamic loader. In the latter case --no-dynamic-linker is appropriate. + * cr16c support removed. * Add support for z80-elf. -- Alan Modra Australia Development Lab, IBM