Skip to content

[OpenMP][cmake] Add SPARC support #142364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

rorth
Copy link
Collaborator

@rorth rorth commented Jun 2, 2025

This patch adds SPARC infrastructure to the openmp cmake files, matching what is done for other architectures.

Tested on sparc-sun-solaris2.11, sparcv9-sun-solaris2.11, sparc-unknown-linux-gnu, sparc64-unknown-linux-gnu, i386-pc-solaris2.11, amd64-pc-solaris2.11, i686-pc-linux-gnu, and x86_64-pc-linux-gnu.

Linking `libomp.so` on 32-bit SPARC `FAIL`s with
```
ld: fatal: file projects/openmp/runtime/src/CMakeFiles/omp.dir/z_Linux_asm.S.o: wrong ELF class: ELFCLASS64
```
This was a 1-stage build with a 64-bit-default `gcc`.  Unlike the C++
sources, which were compiled as 32-bit objects due to the use of
`-DCMAKE_CXX_FLAGS=-m32`, the assembler sources were not.

This patch adds SPARC infrastructure to the `openmp` `cmake` files,
matching what is done for other architectures.  Simultaneously it
simplifies passing `-m32`: instead of doing it per architecture, `-m32` is
now always passed when the target uses 32-bit pointers and supports the
option.

Tested on `sparc-sun-solaris2.11`, `sparcv9-sun-solaris2.11`,
`sparc-unknown-linux-gnu`, `sparc64-unknown-linux-gnu`,
`i386-pc-solaris2.11`, `amd64-pc-solaris2.11`, `i686-pc-linux-gnu`, and
`x86_64-pc-linux-gnu`.
@rorth rorth requested review from mjklemm and TerryLWilmarth June 2, 2025 11:23
@llvmbot llvmbot added the openmp:libomp OpenMP host runtime label Jun 2, 2025
@brad0 brad0 requested a review from shiltian June 3, 2025 02:29
Copy link
Contributor

@shiltian shiltian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should be split into two separate PRs: one for the -m32 related changes, and another for the LIBOMP_ARCH changes. They don't appear to depend on each other.

@rorth
Copy link
Collaborator Author

rorth commented Jun 3, 2025

When I started working on the SPARC -m32 issue, I did it along the lines of IA32, so SPARC would have been needed for that. Only later I did notice that the -m32 support can be massively simplified, so the two indeed became separate. Will split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomp OpenMP host runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants