[cfe-dev] Forcing default target, linker, includes

Simon Atanasyan via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 9 22:39:25 PST 2019


Hi,

On Sun, Nov 10, 2019 at 2:27 AM Chris Hanson via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> ignoring nonexistent directory "$IRIXSDK/usr/local/include"

[...]

> Why is clang cc1 saying $IRIXSDK/usr/include doesn’t exist, when it actually does?
> (Just to reiterate, I’m using $IRIXSDK in this email for concision, it actually gives
> the full path—which “ls” lists the contents of just fine.)

The message is about "$IRIXSDK/usr/local/include" but you say that
"$IRIXSDK/usr/include" exists.

> Why is lld trying to resolve an undefined reference within a shared library, and what
> can I do about it? (The _rld_new_interface symbol is filled in by rld when it loads libc,
> there’s no need for it to be resolved against anything.) I’m not super familiar with ELF
> unlike Mach-O so I’m kind of surprised by this.

LLD has many MIPS specific piece of code because this architecture
rather differs from other ones. But if you take a look at the code of
the GNU BFD linker you see that even MIPS-dedicated elfxx-mips.c file
has a lot of SGI-specific code because SGI differs from "general"
MIPS.

In particular, there is the following piece of code in the
_bfd_mips_elf_add_symbol_hook:
[[
  if (SGI_COMPAT (abfd)
      && (abfd->flags & DYNAMIC) != 0
      && strcmp (*namep, "_rld_new_interface") == 0)
    {
      /* Skip IRIX5 rld entry name.  */
      *namep = NULL;
      return TRUE;
    }
]]

In LLD you can try to handle that in the addReservedSymbols() function.

> Is it related to the warnings about local symbols in global parts of the symbol table in libc.so?
> Is there any way to suppress those too, or to have lld interpret them “properly” (as SGI intended
> in Irix 6.5.30, irrespective of what’s proper today)?

The error above is not related to these warnings. It looks like SGI
libraries violate ELF rule that all local symbols precede weak or
global symbols in each symbol table, and an index of first non-local
symbol is stored to sh_info. LLD checks this in the
SharedFile::parse() method.

-- 
Simon Atanasyan



More information about the cfe-dev mailing list