CVS commit: src/sys/arch/macppc/stand/bootxx

2019-10-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Oct 28 18:13:40 UTC 2019

Modified Files:
src/sys/arch/macppc/stand/bootxx: bootxx.c

Log Message:
Mark local-only function as static to save space.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/macppc/stand/bootxx/bootxx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/macppc/stand/bootxx

2019-10-28 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Oct 28 18:13:40 UTC 2019

Modified Files:
src/sys/arch/macppc/stand/bootxx: bootxx.c

Log Message:
Mark local-only function as static to save space.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/macppc/stand/bootxx/bootxx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/macppc/stand/bootxx/bootxx.c
diff -u src/sys/arch/macppc/stand/bootxx/bootxx.c:1.19 src/sys/arch/macppc/stand/bootxx/bootxx.c:1.20
--- src/sys/arch/macppc/stand/bootxx/bootxx.c:1.19	Mon Nov 12 20:00:46 2018
+++ src/sys/arch/macppc/stand/bootxx/bootxx.c	Mon Oct 28 18:13:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootxx.c,v 1.19 2018/11/12 20:00:46 scole Exp $	*/
+/*	$NetBSD: bootxx.c,v 1.20 2019/10/28 18:13:40 joerg Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -299,7 +299,7 @@ OF_write(int handle, const void *addr, i
 
 int stdout;
 
-void
+static void
 putstrn(const char *s, size_t n)
 {
 	OF_write(stdout, s, n);



Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-03 Thread Sevan Janiyan


On 03/03/18 22:06, matthew green wrote:
> we occasionally have to deal with this and either link against
> libgcc or provide them in libkern/libsa.  there can be new
> things from newer compilers, etc., when it starts emitting
> new calls it expects in libgcc or other.  kernels should not
> be using libgcc.

Got it.

>>> i don't know you can easily test it.  i would recommend
>>> putting the old code back for ${HAVE_GCC:U0} > 0 builds.
>>
>> Like so?
> 
> the patch below needs to remove the original line :-)
> 
> i'd probably implment it with eg
> 
> EXTRA_OBJS=
> .if ${HAVE_GCC:U0} > 0
> EXTRA_OBJS+= ${DESTDIR}/usr/lib/libgcc.a
> .endif
> 
> and add ${EXTRA_OBJS} to the link line, instead of duplicating
> the line inside the .if.

Thanks for the pointer, I appreciate it. One thing though, either I'm
missing something really obvious or that doesn't work (/usr/lib/libgcc.a
is not passed to the linker).

This does

Index: sys/arch/macppc/stand/bootxx/Makefile
===
RCS file: /cvsroot/src/sys/arch/macppc/stand/bootxx/Makefile,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile
--- sys/arch/macppc/stand/bootxx/Makefile   2 Mar 2018 23:15:25
-   1.18
+++ sys/arch/macppc/stand/bootxx/Makefile   4 Mar 2018 04:18:41 -
@@ -20,10 +20,11 @@ STRIPFLAG=
 LINKFLAGS= -x -N -Ttext 4000 -e _start
 LINKFLAGS+=${LINKFLAGS_UNWIND}
 CLEANFILES+=   ${PROG}.sym
+EXTRA_OBJS=${${HAVE_GCC:U0} > 0 :? ${DESTDIR}/usr/lib/libgcc.a :}

 ${PROG}: ${OBJS}
${_MKTARGET_LINK}
-   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
+   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS} ${EXTRA_OBJS}
${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}

 .include 



Sevan


re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-03 Thread matthew green
> BTW, we already have HAVE_LIBGCC and LIBGCC -that defaults exactly to
> ${DESTDIR}/usr/lib/libgcc.a (NB: you need to grep enough too to find
> it (LIB\$ in bsd.prog.mk).

ah good point.  (the original code used the bad way, so this
was an old problem already.)


.mrg.


re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-03 Thread matthew green
> On 03/03/18 02:06, matthew green wrote:
> > you didn't grep enough :-)  eg:
> > 
> > dist/gcc/config/rs6000/rs6000.c:prefix = (sel & SAVRES_SAVE) ? 
> > "_savegpr_" : "_restgpr_";
> > 
> > is the part that matters.
> 
> Just so I understand, where does this come into play from the bootxx
> side, reason I ask is there is no noise in the build output. bootxx
> compiles without warnings or complaint (I haven't touched the verbosity
> settings). Would problems with this binary be expected on execution &
> not during build?

i don't know.  i didn't actually look too deeply at it, but
i did recall these functions are prefix+name generated.

we occasionally have to deal with this and either link against
libgcc or provide them in libkern/libsa.  there can be new
things from newer compilers, etc., when it starts emitting
new calls it expects in libgcc or other.  kernels should not
be using libgcc.

> > i don't know you can easily test it.  i would recommend
> > putting the old code back for ${HAVE_GCC:U0} > 0 builds.
> 
> Like so?

the patch below needs to remove the original line :-)

i'd probably implment it with eg

EXTRA_OBJS=
.if ${HAVE_GCC:U0} > 0
EXTRA_OBJS+= ${DESTDIR}/usr/lib/libgcc.a
.endif

and add ${EXTRA_OBJS} to the link line, instead of duplicating
the line inside the .if.

thanks!


.mrg.

> Index: sys/arch/macppc/stand/bootxx/Makefile
> ===
> RCS file: /cvsroot/src/sys/arch/macppc/stand/bootxx/Makefile,v
> retrieving revision 1.18
> diff -u -p -r1.18 Makefile
> --- sys/arch/macppc/stand/bootxx/Makefile   2 Mar 2018 23:15:25
> -   1.18
> +++ sys/arch/macppc/stand/bootxx/Makefile   3 Mar 2018 03:22:09 -
> @@ -23,6 +23,11 @@ CLEANFILES+= ${PROG}.sym
> 
>  ${PROG}: ${OBJS}
> ${_MKTARGET_LINK}
> +.if ${HAVE_GCC:U0} > 0
> +   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
> ${DESTDIR}/usr/lib/libgcc.a
> +.else
> +   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
> +.endif
> ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
> ${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}
> 


Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-03 Thread Sevan Janiyan


On 03/03/18 09:23, Valery Ushakov wrote:
> Please, don't duplicate that line like that, variables were invented
> for a reason... LDADD is probably the right one to use here.

Sorry, uwe :)
I took mrg's recommendation to "putting the old code back for
${HAVE_GCC:U0} > 0 builds" quite literally.

> BTW, we already have HAVE_LIBGCC and LIBGCC -that defaults exactly to
> ${DESTDIR}/usr/lib/libgcc.a (NB: you need to grep enough too to find
> it (LIB\$ in bsd.prog.mk).

Understood.


Sevan


Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-03 Thread Valery Ushakov
On Sat, Mar 03, 2018 at 03:44:57 +, Sevan Janiyan wrote:

> Like so?
> 
> 
> Index: sys/arch/macppc/stand/bootxx/Makefile
> ===
> RCS file: /cvsroot/src/sys/arch/macppc/stand/bootxx/Makefile,v
> retrieving revision 1.18
> diff -u -p -r1.18 Makefile
> --- sys/arch/macppc/stand/bootxx/Makefile   2 Mar 2018 23:15:25
> -   1.18
> +++ sys/arch/macppc/stand/bootxx/Makefile   3 Mar 2018 03:22:09 -
> @@ -23,6 +23,11 @@ CLEANFILES+= ${PROG}.sym
> 
>  ${PROG}: ${OBJS}
> ${_MKTARGET_LINK}
> +.if ${HAVE_GCC:U0} > 0
> +   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
> ${DESTDIR}/usr/lib/libgcc.a
> +.else
> +   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
> +.endif
> ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
> ${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}

Please, don't duplicate that line like that, variables were invented
for a reason... LDADD is probably the right one to use here.

BTW, we already have HAVE_LIBGCC and LIBGCC -that defaults exactly to
${DESTDIR}/usr/lib/libgcc.a (NB: you need to grep enough too to find
it (LIB\$ in bsd.prog.mk).

-uwe


Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-02 Thread Sevan Janiyan


On 03/03/18 02:06, matthew green wrote:
> you didn't grep enough :-)  eg:
> 
> dist/gcc/config/rs6000/rs6000.c:prefix = (sel & SAVRES_SAVE) ? 
> "_savegpr_" : "_restgpr_";
> 
> is the part that matters.

Just so I understand, where does this come into play from the bootxx
side, reason I ask is there is no noise in the build output. bootxx
compiles without warnings or complaint (I haven't touched the verbosity
settings). Would problems with this binary be expected on execution &
not during build?

> i don't know you can easily test it.  i would recommend
> putting the old code back for ${HAVE_GCC:U0} > 0 builds.

Like so?


Index: sys/arch/macppc/stand/bootxx/Makefile
===
RCS file: /cvsroot/src/sys/arch/macppc/stand/bootxx/Makefile,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile
--- sys/arch/macppc/stand/bootxx/Makefile   2 Mar 2018 23:15:25
-   1.18
+++ sys/arch/macppc/stand/bootxx/Makefile   3 Mar 2018 03:22:09 -
@@ -23,6 +23,11 @@ CLEANFILES+= ${PROG}.sym

 ${PROG}: ${OBJS}
${_MKTARGET_LINK}
+.if ${HAVE_GCC:U0} > 0
+   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
${DESTDIR}/usr/lib/libgcc.a
+.else
+   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
+.endif
${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}



Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-02 Thread Sevan Janiyan


On 03/03/18 02:06, matthew green wrote:
> you didn't grep enough :-)  eg:

Bah! :)

> dist/gcc/config/rs6000/rs6000.c:prefix = (sel & SAVRES_SAVE) ? 
> "_savegpr_" : "_restgpr_";
> 
> is the part that matters.
> 
> i don't know you can easily test it.  i would recommend
> putting the old code back for ${HAVE_GCC:U0} > 0 builds.

Ok

Sevan


re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-02 Thread matthew green
> I did see that but thought that we'd had a toolchain update since then.
> grepping the source, the only place I see a reference to it is in
> external/gpl3/gcc/dist/libgcc/config/rs6000/crtresxgpr.S:HIDDEN_FUNC(_restgpr_30_x)
> lwz 30,-8(11)
> external/gpl3/gcc/dist/libgcc/config/rs6000/crtresxgpr.S:FUNC_END(_restgpr_30_x)
> external/gpl3/gcc.old/dist/libgcc/config/rs6000/crtresxgpr.S:HIDDEN_FUNC(_restgpr_30_x)
> lwz 30,-8(11)
> external/gpl3/gcc.old/dist/libgcc/config/rs6000/crtresxgpr.S:FUNC_END(_restgpr_30_x)

you didn't grep enough :-)  eg:

dist/gcc/config/rs6000/rs6000.c:prefix = (sel & SAVRES_SAVE) ? 
"_savegpr_" : "_restgpr_";

is the part that matters.

i don't know you can easily test it.  i would recommend
putting the old code back for ${HAVE_GCC:U0} > 0 builds.


.mrg.


Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-02 Thread Sevan Janiyan


On 03/02/18 23:22, Valery Ushakov wrote:
> I wonder if this might be dependendent on compiler options  (e.g. on
> sh4 gcc will emit calls to some libgcc functions only for some
> optimization settings).

hmm, do you have some optimisation settings in mind that I should test??


Sevan


Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-02 Thread Sevan Janiyan


On 03/02/18 23:22, Valery Ushakov wrote:
> That was introduced rather recently:
> 
>   revision 1.17
>   date: 2017-07-16 02:26:46 +0300;  author: christos;
>   branches:  1.17.2;
>   Avoid missing _restgpr_30_x

I did see that but thought that we'd had a toolchain update since then.
grepping the source, the only place I see a reference to it is in
external/gpl3/gcc/dist/libgcc/config/rs6000/crtresxgpr.S:HIDDEN_FUNC(_restgpr_30_x)
lwz 30,-8(11)
external/gpl3/gcc/dist/libgcc/config/rs6000/crtresxgpr.S:FUNC_END(_restgpr_30_x)
external/gpl3/gcc.old/dist/libgcc/config/rs6000/crtresxgpr.S:HIDDEN_FUNC(_restgpr_30_x)
lwz 30,-8(11)
external/gpl3/gcc.old/dist/libgcc/config/rs6000/crtresxgpr.S:FUNC_END(_restgpr_30_x)

> I wonder if this might be dependendent on compiler options  (e.g. on
> sh4 gcc will emit calls to some libgcc functions only for some
> optimization settings).

for my release build with GCC, I just did ./build.sh -m macppc release
for the LLVM build I did
./build.sh -V MKLLVM=yes -V HAVE_LLVM=yes -V MKGCC=no -m macppc release

I'd actually built the LLVM release using the following patch but opted
to remove the reference to libgcc.a when the default build passed on the
basis that I'd wait for the daily releng builds to see.

Index: sys/arch/macppc/stand/bootxx/Makefile
===
RCS file: /cvsroot/src/sys/arch/macppc/stand/bootxx/Makefile,v
retrieving revision 1.17
diff -u -p -r1.17 Makefile
--- sys/arch/macppc/stand/bootxx/Makefile   15 Jul 2017 23:26:46
-  1.17
+++ sys/arch/macppc/stand/bootxx/Makefile   2 Mar 2018 20:13:38 -
@@ -23,7 +23,7 @@ CLEANFILES+=  ${PROG}.sym

 ${PROG}: ${OBJS}
${_MKTARGET_LINK}
-   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS}
${DESTDIR}/usr/lib/libgcc.a
+   ${LD} -o ${.TARGET}.sym ${LINKFLAGS} ${OBJS} ${${ACTIVE_CC} ==
"gcc":? ${DESTDIR}/usr/lib/libgcc.a :}
${OBJCOPY} -O binary ${.TARGET}.sym ${.TARGET}

 .include 



Re: CVS commit: src/sys/arch/macppc/stand/bootxx

2018-03-02 Thread Valery Ushakov
On Fri, Mar 02, 2018 at 23:15:25 +, Sevan Janiyan wrote:

> Module Name:  src
> Committed By: sevan
> Date: Fri Mar  2 23:15:25 UTC 2018
> 
> Modified Files:
>   src/sys/arch/macppc/stand/bootxx: Makefile
> 
> Log Message:
> Do not pass libgcc.a to linker as it breaks build with MKGCC=no e.g
> HEAD-LLVM.  It doesn't appear to be required for the stock GCC build
> either, having been able to build a release without it.

That was introduced rather recently:

  revision 1.17
  date: 2017-07-16 02:26:46 +0300;  author: christos;
  branches:  1.17.2;
  Avoid missing _restgpr_30_x

I wonder if this might be dependendent on compiler options  (e.g. on
sh4 gcc will emit calls to some libgcc functions only for some
optimization settings).

-uwe