gpt4 book ai didi

linux - 载荷段未对准

转载 作者:太空宇宙 更新时间:2023-11-04 12:05:07 25 4
gpt4 key购买 nike

在 linux 内核版本 4.14.41 中,只要对齐的 LOAD 段不是 2MB 的倍数,就会发生错误。但为什么不在 linux 内核版本 3.16.0 中执行相同的检查?另外,为什么不对任何 veriosn 的 32 位配置内核执行此检查?

最佳答案

在 linux-4.9.91 版本中发布了 64 位 2MB 倍数的 LOAD 段对齐检查。以下是 arch/x86/Makefile 的代码片段:

 #The 64-bit kernel must be aligned to 2MB.  Pass -z max-page-size=0x200000 to
#the linker to force 2MB page size regardless of the default page size used
#by the linker.
ifdef CONFIG_X86_64
LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
endif

这种类型的传递在以前的版本中不存在,但 64 位加载部分以 2MB 的倍数对齐。如果不遵循这种对齐方式,那么 4.9.91 及更高版本将产生错误 Alignment of LOAD Segments is not a multiple of 2MB 而其他版本会产生错误 Kernel is not a有效的 ELF 文件

关于linux - 载荷段未对准,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50990703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com