2
0

init_dragonos_toolchain.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # 当前脚本用于初始化自定义的Rust工具链
  2. if [ -z "$(which cargo)" ]; then
  3. echo "尚未安装Rust,请先安装Rust"
  4. exit 1
  5. fi
  6. DRAGONOS_UNKNOWN_ELF_PATH=$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-dragonos
  7. mkdir -p ${DRAGONOS_UNKNOWN_ELF_PATH}/lib
  8. echo $DRAGONOS_UNKNOWN_ELF_PATH
  9. # 设置工具链配置文件
  10. echo \
  11. "{\
  12. \"arch\": \"x86_64\",
  13. \"code-model\": \"kernel\",
  14. \"cpu\": \"x86-64\",
  15. \"os\": \"dragonos\",
  16. \"target-endian\": \"little\",
  17. \"target-pointer-width\": \"64\",
  18. \"target-c-int-width\": \"32\",
  19. \"data-layout\": \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128\",
  20. \"disable-redzone\": true,
  21. \"features\": \"-3dnow,-3dnowa,-avx,-avx2\",
  22. \"linker\": \"rust-lld\",
  23. \"linker-flavor\": \"ld.lld\",
  24. \"llvm-target\": \"x86_64-unknown-none\",
  25. \"max-atomic-width\": 64,
  26. \"panic-strategy\": \"abort\",
  27. \"position-independent-executables\": true,
  28. \"relro-level\": \"full\",
  29. \"stack-probes\": {
  30. \"kind\": \"inline-or-call\",
  31. \"min-llvm-version-for-inline\": [
  32. 16,
  33. 0,
  34. 0
  35. ]
  36. },
  37. \"static-position-independent-executables\": true,
  38. \"supported-sanitizers\": [
  39. \"kcfi\"
  40. ],
  41. \"target-pointer-width\": \"64\"
  42. }" > ${DRAGONOS_UNKNOWN_ELF_PATH}/target.json || exit 1