Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 634550 - dev-libs/libbsd-0.8.6 fails nlist testcase on sparc
Summary: dev-libs/libbsd-0.8.6 fails nlist testcase on sparc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Freedesktop bugs
URL:
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks: 630340
  Show dependency tree
 
Reported: 2017-10-17 16:29 UTC by Rolf Eike Beer
Modified: 2018-03-25 20:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
strace log (nlist.log,14.98 KB, text/x-log)
2017-10-17 19:20 UTC, Rolf Eike Beer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Eike Beer archtester 2017-10-17 16:29:26 UTC
Message is:

nlist: /var/tmp/portage/dev-libs/libbsd-0.8.6/work/libbsd-0.8.6/test/nlist.c:70: main: Assertion `rc == 0' failed.

The rc is in fact -1.

Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2017-10-17 17:05:23 UTC
Could you please run "strace ./test/nlist" from the build directory, and attach the resulting output.
Comment 2 Rolf Eike Beer archtester 2017-10-17 18:30:41 UTC
I guess this is the part you are interested in:

open("./work/libbsd-0.8.6-.sparc32/test/.libs/nlist", O_RDONLY|O_LARGEFILE) = 3
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\2\0\22\0\0\0\1\0\1\6@\0\0\0004\0\0'\274\0\0\1\0\0004\0 \0\10\0(\0\34\0\33", 52) = 52
close(3)                                = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
brk(NULL)                               = 0x26000
brk(0x48000)                            = 0x48000
Comment 3 Mike Gilbert gentoo-dev 2017-10-17 19:13:58 UTC
(In reply to Rolf Eike Beer from comment #2)
> I guess this is the part you are interested in:

You guessed wrong.
Comment 4 Rolf Eike Beer archtester 2017-10-17 19:20:30 UTC
Created attachment 499018 [details]
strace log
Comment 5 Mike Gilbert gentoo-dev 2017-10-17 20:46:27 UTC
Ok, I don't see what I was looking for (open() == -1). This is some deeper issue with the symbol table processing code.
Comment 6 Rolf Eike Beer archtester 2018-02-07 21:04:36 UTC
This looks as if it could be related: https://cgit.freedesktop.org/libbsd/commit/?id=9ceac74e91411d3f7dbbc42d772f3500c47c7cec
Comment 7 Rolf Eike Beer archtester 2018-02-07 21:07:26 UTC
Fails the same on 0.8.7.
Comment 8 James Clarke 2018-02-08 14:58:41 UTC
My guess is that it's because the compiler is compiling for V8+ i.e. 32-bit V9, rather than a lower baseline. V8+ has a different e_machine (EM_SPARC32PLUS) to standard sparc32 (EM_SPARC), but src/local-elf.h currently looks like:

#if defined(__arch64__)
#define ELF_TARG_MACH	EM_SPARCV9
#define ELF_TARG_CLASS	ELFCLASS64
#else
#define ELF_TARG_MACH	EM_SPARC
#define ELF_TARG_CLASS	ELFCLASS32
#endif

I should think this can be fixed by changing it to:

#if defined(__arch64__)
#define ELF_TARG_MACH	EM_SPARCV9
#define ELF_TARG_CLASS	ELFCLASS64
#else
#if defined(__sparc_v9__)
#define ELF_TARG_MACH	EM_SPARC32PLUS
#else
#define ELF_TARG_MACH	EM_SPARC
#endif
#define ELF_TARG_CLASS	ELFCLASS32
#endif

Unfortunately this only works for Linux; on Solaris, the only difference I can se between V8 and non-V8+ is whether __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* are defined; there's no v9 (or v8plus) macro available. That's an issue for upstream though, and this is a strict improvement.
Comment 9 Rolf Eike Beer archtester 2018-02-08 17:33:12 UTC
I can confirm that this makes the tests green (based on 0.8.7).
Comment 10 Larry the Git Cow gentoo-dev 2018-03-21 22:07:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6ef75dadb937aec325a57e51d046d7c2e1eec57

commit a6ef75dadb937aec325a57e51d046d7c2e1eec57
Author:     Rolf Eike Beer <eike@sf-mail.de>
AuthorDate: 2018-03-13 15:44:01 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-03-21 22:07:43 +0000

    dev-libs/libbsd: fix ELF machine type for 32 bit sparc
    
    Bug: https://bugs.gentoo.org/634550
    Package-Manager: Portage-2.3.24, Repoman-2.3.6
    RepoMan-Options: --include-arches="sparc"
    Closes: https://github.com/gentoo/gentoo/pull/7446

 dev-libs/libbsd/files/libbsd-0.8.6-sparc.patch | 32 ++++++++++++++++++++++++++
 dev-libs/libbsd/libbsd-0.8.6.ebuild            |  4 ++++
 dev-libs/libbsd/libbsd-0.8.7.ebuild            |  4 ++++
 3 files changed, 40 insertions(+)}