9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: yaroslav <yarikos@gmail.com>
To: 9fans@9fans.net
Subject: [9fans] mallocz in APE
Date: Thu, 18 Jul 2013 11:49:26 +0300	[thread overview]
Message-ID: <9fb1f0189acbe5546193608dae59e08e@isd.dp.ua> (raw)

APE programs which require libmp fail to link due to unresolved
mallocz symbol.  Easily solved by providing a local implementation,
but why: it's already there - in an alternative form though:

	cpu% nm /386/lib/ape/libap.a  | grep -i mallocz
	9mallocz.8: T _MALLOCZ
	9mallocz.8: U malloc
	9mallocz.8: U memset

I don't really see the reasons for this rename, yet other APE libs
like libsec follow it:

	cpu% nm /386/lib/ape/libsec.a | grep -i mallocz
	sha2_64.8: U _MALLOCZ
	sha2_128.8: U _MALLOCZ
	rsaalloc.8: U _MALLOCZ
	egalloc.8: U _MALLOCZ
	dsaalloc.8: U _MALLOCZ

And libmp does not:

	cpu% nm /386/lib/ape/libmp.a | grep -i mallocz
	mpaux.8: U mallocz
	mpmul.8: U mallocz

Here's why:

	cpu% grep -ni mallocz /sys/src/ape/lib/*/*.h /sys/src/ape/lib/*/*/*.h
	/sys/src/ape/lib/9/libc.h:105: extern 	void *_MALLOCZ(int, int);
	/sys/src/ape/lib/9/libc.h:132: #define mallocz _MALLOCZ
	/sys/src/ape/lib/draw/libc.h:100: extern 	void *_MALLOCZ(int, int);
	/sys/src/ape/lib/draw/libc.h:127: #define mallocz _MALLOCZ
	/sys/src/ape/lib/mp/port/libc.h:14: extern	void*	mallocz(ulong, int);
	/sys/src/ape/lib/sec/port/libc.h:105: extern 	void *_MALLOCZ(int, int);
	/sys/src/ape/lib/sec/port/libc.h:132: #define mallocz _MALLOCZ

Note the libmp's one standing out.

A quick fix is to bring up mallocz bits in
/sys/src/ape/lib/mp/port/libc.h into agreement with the rest.

Replacing _MALLOCZ back with mallocz within APE realm seems to me a
better option to consider.

Comments are welcome.




             reply	other threads:[~2013-07-18  8:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18  8:49 yaroslav [this message]
2013-07-18 10:45 ` Steve Simon
2013-07-18 14:30   ` Yaroslav
2013-07-18 14:48     ` Steve Simon
2013-07-18 15:12       ` tlaronde
2013-07-18 15:21       ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fb1f0189acbe5546193608dae59e08e@isd.dp.ua \
    --to=yarikos@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).