This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How to get the default linker script used by gcc?
Pan ruochen <panruochen@gmail.com> writes:
> In fact, I want to append the following scripts
>
> SECTIONS {
> .array : {
> array = ABSOLUTE(.);
> res.o (.data)
> array_size = ABSOLUTE(.) - array;
> }
> }
> to the default linker script used by ld.
> Is there any simple way to do this, except copying and modifying the
> default linker script?
It looks like all you want is a way to get the address and size of the
.array section. If you give the section a name which can be used as a
variable name in C (i.e., no '.' character) then the linker will
automatically define __start_SECNAME and __stop_SECNAME symbols which
you can use.
http://www.airs.com/blog/archives/56
Ian