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

            Bug ID: 23390
           Summary: lld produces invalid executable when statically
                    linking against pthread
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

% cat thread.c
#include <pthread.h>

pthread_mutex_t mtx;

int
main(void)
{
  pthread_mutex_lock(&mtx);

  return (0);
}

% clang thread.c -o thread -c
% /exps/llvm/build/bin/lld -flavor gnu -Bstatic -o thread /usr/lib/crt1.o
/usr/lib/crti.o /usr/lib/crtbeginT.o -L/usr/lib thread.o -lpthread -lgcc
-lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/crtend.o /usr/lib/crtn.o
% ./thread
Segmentation fault (core dumped)


lldb not really helpful here:
% /exps/llvm/build/bin/lldb ./thread
(lldb) target create "./thread"
Current executable set to './thread' (x86_64).
(lldb) run
Process 37235 launching
Killed

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to