".flash.rodata" section is reported by readelf as writable

valeros
Posts: 1
Joined: Tue Jun 13, 2023 12:40 pm

".flash.rodata" section is reported by readelf as writable

Postby valeros » Tue Jun 13, 2023 1:04 pm

Hi there!

For some reason xtensa-esp32-elf-readelf reports the ".flash.rodata" section with the "WA" flags that means W (write), A (alloc):

Code: Select all

.flash.rodata     PROGBITS        3f400120 001120 0079c4 00  WA  0   0 16
According to the default linker script for sections https://github.com/espressif/esp-idf/bl ... ld.in#L363 the ".flash.rodata" section is located in the "default_rodata_seg" segment which is an alias for "drom0_0_seg". According to default memory LD script the "drom0_0_seg" segment is set as READONLY https://github.com/espressif/esp-idf/bl ... .ld.in#L86

Code: Select all

drom0_0_seg (R) :                  org = 0x3F400020, len = 0x400000-0x20
Am I missing something or this is intended behavior?

Additional info:

ESP-IDF version: 5.0.2
Host OS: Windows 10
Devboard: ESP32-DevKitC
Toolchain version: 11.2.0-2022r1

Full output with initial command:

Code: Select all

xtensa-esp32-elf-readelf.exe -S d:\esp-idf-v5.0\examples\get-started\hello_world\build\hello_world.elf
There are 40 section headers, starting at offset 0x24e288:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .rtc.text         PROGBITS        400c0000 02e010 000000 00   W  0   0  1
  [ 2] .rtc.dummy        PROGBITS        3ff80000 02e010 000000 00   W  0   0  1
  [ 3] .rtc.force_fast   PROGBITS        3ff80000 02e010 000000 00   W  0   0  1
  [ 4] .rtc.data         PROGBITS        50000000 02e000 000010 00  WA  0   0  8
  [ 5] .rtc_noinit       PROGBITS        50000010 02e010 000000 00   W  0   0  1
  [ 6] .rtc.force_slow   PROGBITS        50000010 02e010 000000 00   W  0   0  1
  [ 7] .iram0.vectors    PROGBITS        40080000 00c000 000403 00  AX  0   0  4
  [ 8] .iram0.text       PROGBITS        40080404 00c404 00b543 00  AX  0   0  4
  [ 9] .dram0.data       PROGBITS        3ffb0000 009000 002628 00  WA  0   0 16
  [10] .ext_ram_noinit   PROGBITS        3f800000 02e010 000000 00   W  0   0  1
  [11] .noinit           PROGBITS        3ffb2628 02e010 000000 00   W  0   0  1
  [12] .ext_ram.bss      PROGBITS        3f800000 02e010 000000 00   W  0   0  1
  [13] .dram0.bss        NOBITS          3ffb2628 00b628 0008e8 00  WA  0   0  8
  [14] .flash.appdesc    PROGBITS        3f400020 001020 000100 00   A  0   0 16
  [15] .flash.rodata     PROGBITS        3f400120 001120 0079c4 00  WA  0   0 16
  [16] .flash.rodat[...] PROGBITS        3f407ae4 02e010 000000 00   W  0   0  1
  [17] .flash.text       PROGBITS        400d0020 018020 01577f 00  AX  0   0  4
  [18] .iram0.text_end   NOBITS          4008b947 017947 000001 00  WA  0   0  1
  [19] .iram0.data       PROGBITS        4008b948 02e010 000000 00   W  0   0  1
  [20] .iram0.bss        PROGBITS        4008b948 02e010 000000 00   W  0   0  1
  [21] .dram0.heap_start PROGBITS        3ffb2f10 02e010 000000 00   W  0   0  1
  [22] .xt.prop          PROGBITS        00000000 02e010 01ccd4 00      0   0  1
  [23] .xt.lit           PROGBITS        00000000 04ace4 000c00 00      0   0  1
  [24] .xtensa.info      NOTE            00000000 04b8e4 000038 00      0   0  1
  [25] .comment          PROGBITS        00000000 04b91c 000066 01  MS  0   0  1
  [26] .debug_frame      PROGBITS        00000000 04b984 008b10 00      0   0  4
  [27] .debug_info       PROGBITS        00000000 054494 0ce710 00      0   0  1
  [28] .debug_abbrev     PROGBITS        00000000 122ba4 01a3df 00      0   0  1
  [29] .debug_loc        PROGBITS        00000000 13cf83 0343f4 00      0   0  1
  [30] .debug_aranges    PROGBITS        00000000 171378 0039a0 00      0   0  8
  [31] .debug_ranges     PROGBITS        00000000 174d18 0038b0 00      0   0  8
  [32] .debug_line       PROGBITS        00000000 1785c8 09b017 00      0   0  1
  [33] .debug_str        PROGBITS        00000000 2135df 01a244 01  MS  0   0  1
  [34] .debug_loclists   PROGBITS        00000000 22d823 00dd90 00      0   0  1
  [35] .debug_rnglists   PROGBITS        00000000 23b5b3 0003a4 00      0   0  1
  [36] .debug_line_str   PROGBITS        00000000 23b957 0016ad 01  MS  0   0  1
  [37] .symtab           SYMTAB          00000000 23d004 0099b0 10     38 1359  4
  [38] .strtab           STRTAB          00000000 2469b4 0076e1 00      0   0  1
  [39] .shstrtab         STRTAB          00000000 24e095 0001f1 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  p (processor specific)
Thanks in advance!

Who is online

Users browsing this forum: No registered users and 43 guests