tl;dr
target (64) differs … number of bits … in the target (32)
Apple Silicon chips for macOS (M1, M2) are all 64-bit architectures. Do not compile for 32-bit.
I want to compile jdk in M1 MacBook.
Do not try to compile OpenJDK. Codebase is large and complicated. And no need, as others provide binaries & installers.
For a Mac using Apple Silicon rather than Intel x86-64, I suggest obtaining a distribution of Java 17 for macOS / AArch64, released 2021-09, from any of several vendors.
Or, use a build of earlier versions of Java ported to Apple Silicon by various vendors. For example, Azul Systems announced 2020-11 plans to ship builds of OpenJDK 8 and 11 for Apple Silicon, ARM-based Macs. I see downloads available now from that company for Java 11.0.13+8 on both Intel Macs and Apple Silicon Macs.
Details
Few of us ever compile the very large and complicated codebase of OpenJDK. Instead, we look to any of several vendors providing builds and installers. If your goal is to be productive in Java programming, then compiling the Java JDK toolset is not the best use of your time.
Java 17 was released 2021-09. OpenJDK officially supports macOS on Apple Silicon: JEP 391: macOS/AArch64 Port. You have your choice of builds/installers from any of several vendors such as SAP, Red Hat/IBM, BellSoft, Azul Systems, Oracle, Adoptium/AdoptOpenJDK, Microsoft, Amazon, Pivotal, and more. These builds/installers will be based largely or entirely on the OpenJDK codebase.
Vendors such as Azul Systems provide Apple Silicon builds for the current version 19 as well as the long-term support (LTS) versions 8, 11, and 17. Java 17 is the latest LTS version, to be supported for many years. So I would suggest Java 17 for deployment.
I myself have been using Java 17, 18, and 19, as well as early-access 20, on a couple of M1 MacBook Pro laptops with IntelliJ and Maven on Big Sur & Monterey. Working well, no problems.
Compiling Java
As commented, your specific error is likely due to you compiling for 32-bit ARM rather than 64-bit ARM architecture used by Apple for their M1 chip and M2 chip families.
If you are curious about, or have an academic interest in compiling Java from the OpenJDK codebase, I suggest examining the open-sourced tooling at Adoptium (formerly AdoptOpenJDK). The tooling for building early-access builds at the OpenJDK site may also be open-sourced but I don’t know for certain.