This is an archive of the discontinued LLVM Phabricator instance.

Fix Solaris compilation
ClosedPublic

Authored by ro on Sep 9 2022, 7:30 AM.

Details

Summary

As detailed in Issue #57642, the test-suite doesn't compile on Solaris.

This patch fixes the compilation issues as explained there.

Tested on amd64-pc-solaris2.11 (8 failures, all fpcmp-target: Comparison failed), sparcv9-sun-solaris2.11 (11 failures, same fpcmp-target errors), and x86_64-pc-linux-gnu (no regressions).

Diff Detail

Repository
rT test-suite

Event Timeline

ro created this revision.Sep 9 2022, 7:30 AM
ro requested review of this revision.Sep 9 2022, 7:30 AM
fhahn added a comment.Sep 13 2022, 1:54 AM

The mentioned issue talks about Flang (https://github.com/llvm/llvm-project/issues/57642), but the changes seem to all be in C/C++ files?

MicroBenchmarks/libs/benchmark/test/benchmark_setup_teardown_test.cc
13

This is a copy of https://github.com/google/benchmark I think. Did you submit those changes for upstream review?

MultiSource/Applications/oggenc/oggenc.c
11

Why is this needed?

133

Why is this needed?

MultiSource/Applications/viterbi/read_dmatrix.c
2

why is this needed?

MultiSource/Benchmarks/McCat/05-eks/main.c
35

why are those moved?

ro added a comment.Sep 13 2022, 2:01 AM

The mentioned issue talks about Flang (https://github.com/llvm/llvm-project/issues/57642), but the changes seem to all be in C/C++ files?

Sorry, juggling too many Issues at once: the right one is Issue #57652 which should explain all the changes.

MicroBenchmarks/libs/benchmark/test/benchmark_setup_teardown_test.cc
13

I hadn't been aware of that.

fhahn added inline comments.Sep 26 2022, 6:03 AM
tools/timeit.c
336

Is this a typo? Should this be RLIMIT_RSS? Even so, not sure if this will work as expected on Apple platforms, which define RLIMIT_RSS I think.

ro marked an inline comment as done.Sep 27 2022, 5:36 AM
ro added inline comments.
tools/timeit.c
336

You're right, of course. I looked at Mac OS X 10.7/Darwin 11 <sys/resource.h> and even that version already defines RLIMIT_RSS.

Unfortunately, I cannot really test LLVM on recent Darwin, and 10.7 is way too old to be supported (or even compiling).

ro updated this revision to Diff 463200.Sep 27 2022, 5:38 AM
ro marked an inline comment as done.

Never use RLIMIT_RSS on Apple systems.

ro added inline comments.Oct 6 2022, 2:50 AM
MicroBenchmarks/libs/benchmark/test/benchmark_setup_teardown_test.cc
13

A patch to fix several Google benchmark issues on Solaris has just been committed: Fix Solaris compilation (#1499) (#1500). What's the best way to proceed here?

ro added a comment.Oct 24 2022, 2:17 PM

Ping? It's been 2 1/2 weeks...

fhahn accepted this revision.Oct 30 2022, 10:04 AM

LGTM, thanks!

This revision is now accepted and ready to land.Oct 30 2022, 10:04 AM
This revision was automatically updated to reflect the committed changes.
arichardson added inline comments.
MultiSource/Applications/oggenc/oggenc.c
11

This broke the build for FreeBSD where the alloca.h header is not provided. Guard with __has_include()?

ro added inline comments.Nov 30 2022, 3:47 AM
MultiSource/Applications/oggenc/oggenc.c
11

That's unexpected since other parts of the code use unguarded
<alloca.h>, too, like MultiSource/Benchmarks/MiBench/consumer-lame/rtp.c.

Using __has_include is probably the best option, although one could also use __builtin_alloca instead, given that the code only needs to be compilable with clang. The former is less intrusive, of course.

arichardson added inline comments.Nov 30 2022, 4:11 AM
MultiSource/Applications/oggenc/oggenc.c
11

the use in rtp.c was also added by this commit, all other uses check the OS first. I've submitted https://reviews.llvm.org/D139001 as a possible fix.