picotool elf2uf2 fails on complex code - clang #2463
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#2463
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Actual problem
Background:
For some reason (I really don't know why)
clanggenerates.gotsection in the.elffile on some scenarios even with PIE and everything related to PIE disabled. It can't be deleted with stripping the elf file. If you delete it with 'objcopy' it won't fix the problem.The section is not used anywhere:
.gotsection never appears in the disassemblyllvm-objdump -s -j .got main.elf):That is probably useless.
Outcome:
picotool elf2uf2 fails with
ELF contains memory contents for uninitialized memory at ...error.The
.gotsection must be loaded into SRAM address space. This is impossible to reproduce using UF2 file format, as I know.How to reproduce:
That happened to me when I tried to create union of a fitfield structure and an integer. Some std:: functions also trigger this behavior.
To be precise, I currently use
clang 18.1.3 (1ubuntu1)andLLVM-ET-Arm-18.1.3-Linux-x86_64toolkit.Workaround
Filling the section with zeros as if it is unitialized works just fine. Considering this I suggest adding an option for elf2uf2 to force assemble uf2 with sections in SRAM forcibly left uninitialized.
A better long-term solution would be to implement a runtime loader for initialized data located in SRAM. This would require significant effort and might be overkill
Could you provide some example code to reproduce this, and/or an example ELF file?
Moving this to 2.3.0 as code to reproduce this, or an example ELF file, still hasn't been provided