PIC/PIE issue on Nios2

Romain Naour romain.naour@gmail.com
Thu May 27 22:21:04 GMT 2021


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


More information about the Libc-alpha mailing list