From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5884 Path: news.gmane.org!not-for-mail From: Khem Raj Newsgroups: gmane.linux.lib.musl.general Subject: Re: the definition of (u)int64_t with gcc -m32 in stdint.h Date: Thu, 21 Aug 2014 08:25:40 -0700 Message-ID: References: <20140821171511.06869699@ncopa-desktop.alpinelinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1408634790 16777 80.91.229.3 (21 Aug 2014 15:26:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Aug 2014 15:26:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5890-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 21 17:26:23 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XKUFr-0001fx-9O for gllmg-musl@plane.gmane.org; Thu, 21 Aug 2014 17:26:23 +0200 Original-Received: (qmail 7175 invoked by uid 550); 21 Aug 2014 15:26:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 6139 invoked from network); 21 Aug 2014 15:26:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=9ZNOtIuXOaC15RMu56Kt9NekLUV9Q8hekLU4mio3xI0=; b=NdAOwgy7gcAocdZf+j3OYeTVegT1/OMi+gEUvTDRauGEDrIcyOWER/samUT5EyCUzp DgOiziSJdbK2g80pKkS5HCMSl5J6n7ejlpDhfbF2sau+M0WcwfDIHvp7QPFjnWeyrrgS /+TEEK/+hOyOVvuxNbs1ahXnXtUjqiO8ftgx1H9RFZ/P2V1Vt3LDquo1qPBtAJNxW40Q xBmWcVaL/P9ooT11Q2zV7unsZwlOPqRP9fodI93vkpIiwjjNTJwkUxEvz7iexDVlDpks rPCtjH+dzWQIXafnsAK5Y9OzvuvbRSP2sMGMcW+oYbwcv7bhKOHPzjTSg/VFbU/MGdG3 bJWQ== X-Received: by 10.42.254.129 with SMTP id ne1mr4085708icb.29.1408634770709; Thu, 21 Aug 2014 08:26:10 -0700 (PDT) In-Reply-To: <20140821171511.06869699@ncopa-desktop.alpinelinux.org> Xref: news.gmane.org gmane.linux.lib.musl.general:5884 Archived-At: On Thu, Aug 21, 2014 at 8:15 AM, Natanael Copa wrote: > Hi, > > After migrating from uclibc to musl libc the Xen hvmloader broke. This > is a 32bit bootloader that is built on 64 bit hosts with gcc -m32. > > Someone told me breakage had to do with datastructs beeing 64 bit even > with -m32. I also saw someone comment that it shoudl been built with > -nostdinc. > > I tried this and it revealed that yes, indeed, the hvmloader does use > the host system stdint.h and stdarg.h. > > Curious on why it works on uclibc but not with musl i found out that > uclibc/glibc sets (u)int64_t depening on __WORDSIZE: > > # if __WORDSIZE == 64 > typedef long int int64_t; > # else > __extension__ > typedef long long int int64_t; > # endif > > > and wordsize is set in /usr/include/bits/wordsize.h: > /* Determine the wordsize from the preprocessor defines. */ > > #if defined __x86_64__ > # define __WORDSIZE 64 > /* This makes /var/run/utmp compatible with 32-bit environment: */ > # define __WORDSIZE_COMPAT32 1 > #else > # define __WORDSIZE 32 > #endif > > > the __x86_64__ define is set by gcc and is set differently when -m32 is > specified or not. > > A testcase. On uclibc 64 bit host: > dev-2-7-x86_64:~$ echo '#include ' | gcc -m32 -E - | grep int64 > typedef long long int int64_t; > typedef unsigned long long int uint64_t; > > > Same on musl libc 64 bit host: > $ echo '#include ' | gcc -m32 -E - | grep int64 > typedef long int64_t; > typedef unsigned long uint64_t; > typedef int64_t int_fast64_t; > typedef int64_t int_least64_t; > typedef uint64_t uint_fast64_t; > typedef uint64_t uint_least64_t; > > > so on musl it is 'long' but on uclibc its 'long long int'. > > That explains why it works on uclibc but not on musl. > > Now, what is the proper way to fix it? Preferible without replacing > all (u)int*_t all places in xen code. I doubt upstream will accept that. > Do we support multilib with musl yes ? > -nc