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: unassignedb...@nondot.org
          Reporter: thomasander...@google.com
                CC: llvm-bugs@lists.llvm.org, peter.sm...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to