PCREL preinit/init/fini arrays?

Matt Thomas matt@3am-software.com
Mon Aug 18 20:47:00 GMT 2014


I'm adding support for a few new architectures to NetBSD I'm planning on using
the preinit/init/fini arrays rather than .init/.fini/.ctors/.dtors.

Rather than emitting relocation entries for the arrays, I'm thinking about making
each entry PC-relative to itself.  This would allow them to move to the .text
PT_LOAD program section since they could be read-only.  Having to compute the
address of each entry shouldn't be any more expensive than doing the R_RELATIVE 
relocation that the PCREL eliminates.

I can't think of any downsides, except for getting binutils to support it, but
maybe I'm overlooking something.  Am I? :)


More information about the Binutils mailing list