Skip to content

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 TerryLWilmarth and mjklemm 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.

@rorth rorth merged commit 3f8827e into llvm:main Jun 7, 2025
9 checks passed
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 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`.
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.

4 participants