[PATCH] For FreeBSD on mips, pass -G options to the linker

Dimitry Andric dimitry at andric.com
Fri May 29 12:38:58 PDT 2015


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?

> 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

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...


http://reviews.llvm.org/D9114

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list