Re: Make GCC initialize global variable using instructions instead of assembly directive such as .long or .quad

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 20, 2020 at 05:33:07PM -0500, Arvind Sankar wrote:
> 
> If you're not going to be using a libc, your options would be to either
> avoid constructs that result in run-time relocations being needed (such
> as initializing global variables to the address of some
> function/variable), or add at least some minimal relocation processing
> in your startup code -- it might be possible to just extract the
> static-pie bits you need from musl without having to bring in the whole
> library, as these are pretty small, looks like less than 100 lines of
> actual code + a few include files to get definitions.

If you go the route of pulling the code out of musl, note that it only
handles {R_386,R_X86_64}_RELATIVE relocations. For normal code with
recent gcc/binutils, that should be enough, but you might want to check
that you don't have anything else appearing in your program.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux