From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12274 Path: news.gmane.org!.POSTED!not-for-mail From: Nicholas Wilson Newsgroups: gmane.linux.lib.musl.general Subject: Re: Feature request: building musl in a portable way Date: Fri, 22 Dec 2017 17:10:20 +0000 Message-ID: References: <20171221213822.GY1627@brightrain.aerifal.cx>, Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1513962524 21108 195.159.176.226 (22 Dec 2017 17:08:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Dec 2017 17:08:44 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-12290-gllmg-musl=m.gmane.org@lists.openwall.com Fri Dec 22 18:08:40 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eSQoH-00057C-Qv for gllmg-musl@m.gmane.org; Fri, 22 Dec 2017 18:08:37 +0100 Original-Received: (qmail 10079 invoked by uid 550); 22 Dec 2017 17:10:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 10061 invoked from network); 22 Dec 2017 17:10:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realvnc.onmicrosoft.com; s=selector1-realvnc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=84xdBhWlQNRKYdjoKm2+cr8oKiZLrllF1aTQZFPfmCI=; b=bEwYPzQeyR4rA6hTUABIrd/4dn1uAw97lpYLDbtvergbMX6N9q4GYk5D2vgtATa1doqCHOeZVBcDoEmyUkLKffs5oe8L2XIXO79BgvFJqXKB6PIo7bGfCpPmeFULoNvaEXKvVw/KvxynF7tpw9BBlvh5dThliEPwQ+lVVmChmhQ= Thread-Topic: [musl] Feature request: building musl in a portable way Thread-Index: AQHTenhf20VMeW9Ke0GWVLf9KN6PYaNOUxsAgAE2VgCAAAEnIQ== In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2a00:23c3:744c:6800:1d18:6419:9285:90fa] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0502MB3886;6:Q1B8yHEXid9aVyuuqJ693ol4a01qgSTkP6jcIsEJ1YDEN/8s7zHtAmfU6PuSJf8DmTtoLyERBoijAUClFP8jCRgo8oIqumvn78iQo+bnQQdxv4jBgE2c0otMv4r0klGyR4kxmo1mOjNAWn/950TforI4isFDbPfD6nuCorK7WWKK00eLOFRuilXKrC7o89dX9zZ9iVKcDfAOruNpx0xsMYJGzaAhPiRsE3Iqywqtc1dbEuN2kk0/hiuCQ/7z0bc4Q3IO8sJFJwJemRs7r8vUU9rByCbKEvPsZvsT7VhZJy3bIJDwGywl8CSliWTTIFrhc0Vp3kx5VTc8Eah2ZXJ/+AeCGpROL3QD9Mi4U2hgT6M=;5:ciK5Y6Kj9s6LeOm+MVn/6F7GaBRbCoSuC1OCSV0Znt2dEFMOEwhbB9KebadrIriJGH5LiJEwUJvVA/sQk3qDhKyQ4FpNPFprsI4pcrSbAZE5r4Lmp8CRcMMCRLuvVGU3m7IO6N4XVUQy3UuTowpGKMiSaIQm4yqeNfQ+oQocD7Y=;24:Ix4PqRZv6P2cTi/gvSTTYTRWrTpHsg3hbs3XfByHtuA0/cO0pKXO7BnuVgH1ndSw3NJlj706xbR+6JUMOEMZyr6ygTmmfiuwRaDEEW6169s=;7:qSzlO4nY8l9erxJNYzzRie+Tk/d5ygwiI5L0DRg3WfMpuyOo/Nb6yqbKrs11Tiw5ay9ZXnhP2lWULqL6L49Ca56ig1kw PjIWQW4sLKf22VxN+Nj1Q7yJGDmjgoKoV35PqhOOLiVaa2SyvnPph1DUGa2+PvoVKcB7NIgpZeJTYAD87oFmHx4SJr3rAoOlVW x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: c7947637-70fa-4cc5-a707-08d5495ee196 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(3008031)(4534020)(4602075)(4603075)(4627115)(201702281549075)(2017052603307)(7153060);SRVR:VI1PR0502MB3886; x-ms-traffictypediagnostic: VI1PR0502MB3886: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nicholas.wilson@realvnc.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501045)(10201501046)(3002001)(93006095)(93001095)(6041268)(20161123562045)(2016111802025)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6043046)(6072148)(201708071742011);SRVR:VI1PR0502MB3886;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:VI1PR0502MB3886; x-forefront-prvs: 05299D545B x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(376002)(39840400004)(39380400002)(396003)(199004)(24454002)(189003)(229853002)(8936002)(14454004)(53936002)(5640700003)(59450400001)(55016002)(6246003)(9686003)(99286004)(5660300001)(2950100002)(2900100001)(81166006)(97736004)(6116002)(6916009)(25786009)(316002)(86362001)(305945005)(6506007)(81156014)(7696005)(68736007)(76176011)(3280700002)(2906002)(8676002)(33656002)(1730700003)(2351001)(6436002)(2501003)(106356001)(478600001)(7736002)(105586002)(74316002)(3660700001)(5250100002)(102836004)(53546011)(46800400004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0502MB3886;H:VI1PR0502MB3885.eurprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: realvnc.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-MS-Exchange-CrossTenant-Network-Message-Id: c7947637-70fa-4cc5-a707-08d5495ee196 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Dec 2017 17:10:20.1105 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9ad766d3-c6a5-4458-8c58-244e7c118728 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3886 X-OriginatorOrg: realvnc.com Xref: news.gmane.org gmane.linux.lib.musl.general:12274 Archived-At: On 22 December 2017 16:09, ardi wrote: >> On Thu, Dec 21, 2017 at 10:38 PM, Rich Felker wrote: >> I'm not clear what you want to do. > I'm looking for a C runtime with a MIT-like license that can be > compiled for several architectures, in 32bit and 64bit, mostly Intel, > PowerPC, ARM, and MIPS, and is endian-safe, and written in a tidy > code. I need that such runtime is able to be retargeted to different > OSs by changing the layer where syscalls are made. At the moment of > writing this, the OSs I'm interested in are Linux and MacOS. In the > future I'll likely be interested in other OSs as well. > I don't know of any C runtime that meets all these requirements. The > only two that get close are the different BSDs C runtimes, and musl, > but both lack the last requirement (i.e.: syscalls are not > encapsulated in some confined files so that you could rewrite such > "syscall layer" for each OS --instead, syscalls can be issued from any > place in code, and the only way to locate and encapsulate the proper > functions is to manually search for invocations of syscalls in the > source tree). This still doesn't explain what you want to *do* - this explains what you *= want* but not how you're intending to use it. If you want a libc for MacOS, I would suggest using Apple's libc. On Linux,= you may want to use glibc (or Musl, on distros that have chosen that). As you've discovered, a libc implementation is tightly coupled to the OS - = in a sense it really is a component of the OS itself. Writing a libc that t= argets different kernels would quite an undertaking, but possible - but of = much more importance are the "upwards" dependencies. You're thinking about = "how many kernels can a libc support", but of more importance is, "how many= platform ABIs can the libc support upwards". For your hypothetical libc th= at runs on Linux and MacOS, do you want it to be usable on MacOS with appli= cations compiled against Apple's headers, and usable on Linux with applicat= ions compiled against glibc's headers? That's just as much a challenge, and= would be perhaps the major reason no-one's tried to create a "universal" l= ibc: established applications use slightly different ABIs on each platform.= If you want to call into any MacOS userland functionality, you'll need to = have a libc that's fully ABI-compatible with those MacOS components. If you insist on using Musl on MacOS, your route forwards would be to imple= ment the Linux syscall ABI using MacOS syscalls, effectively emulating Linu= x on each platform where you want to run Musl. That's how we're using Musl on WebAssembly. Musl uses Linux syscalls, so we= implement Linux syscalls to keep Musl happy. Nick=