From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 39B9638460A3 for ; Sun, 6 Jun 2021 09:56:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39B9638460A3 Received: by mail-wm1-x335.google.com with SMTP id l11-20020a05600c4f0bb029017a7cd488f5so8200705wmq.0 for ; Sun, 06 Jun 2021 02:56:06 -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=5dMvAAR8aQo4ZCGyENlhXefCDph6PNRRBop6bMz6wxQ=; b=KQgxMNE0YATI4peylJIzl+q6XGnI4lNRrOz4g5yxAr6fC/HwZx05s/nCQGS1jvo6E4 4qj0aQaQWnQEIhfCfoq4S+k5Habs338B/oTe/MEVEBAOqLG1CnERBVsXo8wQoISJy5SH kCeKJtInpZLQwiZsTmYewU4PpRCAGsTuaBJzn/1xdCJs0ujDinj3AcR5Eiq8BLPqUM6U INr9rRaQODrHHPALw3OPOfjn2i3bcRD5vByayPToSyS6nVSRQSKYpEf/QS3o1G1jVNFa M2rx0MXq7SfY6gzjN9cth3vPTBwmXNC/UrwJq/UQGwkqIRBRvNPw2YTxICUXikgYyznb /ktA== X-Gm-Message-State: AOAM531RFCV2e5sbA9HazpAIz+6PlDMPyunJ3jZXR/yTVXXXmekZwDi8 zTMTiYZBeS7EDQvLSxq702qQXbsGzQ8= X-Google-Smtp-Source: ABdhPJyHZaybgi54B4/DmegkUYlVSCT+TrbfKGUU5cEHj221G9vqUuNTXspgfp2ezHFlFo4fZWBcJg== X-Received: by 2002:a7b:c8d0:: with SMTP id f16mr12450022wml.115.1622973365398; Sun, 06 Jun 2021 02:56:05 -0700 (PDT) Received: from ?IPv6:2a01:cb05:8f8a:1800:2216:4e4e:b697:b4ce? (2a01cb058f8a180022164e4eb697b4ce.ipv6.abo.wanadoo.fr. [2a01:cb05:8f8a:1800:2216:4e4e:b697:b4ce]) by smtp.gmail.com with ESMTPSA id a16sm10395442wmm.3.2021.06.06.02.56.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Jun 2021 02:56:04 -0700 (PDT) Subject: Re: PIC/PIE issue on Nios2 To: Florian Weimer , Romain Naour via Libc-alpha References: <2d14e13a-2829-f3cf-7372-e84c8bfb342b@gmail.com> <87lf7zl21k.fsf@oldenburg.str.redhat.com> From: Romain Naour Message-ID: <69132793-b403-8323-9339-120ec607b3df@gmail.com> Date: Sun, 6 Jun 2021 11:56:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87lf7zl21k.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Sun, 06 Jun 2021 09:56:07 -0000 Hello, Le 28/05/2021 à 10:01, Florian Weimer a écrit : > * Romain Naour via Libc-alpha: > >> Analyzing one of the binary with strace show that the problem occur >> very early when starting the new process: >> >> # strace ./busybox >> execve("./busybox", ["./busybox"], 0x7f91ce90 /* 10 vars */) = -1 ENOMEM >> (Cannot allocate memory) >> +++ killed by SIGSEGV +++ >> >> I tried with several binutils/glibc/gcc version without any success. >> >> Is PIE is really supported for Nios2 architecture ? > > If the kernel cannot execve the executable at all, that looks more like > a linker problem. It could also be a kernel bug, of course. (Address > space layout is architecture-specific.) > > There is PIE and statically linked PIE. The latter should be supported > on all targets. Statically linked PIE requires toolchain changes and a > little bit of architecture-specific code in glibc. I don't know about the status of required toolchain changes for statically linked PIE for NiosII. The statically linked PIE option (--enable-static-pie) is not used to build the toolchain so (as you said) it look like a linker problem or kernel bug. I tried with the latest kernel version without success. For now, the PIC/PIE Buildroot option has been disabled for NiosII. Best regards, Romain > > Thanks, > Florian >