Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Nov 2018 21:11:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 233397] llvm-objdump doesn't work with statically linked binary: "index past the end of the symbol table"
Message-ID:  <bug-233397-227-MRmAb3P9Go@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-233397-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233397

--- Comment #10 from Ed Maste <emaste@freebsd.org> ---
/usr/local/bin/objdump: a.out symbol number 1030 references nonexistent
SHT_SYMTAB_SHNDX section
/usr/local/bin/objdump: a.out: File in wrong format

% readelf -s a.out | grep '^ *1030:'
  1030: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   65535 __rela_iplt_end

These symbols are added by:

// The beginning and the ending of .rel[a].plt section are marked
// with __rel[a]_iplt_{start,end} symbols if it is a statically linked
// executable. The runtime needs these symbols in order to resolve
// all IRELATIVE relocs on startup. For dynamic executables, we don't
// need these symbols, since IRELATIVE relocs are resolved through GOT
// and PLT. For details, see http://www.airs.com/blog/archives/403.
template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() {
  if (!Config->Static)
    return;
  StringRef S = Config->IsRela ? "__rela_iplt_start" : "__rel_iplt_start";
  addOptionalRegular(S, InX::RelaIplt, 0, STV_HIDDEN, STB_WEAK);

  S = Config->IsRela ? "__rela_iplt_end" : "__rel_iplt_end";
  addOptionalRegular(S, InX::RelaIplt, -1, STV_HIDDEN, STB_WEAK);
}

So what I think happens is when we have ifuncs these special symbols are
emitted with Ndx set to the appropriate iplt section (.rela.plt), but when we
have no ifuncs we still emit the symbols but there is no section for them to
refer to.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-233397-227-MRmAb3P9Go>