[PATCH] Don't access items in .sdata section using gp-relative addressing when target is NaCl.

Mark Seaborn mseaborn at chromium.org
Mon Jun 9 13:17:37 PDT 2014


On 9 June 2014 11:03, Sasa Stankovic <Sasa.Stankovic at imgtec.com> wrote:

> Here is some explanation for it, but I'm not sure whether this should be
> in the commit message. This is also not supported in Linux, but I don't
> know the reason for it. But even if we enable gp-relative addressing in
> NaCl, it wouldn't work because MIPS Gold linker currently doesn't support
> it. For gp-relative addressing to work, linker needs to emit together all
> the sections that are accessed using gp-relative addressing (.got section
> first, followed by various small-data sections (.sdata, .sbss, ...)). This
> is currently not implemented in MIPS Gold. (In GNU ld, this section
> ordering is specified in ld's internal linker script, but Gold doesn't have
> internal linker script.)
>

If you don't explain this in the commit message or in the code, how would
someone reading the source code know the reason for making UseSmallSection
conditional on !isTargetNaCl()?  How would someone maintaining the code
know whether the !isTargetNaCl() check could be removed?

I think you should add a comment explaining this in the code.

Presumably the reason that UseSmallSection is disabled for Linux is that
LLVM is assuming that it might be being used with Gold?

Cheers,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140609/ef6ae078/attachment.html>


More information about the llvm-commits mailing list