Re: usr.bin/getconf: Add reporting LONG_BIT
On 5/28/19 8:21 AM, Jeremie Courreges-Anglas wrote: On Mon, May 27 2019, Philip Guenther wrote: On Mon, May 27, 2019 at 3:43 PM Brian Callahan wrote: Below is a small diff in response to some configuration attempts found in ports land. lang/ponyc uses $(shell getconf LONG_BIT) in its Makefile to determine whether or not we're on a 64-bit platform. It needs to know that at the scripting level, outside of the C code itself where it can directly test LONG_BIT (or perhaps better, _LP64)? Huh. However, our getconf(1) doesn't support reporting LONG_BIT. This diff enables it. GNU/FreeBSD/DragonFly/MacOS getconf reports LONG_BIT, but NetBSD getconf does not. Desirable? OK? That's the way to do it, I just have this vague "what tempting lunacy has led them to this?" lurking in my mind. I'll let Brian confirm but this got me curious. Here's the dance I found in the Makefile for ponyc: --8<-- # Default settings (silent release build). config ?= release arch ?= native tune ?= generic cpu ?= $(arch) fpu ?= bits ?= $(shell getconf LONG_BIT) [...] # Determine pointer size in bits. BITS := $(bits) UNAME_M := $(shell uname -m) ifeq ($(BITS),64) ifeq ($(UNAME_M),x86_64) ifeq (,$(filter $(arch), armv8-a)) BUILD_FLAGS += -mcx16 LINKER_FLAGS += -mcx16 endif endif endif -->8-- So IIUC the build tries to use -mcx16 on amd64, except if the target architecture is armv8-a. This looks bogus, I guess what upstream wants is to use -mcx16 only when doing a build *targetting* amd64. The value of LONG_BIT on the build machine doesn't seem relevant to achieve that, but I may be missing something. Welcome to ports... I can confirm with upstream, but I read it as they want to avoid adding the flag if you're using the x32 ABI... but I agree with you in that using the build machine info to understand something about the target machine isn't the right way to go about it. ~Brian
Re: usr.bin/getconf: Add reporting LONG_BIT
On Mon, May 27 2019, Philip Guenther wrote: > On Mon, May 27, 2019 at 3:43 PM Brian Callahan wrote: > >> Below is a small diff in response to some configuration attempts >> found in ports land. >> lang/ponyc uses $(shell getconf LONG_BIT) in its Makefile to >> determine whether or not we're on a 64-bit platform. >> > > It needs to know that at the scripting level, outside of the C code itself > where it can directly test LONG_BIT (or perhaps better, _LP64)? Huh. > > > >> However, our getconf(1) doesn't support reporting LONG_BIT. >> This diff enables it. GNU/FreeBSD/DragonFly/MacOS getconf reports >> LONG_BIT, but NetBSD getconf does not. >> Desirable? OK? >> > > That's the way to do it, I just have this vague "what tempting lunacy has > led them to this?" lurking in my mind. I'll let Brian confirm but this got me curious. Here's the dance I found in the Makefile for ponyc: --8<-- # Default settings (silent release build). config ?= release arch ?= native tune ?= generic cpu ?= $(arch) fpu ?= bits ?= $(shell getconf LONG_BIT) [...] # Determine pointer size in bits. BITS := $(bits) UNAME_M := $(shell uname -m) ifeq ($(BITS),64) ifeq ($(UNAME_M),x86_64) ifeq (,$(filter $(arch), armv8-a)) BUILD_FLAGS += -mcx16 LINKER_FLAGS += -mcx16 endif endif endif -->8-- So IIUC the build tries to use -mcx16 on amd64, except if the target architecture is armv8-a. This looks bogus, I guess what upstream wants is to use -mcx16 only when doing a build *targetting* amd64. The value of LONG_BIT on the build machine doesn't seem relevant to achieve that, but I may be missing something. Welcome to ports... -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: usr.bin/getconf: Add reporting LONG_BIT
On 5/28/19 7:24 AM, Christian Weisgerber wrote: Brian Callahan: lang/ponyc uses $(shell getconf LONG_BIT) in its Makefile to determine whether or not we're on a 64-bit platform. However, our getconf(1) doesn't support reporting LONG_BIT. This diff enables it. GNU/FreeBSD/DragonFly/MacOS getconf reports LONG_BIT, but NetBSD getconf does not. It appears to be part of a larger extension that adds all numerical limits from POSIX : $ ssh freebsd-box $ getconf LONG_MIN -9223372036854775808 $ getconf LONG_MAX 9223372036854775807 $ getconf LONG_BIT 64 If we add any of this, shouldn't we add all of it? Sure; I cherry picked what I needed since I wasn't sure if this was a direction we wanted to go in but I can make it more complete. Or, if there's a better way to do what I need (get a GNU Makefile to figure out whether or not its on a 64-bit or 32-bit platform) then I'll just withdraw this diff in favor of amending the port. ~Brian
Re: usr.bin/getconf: Add reporting LONG_BIT
Brian Callahan: > lang/ponyc uses $(shell getconf LONG_BIT) in its Makefile to > determine whether or not we're on a 64-bit platform. > However, our getconf(1) doesn't support reporting LONG_BIT. > This diff enables it. GNU/FreeBSD/DragonFly/MacOS getconf reports > LONG_BIT, but NetBSD getconf does not. It appears to be part of a larger extension that adds all numerical limits from POSIX : $ ssh freebsd-box $ getconf LONG_MIN -9223372036854775808 $ getconf LONG_MAX 9223372036854775807 $ getconf LONG_BIT 64 If we add any of this, shouldn't we add all of it? -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: usr.bin/getconf: Add reporting LONG_BIT
On Mon, May 27, 2019 at 3:43 PM Brian Callahan wrote: > Below is a small diff in response to some configuration attempts > found in ports land. > lang/ponyc uses $(shell getconf LONG_BIT) in its Makefile to > determine whether or not we're on a 64-bit platform. > It needs to know that at the scripting level, outside of the C code itself where it can directly test LONG_BIT (or perhaps better, _LP64)? Huh. > However, our getconf(1) doesn't support reporting LONG_BIT. > This diff enables it. GNU/FreeBSD/DragonFly/MacOS getconf reports > LONG_BIT, but NetBSD getconf does not. > Desirable? OK? > That's the way to do it, I just have this vague "what tempting lunacy has led them to this?" lurking in my mind. Philip Guenther
usr.bin/getconf: Add reporting LONG_BIT
Hi tech -- Below is a small diff in response to some configuration attempts found in ports land. lang/ponyc uses $(shell getconf LONG_BIT) in its Makefile to determine whether or not we're on a 64-bit platform. However, our getconf(1) doesn't support reporting LONG_BIT. This diff enables it. GNU/FreeBSD/DragonFly/MacOS getconf reports LONG_BIT, but NetBSD getconf does not. Desirable? OK? ~Brian Index: getconf.c === RCS file: /cvs/src/usr.bin/getconf/getconf.c,v retrieving revision 1.20 diff -u -p -r1.20 getconf.c --- getconf.c 26 Oct 2018 17:11:32 - 1.20 +++ getconf.c 27 May 2019 21:06:01 - @@ -163,6 +163,7 @@ const struct conf_variable conf_table[] constant_row(_XOPEN_IOV_MAX) constant_row(_XOPEN_NAME_MAX) constant_row(_XOPEN_PATH_MAX) + constant_row(LONG_BIT) /* Extensions */ sysconf_row(PHYS_PAGES)