Permitting the override of MACHINE_ARCH in amd64/param.h

2015-10-12 Thread Sevan Janiyan
Hi,
I was wondering if it would be possible to allow the override the
definition of MACHINE_ARCH /__MACHINE_ARCH in amd64/param.h by wrapping
them around ifndef statement.

Index: sys/arch/amd64/include/param.h
===
RCS file: /cvs/src/sys/arch/amd64/include/param.h,v
retrieving revision 1.22
diff -u -p -u -r1.22 param.h
--- sys/arch/amd64/include/param.h  26 Mar 2013 05:04:10 -  1.22
+++ sys/arch/amd64/include/param.h  12 Oct 2015 15:17:03 -
@@ -45,8 +45,12 @@

 #define_MACHINEamd64
 #defineMACHINE "amd64"
+#ifndef _MACHINE_ARCH
 #define_MACHINE_ARCH   amd64
+#endif
+#ifndef MACHINE_ARCH
 #defineMACHINE_ARCH"amd64"
+#endif
 #defineMID_MACHINE MID_AMD64

 #definePAGE_SHIFT  12

Being able to override is useful in scenarios where you group arch name
variants under a common alias, at the moment using such a mechanism
fails under OpenBSD/amd64 as whatever is passed in during build time is
overwritten by the inclusion of .

Is this viable?

Regards,

Sevan Janiyan



Re: Permitting the override of MACHINE_ARCH in amd64/param.h

2015-10-12 Thread Theo de Raadt
> I was wondering if it would be possible to allow the override the
> definition of MACHINE_ARCH /__MACHINE_ARCH in amd64/param.h by wrapping
> them around ifndef statement.
> 
> Index: sys/arch/amd64/include/param.h
> ===
> RCS file: /cvs/src/sys/arch/amd64/include/param.h,v
> retrieving revision 1.22
> diff -u -p -u -r1.22 param.h
> --- sys/arch/amd64/include/param.h26 Mar 2013 05:04:10 -  1.22
> +++ sys/arch/amd64/include/param.h12 Oct 2015 15:17:03 -
> @@ -45,8 +45,12 @@
> 
>  #define  _MACHINEamd64
>  #define  MACHINE "amd64"
> +#ifndef _MACHINE_ARCH
>  #define  _MACHINE_ARCH   amd64
> +#endif
> +#ifndef MACHINE_ARCH
>  #define  MACHINE_ARCH"amd64"
> +#endif
>  #define  MID_MACHINE MID_AMD64
> 
>  #define  PAGE_SHIFT  12
> 
> Being able to override is useful in scenarios where you group arch name
> variants under a common alias, at the moment using such a mechanism
> fails under OpenBSD/amd64 as whatever is passed in during build time is
> overwritten by the inclusion of .

That makes absolutely no sense.  I don't see any purpose to this.  You
have failed to explain the usage case; I don't believe there is any
scenario where people benefit from more architecture divergence.



Re: Permitting the override of MACHINE_ARCH in amd64/param.h

2015-10-12 Thread Sevan Janiyan


On 12/10/2015 16:30, Theo de Raadt wrote:
> You have failed to explain the usage case; I don't believe there is
> any scenario where people benefit from more architecture divergence.

As an example, in pkgsrc, CPUs architectures are grouped under a common
alias so they can be addressed once rather than addressing each variant
individually amongst all the supported architectures eg if {OPSYS} ==
"x86_64" rather than {OPSYS} == "x86_64" || {OPSYS} == "amd64"
There are some situations where OpenBSD is specifically accounted for
but if it was possible to override the MACHINE_ARCH definition, it would
not need to be addressed specifically & any such cases could be removed.


Sevan



Re: Permitting the override of MACHINE_ARCH in amd64/param.h

2015-10-12 Thread Sevan Janiyan


On 12/10/2015 17:11, Theo de Raadt wrote:
> You want 10 layers up of high level software, to redefine fields in
> a system .h file -- for an ecosystem that isn't part of OpenBSD at
> all.

OpenBSD is the exception to the rule within the framework, there is no
specific changes needed to the said 10 layers of high level software.
The change also works as intended.

> That is ridiculous.  It isn't going to happen.

Ok, I wont press any further.


Sevan



Re: Permitting the override of MACHINE_ARCH in amd64/param.h

2015-10-12 Thread Ted Unangst
Sevan Janiyan wrote:
> 
> 
> On 12/10/2015 16:30, Theo de Raadt wrote:
> > You have failed to explain the usage case; I don't believe there is
> > any scenario where people benefit from more architecture divergence.
> 
> As an example, in pkgsrc, CPUs architectures are grouped under a common
> alias so they can be addressed once rather than addressing each variant
> individually amongst all the supported architectures eg if {OPSYS} ==
> "x86_64" rather than {OPSYS} == "x86_64" || {OPSYS} == "amd64"
> There are some situations where OpenBSD is specifically accounted for
> but if it was possible to override the MACHINE_ARCH definition, it would
> not need to be addressed specifically & any such cases could be removed.

But this doesn't make sense. param.h tells you what the arch, not the other
way around. if you already know what the arch, such that you think you want to
override param.h, just don't include or look at param.h. you already have the
answer you want.



Re: Permitting the override of MACHINE_ARCH in amd64/param.h

2015-10-12 Thread Sevan Janiyan


On 12/10/2015 18:32, Ted Unangst wrote:
> just don't include or look at param.h.

Looking into doing that now.


Sevan