Building the JDK on macOS with the Xcode 26 linker (ld version 1267) produces:


ld: warning: reducing alignment of section __DATA,__common from 0x8000 to 
0x4000 because it exceeds segment maximum alignment


This comes from libawt, specifically the tentative definitions of `mul8table` 
and `div8table` in `AlphaMath.c`. These are 64KB uninitialized global arrays 
that the compiler places in the __common section with 32KB alignment. The Xcode 
26 linker caps segment alignment at 16KB (the arm64 page size) and warns when 
clamping.

The fix is to change the tentative definitions to explicit zero-initialized 
definitions:

Before:

JNIEXPORT unsigned char mul8table[256][256];
JNIEXPORT unsigned char div8table[256][256];


After:

JNIEXPORT unsigned char mul8table[256][256] = { { 0 } };
JNIEXPORT unsigned char div8table[256][256] = { { 0 } };


This moves the symbols from __common to __bss, avoiding the alignment warning. 
Both sections are zero-filled at load time, and `initAlphaTables()` populates 
the actual values at runtime, so the change is functionally identical. No 
impact on other platforms.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8385528: Fix linker alignment warning for libawt on macOS with Xcode 26

Changes: https://git.openjdk.org/jdk/pull/31294/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31294&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8385528
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/31294.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31294/head:pull/31294

PR: https://git.openjdk.org/jdk/pull/31294

Reply via email to