why won't this PIE run?

Programming, for all ages and all languages.
Post Reply
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: why won't this PIE run?

Post by Korona »

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.
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].
nullplan
Member
Member
Posts: 1766
Joined: Wed Aug 30, 2017 8:24 am

Re: why won't this PIE run?

Post by nullplan »

Korona wrote:EDIT: The offset 0 R/W segment is quite strange - your linker script maps the file header as R/W?
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.
Carpe diem!
Post Reply