From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 14229385380D for ; Thu, 27 May 2021 22:21:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 14229385380D Received: by mail-wm1-x332.google.com with SMTP id f20-20020a05600c4e94b0290181f6edda88so3478266wmq.2 for ; Thu, 27 May 2021 15:21:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=0SDEv4f2W/iDLKX8o4hjr/GHM5E3tP+Cr1x7IjSSxsQ=; b=ZrkTLlYXWx1kN+nb65h6Ewt7y6NWvfEFmCEnyBpF6s3EFYmDj+Mdw7Dw2Yc3h8Z4hF eOozADlWiGiQqJIy5qb4DL7d5/CL5YnNLYMNrH9XBaU2SKB687PrieiGDNJkcOMkAyEo gBGQJbWSFxnW8Fx2X8GqKJ0imeA73INpkImPB1U3PtpNLsNOnf7JZIuSc7GeT94ZFd/o E7ODfzLPP45A07z4L5wjr+15+n2fn7GjnGTkubXhYQKz6rvWJ7xi1nWt+gn+ZrLT+XbB rSJlXBe/9pPzuoG7/PRc4qKgfvKU45zmfSCXpsOQQ6kV+zgOl5uxLpbIMv2c+ixjj91o 7UUQ== X-Gm-Message-State: AOAM530VlnmhnphLe7r+kj3Jmyzh1jGbl8odKXnZc3LKwr8Qn0iYnTmt 4IAlztZXM7GQjUKn1der9bflljFrC5k= X-Google-Smtp-Source: ABdhPJw/nhynZCsxRqmgunxwGPSF+MQ/umCNSL6gxUHkloGq2qyRHrg3z3gjbiUSfgTZJnoAGcHLwg== X-Received: by 2002:a1c:b646:: with SMTP id g67mr5395642wmf.117.1622154066172; Thu, 27 May 2021 15:21:06 -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 y14sm4686020wrr.82.2021.05.27.15.21.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 May 2021 15:21:05 -0700 (PDT) From: Romain Naour To: GNU C Library Subject: PIC/PIE issue on Nios2 Message-ID: <2d14e13a-2829-f3cf-7372-e84c8bfb342b@gmail.com> Date: Fri, 28 May 2021 00:21:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, 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: Thu, 27 May 2021 22:21:10 -0000 Hello, The Buildroot project now generate Position-Independent Code (PIC) and link Position-Independent Executables (PIE) by default. This add -fPIE or -pie flag at compile/link time while building the toolchain and the rootfs. On Nios2 architecture this produce non working executable crashing the system while starting the init process. Run /init as init process with arguments: /init with environment: HOME=/ TERM=linux Failed to execute /init (error -12) See: Buildroot build log and Qemu runtime test log in build artifacts: https://gitlab.com/buildroot.org/buildroot/-/jobs/1285145889 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 ? Best regards, Romain