Page MenuHomePhabricator

TF-A fails to build with clang 16 and lld: section type mismatch
Open, Needs TriagePublic


When building TF-A with clang 16 and lld. It has below error:

ld.lld: error: section type mismatch for base_xlat_table
>>> /ssd/android/trusty/build-root/build-qemu-generic-arm32-gicv3-test-debug/atf/qemu/debug/bl2/xlat_tables_context.o:(base_xlat_table): SHT_PROGBITS
>>> output section .bss: SHT_NOBITS

ld.lld: error: section type mismatch for xlat_table
>>> /ssd/android/trusty/build-root/build-qemu-generic-arm32-gicv3-test-debug/atf/qemu/debug/bl2/xlat_tables_context.o:(xlat_table): SHT_PROGBITS
>>> output section xlat_table: SHT_NOBITS

When linking, TF-A uses linker script to put sections in SHT_PROGBITS type to output sections in SHT_NOBITS type.
This used to be okay. But lld tightens its check in and
lld gives a warnings when seeing this section type mismatch.
TF-A uses --fatal-warnings when linking, thus making the warning into an error.

To fix such error, the suggestion from lld maintainer is to avoid section type mismatch by modifying linker script. I don't know if it is feasible here.
Another choice is to remove --fatal-warnings, which may weaken other checks.

Event Timeline

yabinc created this task.Fri, Jan 13, 12:01 AM