Sun Sep 15 03:31:04 UTC 2024: ## Running 32-bit Applications on 64-bit ARM Linux: The vDSO Challenge

**Innsbruck, Austria -** While running legacy 32-bit applications on 64-bit ARM Linux (AArch64) is common, it comes with a potential performance pitfall that could impact real-time applications.

The issue lies in the **virtual dynamic shared object (vDSO)**, a crucial component that allows applications to perform certain system calls without switching to the kernel context, leading to faster execution. However, enabling the **CONFIG_COMPAT** option in the AArch64 kernel, which allows 32-bit application support, doesn’t automatically configure the vDSO for these applications.

Specifically, when building the AArch64 kernel, developers need to set the **CROSS_COMPILE_COMPAT** variable to point to a separate 32-bit GCC toolchain. Failing to do so will result in 32-bit applications running without the vDSO’s performance benefits.

**A recent benchmark conducted by a developer showcased a significant performance drop of over 25 times when running a 32-bit application without the vDSO.** This highlights the importance of proper vDSO configuration, especially for applications that require frequent system calls like gettimeofday(2), used for querying the current time.

This issue has prompted a patch by the developer to be submitted to the Yocto build system, which currently doesn’t support the **CROSS_COMPILE_COMPAT** configuration.

**Linux offers ways to verify if a vDSO is available:**

* **Auxiliary Vector:** The **AT_SYSINFO_EHDR** field in the auxiliary vector can be checked using the **getauxval(3)** glibc helper function.
* **LD_SHOW_AUXV:** Dynamically linked programs can use the **LD_SHOW_AUXV** environment variable to dump the auxiliary vector before execution.

**Developers building AArch64 kernels for 32-bit application support should ensure that the **CROSS_COMPILE_COMPAT** variable is correctly set to a 32-bit toolchain. This will ensure optimal performance and prevent potential issues impacting real-time applications.**

Read More