[PATCH] For FreeBSD on mips, pass -G options to the linker
Brooks Davis
brooks at one-eyed-alien.net
Fri May 29 14:10:46 PDT 2015
In http://reviews.llvm.org/D9114#181178, @dim wrote:
> In http://reviews.llvm.org/D9114#181174, @brooks wrote:
>
> > Even if this patch is incomplete with regards to the assembler, it is both necessary and sufficient to build and link programs with the current FreeBSD build system. It follows gcc's long established behavior as a linker and is harmless to other consumers so why not commit it?
>
>
> Sure, but maybe -G for the linker is not completely useful, if the assembler also doesn't use it?
Likely true, though we've managed to run quite a bit of code built without it. See http://reviews.llvm.org/D10137 for a fix to the non-integrated-as case.
> > All that being said, I'm not actually sure -G does anything at all when pasted to ld and as. The binutils documentation says it's only for ECOFF targets so in practice it may be a no-op.
>
>
> The GNU as documentation here: https://sourceware.org/binutils/docs/as/MIPS-Options.html#index-g_t_0040code_007b_002dG_007d-option-_0028MIPS_0029-1392 says:
>
> > Set the “small data” limit to n bytes. The default limit is 8 bytes. See Controlling the use of small data accesses.
>
>
> but it doesn't talk about ECOFF, and neither does the referenced section about "small data": https://sourceware.org/binutils/docs/as/MIPS-Small-Data.html
FreeBSD 10's as manpage says:
-G num
This option sets the largest size of an object that can be referenced implicitly with the "gp" register. It is only accepted for targets that use ECOFF format, such as a DECstation running Ultrix. The default value is 8.
> The GNU ld documentation here: https://sourceware.org/binutils/docs/ld/Options.html#index-g_t_002dG-_0040var_007bvalue_007d-47 says:
>
> > Set the maximum size of objects to be optimized using the GP register to size. This is only meaningful for object file formats such as MIPS ELF that support putting large and small objects into different sections. This is ignored for other object file formats.
>
>
> So it doesn't talk about ECOFF either, but explicitly mentions ELF...
FreeBSD 10's ld says:
-Gvalue
--gpsize=value
Set the maximum size of objects to be optimized using the GP register to size. This is only meaningful for object file formats such as MIPS ECOFF which supports putting large and small objects into different sections. This is ignored for other object file formats.
http://reviews.llvm.org/D9114
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list