From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 97D99383E80F for ; Mon, 25 May 2020 14:54:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 97D99383E80F Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-0OfKBBEROOed9LO9BVsoew-1; Mon, 25 May 2020 10:54:12 -0400 X-MC-Unique: 0OfKBBEROOed9LO9BVsoew-1 Received: by mail-wm1-f72.google.com with SMTP id u15so64714wmm.5 for ; Mon, 25 May 2020 07:54:12 -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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wLqYRE3XLkDOQrLzUsPjXWrlbAx/W7p0bQvUQ2PEbkA=; b=b5pW5mppuhQSDkQkkcaAaLp4vOufHNaHq1ayu5BddYqvKFHYgzQ2Neqjzx+CysrJdK Yl2MFLbXp96BYlDEX6LwcpU/2J1h1sp2UqPqAkNmfmGcpIYXYBrj7ss18SQJwi+ao8V7 S/ozfwnLpbvMTcoKRl2UtuEUYc1zBJbyPXe8vBWy9GCPjbTcQs6gYdVfc4aXynMbogSh 0+sWFbUWAAFQAhTEUhhlFa9ZAr22Jsr+/jiVSLhLZxxCisujmbDs/BksXbPSskb3s+JZ jmD2sRSqpDXUU4ZWfFwB5tl+jAabvJTi0Ao7MyApIC9bbTZH4hGtIdVw6dQGv1xfowSh E1Pw== X-Gm-Message-State: AOAM532B5SA8N+NtN9jcM6l1SLzdcIUTC6hUPX0wPoIFE+b7lACqKeGL fBB3WMjzt7JkSCfylT2WYbEK9n99NIsryjl7OWDzNnAH78VZ/j73CO+iT8CKYM0nHgwCZoyvno1 7kCcgl7ij4qBukxutKemttg== X-Received: by 2002:a1c:544d:: with SMTP id p13mr6670107wmi.25.1590418451158; Mon, 25 May 2020 07:54:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDF88uhNLpEdwIXcQbKgG6s7KRzn4BOMYtZfJJnPeWBZ/33vh5e2IMqcbaTsnyQTMmfZFIpw== X-Received: by 2002:a1c:544d:: with SMTP id p13mr6670094wmi.25.1590418451017; Mon, 25 May 2020 07:54:11 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:2327:23ca:3e56:ef5f? ([2001:8a0:f909:7b00:2327:23ca:3e56:ef5f]) by smtp.gmail.com with ESMTPSA id x10sm19168503wrn.54.2020.05.25.07.54.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 May 2020 07:54:10 -0700 (PDT) Subject: Re: [committed][gdb/testsuite] Fix exec_is_pie with gold linker To: Tom de Vries , gdb-patches@sourceware.org References: <20200525100237.GA6162@delia> From: Pedro Alves Message-ID: Date: Mon, 25 May 2020 15:54:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20200525100237.GA6162@delia> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2020 14:54:15 -0000 On 5/25/20 11:02 AM, Tom de Vries wrote: > Hi, > > When running test-case gdb.base/break-interp.exp with target board gold, we > run into: > ... > gdb compile failed, pie failed to generate PIE executable > ... > > The problem is that the proc exec_is_pie uses the PIE flag in the readelf -d > output, which doesn't seem to be set by the gold linker. Seems like a Gold bug? A comment in exec_is_pie explaining why we don't do the more obvious thing would be helpful, IMO. > @@ -5509,11 +5509,12 @@ proc exec_is_pie { executable } { > return -1 > } > set readelf_program [gdb_find_readelf] > - set res [catch {exec $readelf_program -d $executable} output] > + set res [catch {exec $readelf_program -h $executable} output] > if { $res != 0 } { > return -1 > } > - set res [regexp -line {\(FLAGS_1\).*Flags:.* PIE($| )} $output] > + set res [regexp -line {^[ \t]*Type:[ \t]*DYN \(Shared object file\)$} \ > + $output] > if { $res == 1 } { > return 1 > } > Thanks, Pedro Alves