public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] [PATCH] lib: Fix undefined reference to `mq_open' build failures
Date: Wed, 5 Apr 2017 19:29:06 +0200	[thread overview]
Message-ID: <20170405172906.GA16120@rei.lan> (raw)
In-Reply-To: <20170405113417.49876712@linux-v3j5>

Hi!
> > +mqd_t __attribute__((weak)) mq_open(const char *name __attribute__((unused)),
> > +				    int oflag __attribute__((unused)), ...)
> > +{
> > +	tst_brk(TBROK, "mq_open() stub called!");
> 
> Maybe expand this to "mq_open() stub called! Add -lrt to linker flags".

Good idea, I will add a hint that -lr is probably missing in LDFLAGS to
the message.

> If we start stubbing a lot of functions then we could have a TST_STUB macro
> which takes the function name, arguments and linker switch (e.g. -lrt) and
> produces a stub.

That could end up quite complicated fast. For instance adding
__attribute__((unused)) to each of the parametes would either need
different version of the macro for each number of arguments or load of
macro trickery...

Let's keep it simple for now.

> > +	return 0;
> > +}
> > +
> >  int safe_mq_open(const char *file, const int lineno, const char *pathname,
> >  	int oflags, ...)
> >  {
> 
> I ran into this problem and the stub fixed it. I wonder why a test which never
> calls SAFE_MQ_OPEN triggers it and others do not and why it does not happen
> consistently. Perhaps the linker tries to do some relocation at a stage when
> the library is not available and whether it tries to do the relocation is
> effected by whatever libraries are available in the environment. I can't think
> why else it would only try to resolve it some of the time?

I do not understand why the problem manifests only rarely either, but I
fear that understanding it would require a few days of research...

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2017-04-05 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 16:50 [LTP] [RFC] [PATCH] lib: Fix undefined reference to `mq_open' build failures Cyril Hrubis
2017-04-05  9:34 ` Richard Palethorpe
2017-04-05 10:03   ` Jan Stancek
2017-04-05 17:29   ` Cyril Hrubis [this message]
2017-04-06  7:45 ` Cyril Hrubis
2017-04-07 15:52   ` Cyril Hrubis
2017-04-10  7:41     ` Jan Stancek
2017-04-10 11:33       ` Cyril Hrubis

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=20170405172906.GA16120@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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