All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] [PATCH] lib: Fix undefined reference to `mq_open' build failures
Date: Mon, 10 Apr 2017 03:41:44 -0400 (EDT)	[thread overview]
Message-ID: <871439500.24205435.1491810104946.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20170407155222.GA9310@rei>



----- Original Message -----
> Hi!
> And unfortunatelly this approach does not seem to work for static
> linking :-(
> 
> Seems I misunderstand how weak symbols are handled, since if the weak
> symbol is linked into the binary the linker does not even try to
> resolve it hence the strong symbol in librt.so is ignored.
> 
> Basically what we wanted to have is the weak_import attribute that could
> be used on apple OSX.
> 
> Anyway possible solutions I can come up with:
> 
> 
> * Switch to dynamic linking for libltp
> 
>   - may be worth the saving some megabytes on file size
> 
>   - would require the dynamic library to be put in the correct path or
>     messing with LD_LIBRARY_PATH though

I'd avoid this, as it makes it more difficult to run tests in-tree.

> 
> 
> * Getting pointer to the mq_open() function via
>   dlysm(RTLD_DEFAULT, "mq_open") and TBROK if we get NULL
> 
>   - this requires the test linked with -ldl though
>     so this is not helping much
> 
> 
> * Splitting the libltp.a into libltp.a and libltprt.a
> 
>   - this is not elegant, but bullet-proof
> 
> 
> * Hacking around build system and link the stub
>   only when -lrt is not in CFLAGS
> 
>   - this is hackery, but would probably work fine
> 
> 
> * Anything else?

Move safe_mq_open to header?

> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
> 

  reply	other threads:[~2017-04-10  7:41 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
2017-04-06  7:45 ` Cyril Hrubis
2017-04-07 15:52   ` Cyril Hrubis
2017-04-10  7:41     ` Jan Stancek [this message]
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=871439500.24205435.1491810104946.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.