Wilco Dijkstra via Gcc-patches <[email protected]> writes:
> Hi Richard,
>> Hmm, OK. I guess it makes things more consistent in that sense
>> (PIC vs. non-PIC). But on the other side it's making things less
>> internally consistent for non-PIC, since we don't use the GOT for
>> anything else there. I guess in principle there's a danger that a
>> custom *-elf linker script might not bother to set up the .got properly,
>> on the assumption that it shouldn't be needed.
>
> The GOT is always used in executables (even an empty main function has
> a non-zero .got and .got.plt section).
The comment above was talking about *-elf scripts though. When I try
the following locally, no .got is used:
$ echo 'int main() { return 0; }' > foo.c
$ aarch64-none-elf-gcc foo.c -mcmodel=small --specs=aem-validation.specs
$ aarch64-none-elf-readelf --sections ./a.out
Thanks,
Richard