Re: tcsh -- build without sbrk

2018-11-05 Thread Marc Espie
On Mon, Nov 05, 2018 at 09:15:28AM -0500, Daniel Dickman wrote:
>gcc uses them for precompiled headers (PCH) which is a local diff added
>by kurt@ in 2009. its likely nothing in base uses PCH but i don't know
>what in ports needs this:

This has always been a mess. I suspect it's not really important these days
because pch only make sense for large C++ codebases, which are definitely
not going to be happy with the gcc from base anyway.

There is also some snippet using sbrk to avoid malloc in gmon.c.

That might be more of an issue...

>[3]https://github.com/openbsd/src/commit/cfee5d1
> 
>choices there would be to disable PCH support or maybe there's a
>different way to reimplement without brk/sbrk.

>clang looks like they have a HAVE_SBRK ifdef or something like that. so
>usage can likely be turned off but i don't know this codebase that well
>so that's just an assumption.

Yep, I'll have to look.



Re: tcsh -- build without sbrk

2018-11-05 Thread Daniel Dickman



> On Nov 5, 2018, at 8:47 AM, Marc Espie  wrote:
> 
>> On Mon, Nov 05, 2018 at 08:43:56AM -0500, Daniel Dickman wrote:
>> 
>> 
>>> On Nov 5, 2018, at 8:30 AM, Marc Espie  wrote:
>>> 
>>> Or we could just finally remove brk and sbrk from the libc ?
>>> 
>>> 
>> 
>> you won’t get very far. they are still needed in base (gcc, clang, mkhybrid).
> 
> The big question is, are they still *needed* or do those tools just *use them
> if they find them*.


mkhybrid is an easy diff.

gcc uses them for precompiled headers (PCH) which is a local diff added by 
kurt@ in 2009. its likely nothing in base uses PCH but i don’t know what in 
ports needs this:
https://github.com/openbsd/src/commit/cfee5d1

choices there would be to disable PCH support or maybe there’s a different way 
to reimplement without brk/sbrk.

clang looks like they have a HAVE_SBRK ifdef or something like that. so usage 
can likely be turned off but i don’t know this codebase that well so that’s 
just an assumption.


Re: tcsh -- build without sbrk

2018-11-05 Thread Stuart Henderson
On 2018/11/05 11:31, Stuart Henderson wrote:
> On 2018/11/04 10:29, Daniel Dickman wrote:
> > The below overrides the cached autoconf value that says that we have
> > sbrk(2) on our system and pretends like we don't have it.
> >
> > With this we can build tcsh without a need for sbrk(2).
> >
> > ok?
> 
> Should we just remove or change the entry in infrastructure/db/config.site
> instead?
> 
> This is where it shows up.
> 
> 
> $ find . -name 'configure*' -print0 | xargs -0 fgrep ac_cv_func_sbrk 
> 2>/dev/null
[snip]

Oh, and here is where sbrk shows up in .o files of built ports.


./devel/avr32/binutils:sbrk U
./devel/avr32/binutils:sbrk U
./devel/avr32/binutils:sbrk U
./devel/avr32/binutils:sbrk U
./devel/avr32/gcc-bootstrap:sbrk U
./devel/avr32/gcc-bootstrap:sbrk U
./devel/avr32/gcc-bootstrap:sbrk U
./devel/avr32/gcc-bootstrap:sbrk U
./devel/avr32/newlib:./build-i386/avr32/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:./build-i386/avr32/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:_sbrk_r ? 0 28
./devel/avr32/newlib:sbrkr.c F 0 0
./devel/avr32/newlib:__malloc_sbrk_base U
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:__malloc_max_sbrked_mem D 0 4
./devel/avr32/newlib:__malloc_sbrk_base D 0 4
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:./build-i386/avr32/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:./build-i386/avr32/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:sbrk ? 0 c
./devel/avr32/newlib:syssbrk.c F 0 0
./devel/avr32/newlib:_sbrk W 0 40
./devel/avr32/newlib:./build-i386/avr32/ucr1/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:./build-i386/avr32/ucr1/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:_sbrk_r ? 0 28
./devel/avr32/newlib:sbrkr.c F 0 0
./devel/avr32/newlib:__malloc_sbrk_base U
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:__malloc_max_sbrked_mem D 0 4
./devel/avr32/newlib:__malloc_sbrk_base D 0 4
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:./build-i386/avr32/ucr1/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:./build-i386/avr32/ucr1/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:sbrk ? 0 c
./devel/avr32/newlib:syssbrk.c F 0 0
./devel/avr32/newlib:_sbrk W 0 40
./devel/avr32/newlib:./build-i386/avr32/ucr1/libgloss/libnosys/sbrk.o:
./devel/avr32/newlib:./build-i386/avr32/ucr1/libgloss/libnosys/sbrk.o:
./devel/avr32/newlib:sbrk T 0 20
./devel/avr32/newlib:sbrk.c F 0 0
./devel/avr32/newlib:./build-i386/avr32/ucr2/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:./build-i386/avr32/ucr2/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:_sbrk_r ? 0 28
./devel/avr32/newlib:sbrkr.c F 0 0
./devel/avr32/newlib:__malloc_sbrk_base U
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:__malloc_max_sbrked_mem D 0 4
./devel/avr32/newlib:__malloc_sbrk_base D 0 4
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:./build-i386/avr32/ucr2/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:./build-i386/avr32/ucr2/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:sbrk ? 0 c
./devel/avr32/newlib:syssbrk.c F 0 0
./devel/avr32/newlib:_sbrk W 0 40
./devel/avr32/newlib:./build-i386/avr32/ucr2/libgloss/libnosys/sbrk.o:
./devel/avr32/newlib:./build-i386/avr32/ucr2/libgloss/libnosys/sbrk.o:
./devel/avr32/newlib:sbrk T 0 20
./devel/avr32/newlib:sbrk.c F 0 0
./devel/avr32/newlib:./build-i386/avr32/ucr2nomul/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:./build-i386/avr32/ucr2nomul/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:_sbrk_r ? 0 28
./devel/avr32/newlib:sbrkr.c F 0 0
./devel/avr32/newlib:__malloc_sbrk_base U
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:__malloc_max_sbrked_mem D 0 4
./devel/avr32/newlib:__malloc_sbrk_base D 0 4
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:./build-i386/avr32/ucr2nomul/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:./build-i386/avr32/ucr2nomul/newlib/libc/syscalls/lib_a-syssbrk.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:sbrk ? 0 c
./devel/avr32/newlib:syssbrk.c F 0 0
./devel/avr32/newlib:_sbrk W 0 40
./devel/avr32/newlib:./build-i386/avr32/ucr2nomul/libgloss/libnosys/sbrk.o:
./devel/avr32/newlib:./build-i386/avr32/ucr2nomul/libgloss/libnosys/sbrk.o:
./devel/avr32/newlib:sbrk T 0 20
./devel/avr32/newlib:sbrk.c F 0 0
./devel/avr32/newlib:./build-i386/avr32/ucr3/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:./build-i386/avr32/ucr3/newlib/libc/reent/lib_a-sbrkr.o:
./devel/avr32/newlib:_sbrk U
./devel/avr32/newlib:_sbrk_r ? 0 28
./devel/avr32/newlib:sbrkr.c F 0 0
./devel/avr32/newlib:__malloc_sbrk_base U
./devel/avr32/newlib:_sbrk_r U
./devel/avr32/newlib:__malloc_max_sbrked_mem D 0 4
./devel/avr32/newlib:__malloc_sbrk_base D 0 4
./devel/avr32/newlib:_sbrk_r U

Re: tcsh -- build without sbrk

2018-11-05 Thread Theo de Raadt
>> On Nov 5, 2018, at 8:30 AM, Marc Espie  wrote:
>> 
>> Or we could just finally remove brk and sbrk from the libc ?
>> 
>> 
>
>you won???t get very far. they are still needed in base (gcc, clang, mkhybrid).

The goal isn't to remove it.

Rather, we want to neuter one semantic component, such that uvm can
become simpler.

A similar thing happened to vfork ages ago.



Re: tcsh -- build without sbrk

2018-11-05 Thread Marc Espie
On Mon, Nov 05, 2018 at 08:43:56AM -0500, Daniel Dickman wrote:
> 
> 
> > On Nov 5, 2018, at 8:30 AM, Marc Espie  wrote:
> > 
> > Or we could just finally remove brk and sbrk from the libc ?
> > 
> > 
> 
> you won’t get very far. they are still needed in base (gcc, clang, mkhybrid).

The big question is, are they still *needed* or do those tools just *use them
if they find them*.



Re: tcsh -- build without sbrk

2018-11-05 Thread Daniel Dickman



> On Nov 5, 2018, at 8:30 AM, Marc Espie  wrote:
> 
> Or we could just finally remove brk and sbrk from the libc ?
> 
> 

you won’t get very far. they are still needed in base (gcc, clang, mkhybrid).



Re: tcsh -- build without sbrk

2018-11-05 Thread Marc Espie
On Mon, Nov 05, 2018 at 11:31:53AM +, Stuart Henderson wrote:
> On 2018/11/04 10:29, Daniel Dickman wrote:
> > The below overrides the cached autoconf value that says that we have
> > sbrk(2) on our system and pretends like we don't have it.
> >
> > With this we can build tcsh without a need for sbrk(2).
> >
> > ok?
> 
> Should we just remove or change the entry in infrastructure/db/config.site
> instead?
> 
> This is where it shows up.
> 
It looks worthwhile to try.

Or we could just finally remove brk and sbrk from the libc ?

Now that emacs21 is dead, is there any need for those functions ?

Archeology shows them in POSIX 1997, marked as "legacy" at that point.

I don't see them even mentioned in POSIX 2017



Re: tcsh -- build without sbrk

2018-11-05 Thread Stuart Henderson
On 2018/11/04 10:29, Daniel Dickman wrote:
> The below overrides the cached autoconf value that says that we have
> sbrk(2) on our system and pretends like we don't have it.
>
> With this we can build tcsh without a need for sbrk(2).
>
> ok?

Should we just remove or change the entry in infrastructure/db/config.site
instead?

This is where it shows up.


$ find . -name 'configure*' -print0 | xargs -0 fgrep ac_cv_func_sbrk 2>/dev/null
./arm-elf-binutils-2.20/binutils-2.20/gas/configure:  ac_fn_c_check_func 
"$LINENO" "sbrk" "ac_cv_func_sbrk"
./arm-elf-binutils-2.20/binutils-2.20/gas/configure:if test "x$ac_cv_func_sbrk" 
= x""yes; then :
./msp430-binutils-2.21.1a/binutils-2.21.1/gas/configure:  ac_fn_c_check_func 
"$LINENO" "sbrk" "ac_cv_func_sbrk"
./msp430-binutils-2.21.1a/binutils-2.21.1/gas/configure:if test 
"x$ac_cv_func_sbrk" = x""yes; then :
./erlang-R16B03-1/otp_src_R16B03-1/erts/configure:if test "x$ac_cv_func_sbrk" = 
"xyes"; then
./erlang-R16B03-1/otp_src_R16B03-1/erts/configure:if test $ac_cv_func_sbrk = 
yes; then
./erlang-R16B03-1/otp_src_R16B03-1/erts/configure.in:if test 
"x$ac_cv_func_sbrk" = "xyes"; then
./erlang-R16B03-1/otp_src_R16B03-1/erts/configure.in:if test $ac_cv_func_sbrk = 
yes; then
./erlang-17.5/otp_src_17.5/erts/configure.in:if test "x$ac_cv_func_sbrk" = 
"xyes"; then
./erlang-17.5/otp_src_17.5/erts/configure.in:if test $ac_cv_func_sbrk = yes; 
then
./erlang-17.5/otp_src_17.5/erts/configure:if test "x$ac_cv_func_sbrk" = "xyes"; 
then
./erlang-17.5/otp_src_17.5/erts/configure:if test $ac_cv_func_sbrk = yes; then
./erlang-18.1/otp_src_18.1/erts/configure.in:if test "x$ac_cv_func_sbrk" = 
"xyes"; then
./erlang-18.1/otp_src_18.1/erts/configure.in:if test $ac_cv_func_sbrk = yes; 
then
./erlang-18.1/otp_src_18.1/erts/configure:if test "x$ac_cv_func_sbrk" = "xyes"; 
then
./erlang-18.1/otp_src_18.1/erts/configure:if test $ac_cv_func_sbrk = yes; then
./erlang-19.3/otp_src_19.3/erts/configure.in:if test "x$ac_cv_func_sbrk" = 
"xyes"; then
./erlang-19.3/otp_src_19.3/erts/configure.in:if test $ac_cv_func_sbrk = yes; 
then
./erlang-19.3/otp_src_19.3/erts/configure:if test "x$ac_cv_func_sbrk" = "xyes"; 
then
./erlang-19.3/otp_src_19.3/erts/configure:if test $ac_cv_func_sbrk = yes; then
./redis-4.0.11/redis-4.0.11/deps/jemalloc/configure:ac_fn_c_check_func 
"$LINENO" "sbrk" "ac_cv_func_sbrk"
./redis-4.0.11/redis-4.0.11/deps/jemalloc/configure:if test "x$ac_cv_func_sbrk" 
= xyes; then :
./spidermonkey-52.8.1/firefox-52.8.1esr/memory/jemalloc/src/configure:ac_fn_c_check_func
 "$LINENO" "sbrk" "ac_cv_func_sbrk"
./spidermonkey-52.8.1/firefox-52.8.1esr/memory/jemalloc/src/configure:if test 
"x$ac_cv_func_sbrk" = xyes; then :
./emacs-26.1-gtk3/emacs-26.1/configure:  *) test "$ac_cv_func_sbrk" = yes && 
system_malloc=$emacs_cv_sanitize_address;;
./emacs-26.1-gtk3/emacs-26.1/configure.ac:  *) test "$ac_cv_func_sbrk" = yes && 
system_malloc=$emacs_cv_sanitize_address;;
./emacs-26.1-gtk2/emacs-26.1/configure:  *) test "$ac_cv_func_sbrk" = yes && 
system_malloc=$emacs_cv_sanitize_address;;
./emacs-26.1-gtk2/emacs-26.1/configure.ac:  *) test "$ac_cv_func_sbrk" = yes && 
system_malloc=$emacs_cv_sanitize_address;;
./emacs-26.1-no_x11/emacs-26.1/configure:  *) test "$ac_cv_func_sbrk" = yes && 
system_malloc=$emacs_cv_sanitize_address;;
./emacs-26.1-no_x11/emacs-26.1/configure.ac:  *) test "$ac_cv_func_sbrk" = yes 
&& system_malloc=$emacs_cv_sanitize_address;;
./rust-1.29.1/rustc-1.29.1-src/src/jemalloc/configure:ac_fn_c_check_func 
"$LINENO" "sbrk" "ac_cv_func_sbrk"
./rust-1.29.1/rustc-1.29.1-src/src/jemalloc/configure:if test 
"x$ac_cv_func_sbrk" = xyes; then :
./thunderbird-52.9.1/thunderbird-52.9.1/mozilla/memory/jemalloc/src/configure:ac_fn_c_check_func
 "$LINENO" "sbrk" "ac_cv_func_sbrk"
./thunderbird-52.9.1/thunderbird-52.9.1/mozilla/memory/jemalloc/src/configure:if
 test "x$ac_cv_func_sbrk" = xyes; then :
./chromium-69.0.3497.100/chromium-69.0.3497.100/third_party/tcmalloc/gperftools-2.0/vendor/configure:
  ac_fn_c_check_func "$LINENO" "sbrk" "ac_cv_func_sbrk"
./chromium-69.0.3497.100/chromium-69.0.3497.100/third_party/tcmalloc/gperftools-2.0/vendor/configure:if
 test "x$ac_cv_func_sbrk" = x""yes; then :
./iridium-2018.5.67/iridium-browser-2018.5.67/third_party/tcmalloc/vendor/configure:
  ac_fn_c_check_func "$LINENO" "sbrk" "ac_cv_func_sbrk"
./iridium-2018.5.67/iridium-browser-2018.5.67/third_party/tcmalloc/vendor/configure:if
 test "x$ac_cv_func_sbrk" = x""yes; then :
./seamonkey-2.49.4/seamonkey-2.49.4/mozilla/memory/jemalloc/src/configure:ac_fn_c_check_func
 "$LINENO" "sbrk" "ac_cv_func_sbrk"
./seamonkey-2.49.4/seamonkey-2.49.4/mozilla/memory/jemalloc/src/configure:if 
test "x$ac_cv_func_sbrk" = xyes; then :
./tb-browser-7.5.3/tor-browser-7.5.3/memory/jemalloc/src/configure:ac_fn_c_check_func
 "$LINENO" "sbrk" "ac_cv_func_sbrk"
./tb-browser-7.5.3/tor-browser-7.5.3/memory/jemalloc/src/configure:if test 
"x$ac_cv_func_sbrk" = xyes; then :



> Index: Makefile
>