Page 1 of 1

Re: why won't this PIE run?

Posted: Sat Mar 16, 2019 12:19 pm
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.

Re: why won't this PIE run?

Posted: Sat Mar 16, 2019 1:39 pm
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.