[all-commits] [llvm/llvm-project] 2bc994: [libc] major refactor of startup library (#76092)

Schrodinger ZHU Yifan via All-commits all-commits at lists.llvm.org
Thu Jan 4 12:51:29 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2bc994456c5be2ab6d98b94de2349302577a9823
      https://github.com/llvm/llvm-project/commit/2bc994456c5be2ab6d98b94de2349302577a9823
  Author: Schrodinger ZHU Yifan <yifanzhu at rochester.edu>
  Date:   2024-01-04 (Thu, 04 Jan 2024)

  Changed paths:
    M libc/cmake/modules/LLVMLibCTestRules.cmake
    M libc/config/linux/app.h
    M libc/startup/linux/CMakeLists.txt
    M libc/startup/linux/aarch64/CMakeLists.txt
    M libc/startup/linux/aarch64/start.cpp
    A libc/startup/linux/aarch64/tls.cpp
    A libc/startup/linux/do_start.cpp
    A libc/startup/linux/do_start.h
    M libc/startup/linux/riscv/CMakeLists.txt
    M libc/startup/linux/riscv/start.cpp
    A libc/startup/linux/riscv/tls.cpp
    M libc/startup/linux/x86_64/CMakeLists.txt
    M libc/startup/linux/x86_64/start.cpp
    A libc/startup/linux/x86_64/tls.cpp

  Log Message:
  -----------
  [libc] major refactor of startup library (#76092)

* separate initialization routines into _start and do_start for all
architectures.
* lift do_start as a separate object library to avoid code duplication.
* (addtionally) address the problem of building hermetic libc with
-fstack-pointer-*

The `crt1.o` is now a merged result of three components:

```
___
  |___ x86_64
  |      |_______ start.cpp.o    <- _start (loads process initial stack and aligns stack pointer)
  |      |_______ tls.cpp.o      <- init_tls, cleanup_tls, set_thread_pointer (TLS related routines) 
  |___ do_start.cpp.o            <- do_start (sets up global variables and invokes the main function) 
```




More information about the All-commits mailing list