Windows-on-ARM-Experiments / gcc-woarm64

Fork of gcc containing fixes for Windows on ARM64.
GNU General Public License v2.0
8 stars 1 forks source link

aarch64: Multiple adjustments to support the SMALL code model correctly #23

Closed eukarpov closed 1 month ago

eukarpov commented 2 months ago

LOCAL_LABEL_PREFIX has been changed to help the assembly compiler recognize local labels. The anchors have been disabled as they use symbol + offset, which is not applicable for COFF AArch64. Emitting locals has been replaced to use the .lcomm directive to declare uninitialized data without defining an exact section.

aarch64.cc has been adjusted to prevent emitting symbol + offset for SYMBOL_SMALL_ABSOLUTE. Instead, it will emit an offset with the "add" instruction to correct the address. The added code is a duplicate of the code from SYMBOL_SMALL_GOT_4G handling and will be refactored during the patch series preparation for the mailing list.

Functions and objects have been missing declarations. Binutils was not able to distinguish static from external, an object from a function.

PE_COFF_LEGITIMIZE_EXTERN_DECL has been disabled, as it is needed for MEDIUM and LARGE models with -fPIC. These models are not yet implemented for AArch64.

This fix relies on changes in binutils. aarch64: Fix IMAGE_REL_ARM64_PAGEBASE_REL21 relocation and symbol reduction for relocations

This change resolves the following issues: Relocation overflow when a struct is large Relocation overflow issue when building FFmpeg with -O3

Tested with CI: https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/9600219765

eukarpov commented 1 month ago

Thank you for the review. All comments will be addressed in the patch series preparation.