From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A8BA31F5AE for ; Wed, 29 Jul 2020 07:10:18 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CF9C386102C; Wed, 29 Jul 2020 07:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CF9C386102C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1596006613; bh=7YQXTP8vxD87yn0KnDfkekRwyQVE+2AV8eD7kJYX9F0=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=XbkH3EqVgCmPWFd11QpGQOPKnNiRpOU7v1s+nxDy9YYL5mnOTpBT1N6Z7W3S6O0G0 QHDEhzrk/bSpU5ToaPntk9FNCbqnBxuqR/kszmeTa9UskKsXWNFJEb/WmFDynspO3B ra20u5yVj5zDh8IPxQngTFBVb9JwSEeyHKK0KooQ= Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id B32423857C7F; Wed, 29 Jul 2020 07:10:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B32423857C7F Received: by mail-pf1-x431.google.com with SMTP id y206so2181809pfb.10; Wed, 29 Jul 2020 00:10:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7YQXTP8vxD87yn0KnDfkekRwyQVE+2AV8eD7kJYX9F0=; b=M5AiH7J1Z9ifEQOyOoaT1eJ5nem95pCo9VCsziSvI7/BKJ4vyo5SF7OEALI5hRJ2ua IsaoK4PW9KnRJrh5azjr7y/Yh8rnUxjwYASvv129xiHUX5PvNk7UbTmoMwG0f6V16O61 i8Lz0XGhARzzhSvzHWekFQbAgvCy/20tv3ZIwe7Gjx0FV5e2tJsheLEKpmuE6Xhevxy0 rZNFG/xRAyjoEdlHhFSL5AquY1Mquy3deqqK9862137ioJ0DwoBFeW3M3OKph8Jq5p+8 6Cp+Vyn39/n9LG9F2ZV6SvOwpba4Ztemejka6YcWqtFAR0b0ttHrN3wFb7UYmdiGa1XY oCtA== X-Gm-Message-State: AOAM531k7dwOJr5bSM14vWuBbrEDHWl5aJhVisnCE1BF4T9efcN/RPwP U4YcK55OgUL8eAPgOuAqiNmaSVxEkUo= X-Google-Smtp-Source: ABdhPJwCAUXDOF9MF78Owd1PzjkucAptbHuNG6fQ0373lZJA8uRuVitmFf/b+5RdPeINtBVFypLGkg== X-Received: by 2002:a65:67d0:: with SMTP id b16mr28672342pgs.60.1596006608754; Wed, 29 Jul 2020 00:10:08 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:b455:1b34:fcf0:bb28]) by smtp.gmail.com with ESMTPSA id cu2sm1102944pjb.6.2020.07.29.00.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 00:10:07 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 119EC8801F; Wed, 29 Jul 2020 16:40:03 +0930 (ACST) Date: Wed, 29 Jul 2020 16:40:02 +0930 To: Joseph Myers Subject: Re: Emit a warning when -z relro is unsupported Message-ID: <20200729071002.GP9601@bubble.grove.modra.org> References: <20200619024818.GA21885@bubble.grove.modra.org> <20200729003850.GO9601@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="OXfL5xGRrasGEqWY" Content-Disposition: inline In-Reply-To: <20200729003850.GO9601@bubble.grove.modra.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Alan Modra via Libc-alpha Reply-To: Alan Modra Cc: libc-alpha@sourceware.org, binutils@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I believe the ia64-linux glibc problem is triggered by a fairly simple glibc build bug. There is a linker bug too. I was able to reproduce the problem, with .IA_64.unwind__libc_freeres_fn being mapped to bfd_abs_section, which is what happens when a section is discarded by a linker script. On looking at glibc/shlib.lds I see toward the end: .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_/home/local/bin/../lib/gcc/ia64-linux/9.3.1/../../../../ia64-linux/bin/ld: warning: -z relro ignored *) } } Uh oh, the script will discard all orphan sections due to *(*) appearing. (Yes there are some odd section match patterns before that from the warning, but the final * gets everything.) Now .IA_64.unwind__libc_freeres_fn is not an orphan, but it is SHF_LINK_ORDER and __libc_freeres_fn is its linked-to section, and that one is an orphan. ldelf_before_place_orphans handles linked-to sections, correctly discarding .IA_64.unwind__libc_freeres_fn but failing to set SEC_EXCLUDE which would avoid the ldwrite.c assertion. glibc patch attached -- Alan Modra Australia Development Lab, IBM --OXfL5xGRrasGEqWY Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0006-Don-t-mix-linker-error-messages-into-edited-scripts.patch" >From 3425515f19d47eb2e13180fe031d94a9c13ce39b Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 29 Jul 2020 16:28:57 +0930 Subject: Don't mix linker error messages into edited scripts * Makerules (shlib.lds): Discard linker warning output. (format.lds): Likewise. diff --git a/Makerules b/Makerules index 341db86c7e..ef0fe67d9a 100644 --- a/Makerules +++ b/Makerules @@ -557,7 +557,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules $(LINK.o) -shared -Wl,-O1 \ -nostdlib -nostartfiles \ $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ - -Wl,--verbose 2>&1 | \ + -Wl,--verbose 2>/dev/null | \ sed > $@T \ -e '/^=========/,/^=========/!d;/^=========/d' \ $(if $(filter yes,$(have-hash-style)), \ @@ -1073,7 +1073,7 @@ ifneq (unknown,$(output-format)) else $(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \ $(LDFLAGS.so) $(LDFLAGS-lib.so) \ - -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \ + -x c /dev/null -o $@.so -Wl,--verbose -v 2>/dev/null \ | sed -n -f $< > $@.new test -s $@.new rm -f $@.so --OXfL5xGRrasGEqWY--