Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22194

GCC Linker Script Ignore PHDR / PHDRS?

$
0
0

I'm trying to target a flat file for the output of my code, where I don't want PHDR. But it seems no matter how I set things up, in modern GCC versions, I can't avoid PHDR.

Either I get PHDR segment not covered by LOAD segment or if I define a PHDRS property as in my linker script as follows:

PHDRS{    header PT_NULL FILEHDR;    text PT_NULL PHDRS;    data PT_NULL FILEHDR;}

but throw it out, I get the error no sections assigned to phdrs

I can't seem to find any way to force GCC to just trust me and not emit the PHDRs. What can I put in my linker script to tell GCC that I really mean it.

EDITI found this: https://sourceware.org/bugzilla/show_bug.cgi?id=25585

If I add the following to my GCC invocation, it seems to output the binary anyway: -Wl,--noinhibit-exec

But, it now includes extra header data in the middle of the binary image.


Viewing all articles
Browse latest Browse all 22194

Trending Articles