[llvm-bugs] [Bug 30680] New: lld + LTO: symbol __start_($SECTION_NAME) is missing type

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 12 14:44:49 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30680

            Bug ID: 30680
           Summary: lld + LTO: symbol __start_($SECTION_NAME) is missing
                    type
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: krasin at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17429
  --> https://llvm.org/bugs/attachment.cgi?id=17429&action=edit
the reproducer

Consider the following shared object (the full reproducer is attached):

bar.cc:

__attribute((visibility("default"))) __attribute__ ((section("play_go")))
void* get_start();

extern "C" char __start_play_go[] __attribute__((weak));

void* get_start() {
  return reinterpret_cast<void*>(__start_play_go);
}

Basically, we put get_start function into play_go section and also use
__start_play_go symbol to keep it there.

Then we try to use this symbol from main.cc

#include <stdio.h>

extern "C" char __start_play_go[] __attribute__((weak));

int main(void) {
  printf("__start_play_go: %p\n", __start_play_go);
}

Building:

$ clang++ -shared -o libbar.so bar.cc
$ clang++ -c main.cc -flto
$ clang++ -o sections main.o libbar.so -flto -fuse-ld=lld
symbol __start_play_go is missing type
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)

I observe that while building Chromium, as tcmalloc uses this dark magic of
sections for hooks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161012/11b73c95/attachment.html>


More information about the llvm-bugs mailing list