本文介绍了elf文件中的.rodata.str1.8部分是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 .rodata 部分将常量数据存储在ELF文件中。但是,当我转储内核模块的ELF时,我注意到有两个额外的部分分别名为 rodata.str1.8 rodata.str1。 1 。似乎这两部分也存储常数变量和字符串。但是这三个 rodata 之间到底有什么区别?

I know the .rodata section stores constant data in an ELF file. However, when I dump an ELF of a kernel module, I notice that there are two extra sections named rodata.str1.8 and rodata.str1.1. It seems that these two sections store constant variables and strings as well. But what exactly are the differences between these three rodata?

推荐答案

它看起来 .rodata.str1.1 的字符串没有对齐要求,而 .rodata.str1.8 必须为8字节对齐。如果您查看带有 readelf 的ELF文件,则可见:

It looks like .rodata.str1.1 has strings without alignment requirements, while .rodata.str1.8 must be 8-byte aligned. If you look at an ELF file with readelf this is visible:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00000000 000034 000050 00  AX  0   0  4
  [ 2] .rela.text        RELA            00000000 000184 000030 0c   I  8   1  4
  [ 3] .data             PROGBITS        00000000 000084 000000 00  WA  0   0  1
  [ 4] .bss              NOBITS          00000000 000084 000000 00  WA  0   0  1
  [ 5] .rodata.str1.8    PROGBITS        00000000 000088 000010 01 AMS  0   0  8   <---
  [ 6] .comment          PROGBITS        00000000 000098 000019 01  MS  0   0  1
  [ 7] .shstrtab         STRTAB          00000000 0001b4 000049 00      0   0  1
  [ 8] .symtab           SYMTAB          00000000 0000b4 0000a0 10      9   7  4
  [ 9] .strtab           STRTAB          00000000 000154 00002f 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

这篇关于elf文件中的.rodata.str1.8部分是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 19:56