That is a very stupid question, but does "gcc -pie hello.o" work? What is your hello.lds?
EDIT: The offset 0 R/W segment is quite strange - your linker script maps the file header as R/W?
EDIT2: The linker (or kernel) might also just refuse to map something as RWE.
why won't this PIE run?
Re: why won't this PIE run?
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Re: why won't this PIE run?
That I thought as well, but the second load segment also has file size 0. There just isn't a .data section in the file, so no reference to any file data is made. I didn't even know this could happen.Korona wrote:EDIT: The offset 0 R/W segment is quite strange - your linker script maps the file header as R/W?
Carpe diem!