[libc-commits] [libc] [libc] [startup] add cmake function to merge separated crt1 objects (PR #75413)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Dec 20 08:25:43 PST 2023


nickdesaulniers wrote:

```
FAILED: projects/libc/startup/linux/crt1.o 
: && /usr/bin/clang++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fno-omit-frame-pointer -O1 -fsanitize=address -fdiagnostics-color -g -r projects/libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.crt1.dir/start.cpp.o -o projects/libc/startup/linux/crt1.o   && :
/usr/bin/ld: projects/libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.crt1.dir/start.cpp.o: in function `_start':
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/startup/linux/x86_64/start.cpp:144: multiple definition of `_start'; /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crt1.o:(.text+0x0): first defined here
```

So it looks like `_start` is multiply defined:
- crt1.o (from the system)
- start.cpp.o (from llvmlibc)

Can you see if this can be fixed forward quickly? Otherwise I can revert.

I suspect `-DLLVM_LIBC_FULL_BUILD=ON` are the broken builds.

https://github.com/llvm/llvm-project/pull/75413


More information about the libc-commits mailing list