[llvm-bugs] [Bug 40134] New: __executable_start doesn't get added to executables

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 21 13:01:06 PST 2018


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

            Bug ID: 40134
           Summary: __executable_start doesn't get added to executables
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: thomasanderson at google.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

__executable_start (and other symbols like __ehdr_start) do not get added by
lld unless -shared is used.

$ cat main.c
#include <stdio.h>

extern char __executable_start;

int main(void) {
  printf("%p\n", &__executable_start);
  return 0;
}

$ clang main.c -c -o main.o -fpic

$ clang main.o -o main -fuse-ld=bfd

$ clang main.o -o main -fuse-ld=gold

$ clang main.o -o main.so -fuse-ld=lld -shared

$ clang main.o -o main -fuse-ld=lld
/usr/bin/ld.lld: error: main.c:(function main): undefined symbol
'__executable_start'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

-- 
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/20181221/c00eab7f/attachment.html>


More information about the llvm-bugs mailing list