Bug 95432 - sparc64 is not properly detected as 64 bit due to incorrect architecture mapping
Summary: sparc64 is not properly detected as 64 bit due to incorrect architecture mapping
Status: RESOLVED FIXED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: SPARC Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-16 19:03 UTC by John Paul Adrian Glaubitz
Modified: 2016-06-01 10:44 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH] pulsecore: Fix incorrect architecture mapping on sparc64. (879 bytes, patch)
2016-05-16 19:03 UTC, John Paul Adrian Glaubitz
Details | Splinter Review

Description John Paul Adrian Glaubitz 2016-05-16 19:03:12 UTC
Created attachment 123794 [details] [review]
[PATCH] pulsecore: Fix incorrect architecture mapping on sparc64.

Hello!

While debugging build problems of Firefox on sparc64 in Debian [1], I discovered that one of the reasons the build is failing is an incorrect detection of the architecture due to the wrong assumption that gcc defines __sparc64__ on sparc64.

However, this is not correct as can be easily verified:

root@landau:~# echo | gcc -E -dM - |grep __sparc64__
root@landau:~# echo | gcc -E -dM - |grep __sparc__
#define __sparc__ 1
root@landau:~# echo | gcc -E -dM - |grep __arch64__
#define __arch64__ 1
root@landau:~# uname -m
sparc64
root@landau:~# dpkg --print-architecture
sparc64
root@landau:~#

I have discovered the same problem in systemd, too, and have already opened a pull request to fix the problem [2]. The attached patch fixes the bug for pulseaudio.

This particular bug might the reason why pulseaudio's testsuite fails on sparc64 with [3]:

FAIL: once-test
===============

Running suite(s): Once
0%: Checks: 1, Failures: 1, Errors: 0
tests/once-test.c:74:F:once:once_test:0: Assertion 'pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) == 0' failed
FAIL once-test (exit status: 1)

Cheers,
Adrian

> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824449
> [2] https://github.com/systemd/systemd/pull/3274
> [3] https://buildd.debian.org/status/fetch.php?pkg=pulseaudio&arch=sparc64&ver=8.0-3&stamp=1461452303
Comment 1 Arun Raghavan 2016-06-01 10:25:18 UTC
Comment on attachment 123794 [details] [review]
[PATCH] pulsecore: Fix incorrect architecture mapping on sparc64.

Review of attachment 123794 [details] [review]:
-----------------------------------------------------------------

::: src/pulsecore/atomic.h
@@ +201,4 @@
>  
>      return (v);
>  }
> +#elif defined(__sparc__) && defined(__arch64__)

I'm wondering if we might break some other/older compiler with this change. Any way to verify this?
Comment 2 Arun Raghavan 2016-06-01 10:26:07 UTC
CC'ing Brian Cameron

Brian, not sure if you're still involved in any of this -- comments?
Comment 3 John Paul Adrian Glaubitz 2016-06-01 10:31:49 UTC
(In reply to Arun Raghavan from comment #1)
> I'm wondering if we might break some other/older compiler with this change.
> Any way to verify this?

Very unlikely. According to David Miller, the definition "sparc64" was never valid [1].

For reference, David Miller has been the primary person behind the SPARC port of the Linux kernel since the 90ies [2].

Cheers,
Adrian

> [1] http://marc.info/?l=linux-sparc&m=146341133910751&w=2
> [2] https://en.wikipedia.org/wiki/David_S._Miller
Comment 4 John Paul Adrian Glaubitz 2016-06-01 10:33:05 UTC
Oh, and we fixed the same issue already in systemd [1].

Adrian

> [1] https://github.com/systemd/systemd/commit/cd042078df2151d7824abf91107a0d4a8716e54f
Comment 5 Arun Raghavan 2016-06-01 10:40:36 UTC
Fair enough, I've pushed this out to next now (so it'll be in PA 10.0).
Comment 6 John Paul Adrian Glaubitz 2016-06-01 10:44:25 UTC
(In reply to Arun Raghavan from comment #5)
> Fair enough, I've pushed this out to next now (so it'll be in PA 10.0).

Thank you :).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.