public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Howard Chu <hyc@symas.com>
To: Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] dependency list for static libraries
Date: Wed, 4 Nov 2020 14:50:13 +0000	[thread overview]
Message-ID: <feee3401-bb83-14fe-af28-6c46ce19b088@symas.com> (raw)
In-Reply-To: <7dba4046-3d50-c7e6-915d-08bf590bf057@redhat.com>

Nick Clifton wrote:
> Hi Howard,
> 
>> One big question
>> I still have is how to get this plugin to be used by default?
> 
> I do not think that there is a way to guarantee this.  After all
> plugins, by design, are intended to be optional.
> 
> Obviously if a build system is involved - one that is adding the
> --record-libdeps option when creating libraries - then it will be
> able to add the necessary linker command line option to invoke
> the plugin as well.

I suppose that means I'll still be using shell scripts to wrap these then.
Was hoping to be able to do away with them.


On a slightly related note - are linker plugins supposed to be compatible
between ld and gold? I get a SEGV using gold:

Reading symbols from ./ld-new...
(gdb) r
Starting program: /media/hyc/software/binutils.o/gold/ld-new -plugin ../ld/.libs/libdep_plugin.so -o ssljunk ../ld/ssljunk.o -L/usr/local/lib -lssl
-L/usr/lib/x86_64-linux-gnu -lpthread -lc -ldl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
gold::Workqueue::add_to_queue (this=0x0, queue=0x8, t=0x555555bb3200, front=false)
    at ../../binutils-gdb/gold/workqueue.cc:154
154	  Hold_lock hl(this->lock_);
(gdb) bt
#0  gold::Workqueue::add_to_queue (this=0x0, queue=0x8, t=0x555555bb3200, front=false)
    at ../../binutils-gdb/gold/workqueue.cc:154
#1  0x00005555559b70ab in gold::Plugin_manager::add_input_file (this=0x555555b8c350, pathname=<optimized out>,
    is_lib=<optimized out>) at /usr/include/c++/9/bits/char_traits.h:300
#2  0x00007ffff74b2d93 in onclaim_file (claimed=<optimized out>, file=<optimized out>)
    at ../../binutils-gdb/ld/libdep_plugin.c:217
#3  onclaim_file (file=<optimized out>, claimed=<optimized out>) at ../../binutils-gdb/ld/libdep_plugin.c:145
#4  0x00005555559b6b69 in gold::Plugin::claim_file (this=<optimized out>, plugin_input_file=0x555555b8c3a8)
    at ../../binutils-gdb/gold/plugin.cc:390
#5  gold::Plugin_manager::claim_file (this=this@entry=0x555555b8c350, input_file=0x555555c2b9e0, offset=441644,
    filesize=7880, elf_object=<optimized out>, elf_object@entry=0x555555c399e0)
    at ../../binutils-gdb/gold/plugin.cc:766
#6  0x00005555558c216f in gold::Archive::get_elf_object_for_member (this=0x555555b83c80, off=441584,
    punconfigured=<optimized out>) at ../../binutils-gdb/gold/options.h:1646
#7  0x00005555558c2c3e in gold::Archive::include_member (this=0x555555b83c80, symtab=0x7fffffff4760,
    layout=0x7fffffff4a20, input_objects=0x7fffffff4520, off=441584, mapfile=<optimized out>, sym=0x555555c176f0,
    why=0x7fffffff4150 "") at ../../binutils-gdb/gold/archive.cc:1030
#8  0x00005555558c3485 in gold::Archive::add_symbols (this=0x555555b83c80, symtab=0x7fffffff4760,
    layout=0x7fffffff4a20, input_objects=0x7fffffff4520, mapfile=0x0) at /usr/include/c++/9/bits/basic_string.h:2300
#9  0x00005555558c3641 in gold::Add_archive_symbols::run (this=0x555555c357e0, workqueue=0x7fffffff4460)
    at ../../binutils-gdb/gold/archive.cc:1142
#10 0x0000555555a0ea58 in gold::Workqueue::find_and_run_task (this=0x7fffffff4460, thread_number=0)
    at ../../binutils-gdb/gold/token.h:290
#11 0x0000555555a0ecaa in gold::Workqueue::process (this=this@entry=0x7fffffff4460,
    thread_number=thread_number@entry=0) at ../../binutils-gdb/gold/workqueue.cc:495
#12 0x00005555556c6e85 in main (argc=<optimized out>, argv=<optimized out>) at ../../binutils-gdb/gold/main.cc:252
(gdb) frame 2
#2  0x00007ffff74b2d93 in onclaim_file (claimed=<optimized out>, file=<optimized out>)
    at ../../binutils-gdb/ld/libdep_plugin.c:217
217	        rv = tv_add_input_library (vec[i]+2);
(gdb)

While using ld yields:

violino:/media/hyc/software/binutils.o/ld> ./ld-new -plugin ../ld/.libs/libdep_plugin.so -o ssljunk ../ld/ssljunk.o -L/usr/local/lib -lssl
-L/usr/lib/x86_64-linux-gnu -lpthread -lc -ldl
processed deps for library /usr/local/lib/libssl.a: -lcrypto
./ld-new: warning: cannot find entry symbol _start; defaulting to 0000000000404000
./ld-new: /usr/local/lib/libcrypto.a(init.o): in function `ossl_init_register_atexit_ossl_':
init.c:(.text+0x1c0): undefined reference to `atexit'
./ld-new: /usr/local/lib/libcrypto.a(threads_pthread.o): in function `fork_once_func':
threads_pthread.c:(.text+0x1a): undefined reference to `pthread_atfork'

(Testing with __.LIBDEP in libssl.a containing just "-lcrypto")

-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

  reply	other threads:[~2020-11-04 14:50 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 15:49 Howard Chu
2017-09-19 15:52 ` Simon Richter
     [not found]   ` <WM!bae999665f49907786872b93f01ac98d53e7b97e29b4228399d8baadf9ec0ab33db74467d73c998225b250ba1d00a4c0!@mailstronghold-3.zmailcloud.com>
2017-09-19 16:04     ` Howard Chu
2017-09-20  1:42       ` R0b0t1
2017-09-19 16:54 ` Joseph Myers
     [not found]   ` <WM!83b6ad7285aa96ce69fcd1944d4eae8f20e5f19dfbf161f45313f5393bcffe1b77231520b8f4e24145a3f85eeafb39ed!@mailstronghold-1.zmailcloud.com>
2017-09-19 22:01     ` Howard Chu
2017-09-20  0:20       ` Joseph Myers
2020-09-03 20:42       ` Howard Chu
2020-09-22 10:39         ` Nick Clifton
2020-09-22 11:42           ` Howard Chu
2020-09-22 13:12             ` Nick Clifton
2020-09-22 16:23               ` [PATCH] " Howard Chu
2020-09-22 17:16                 ` Fangrui Song
2020-09-22 17:55                   ` Howard Chu
2020-09-22 20:46                 ` Howard Chu
2020-09-23 11:52                   ` Nick Clifton
2020-09-23 15:29                     ` Howard Chu
2020-09-24  5:21                       ` Fangrui Song
2020-09-24  9:19                         ` Howard Chu
2020-09-24  9:30                           ` Howard Chu
2020-09-28 11:07                           ` Howard Chu
2020-10-28 14:56                     ` Howard Chu
2020-11-03 15:14                       ` Nick Clifton
2020-11-03 15:31                         ` Howard Chu
2020-11-08  1:39                           ` Alan Modra
2020-11-08 15:07                             ` Howard Chu
2020-11-09  0:01                               ` Alan Modra
2020-11-10  2:44                                 ` Howard Chu
2020-11-10 11:07                                   ` Alan Modra
2020-11-11 14:57                                     ` Howard Chu
2020-11-11 14:59                                       ` Howard Chu
2020-11-17 14:01                                         ` Nick Clifton
2020-11-04  0:33                         ` Howard Chu
2020-11-04 11:01                           ` Nick Clifton
2020-11-04 14:50                             ` Howard Chu [this message]
2020-11-06 12:38                               ` Nick Clifton
2020-11-13 14:40                               ` Howard Chu
2020-11-24 17:49                                 ` Howard Chu
2020-11-25 11:17                                   ` Nick Clifton
2020-12-01  0:08                                     ` Howard Chu
2020-12-14 14:28                                       ` Nick Clifton
2020-12-15 16:17                                         ` Jim Wilson
2020-12-15 16:22                                           ` Jeff Law
2020-12-15 16:50                                             ` Nick Clifton
2020-12-15 19:11                                               ` Jeff Law
2020-12-15 20:04                                                 ` Jim Wilson
2020-12-15 20:22                                               ` Cary Coutant
2020-12-15 20:51                                                 ` Howard Chu
2020-12-16 11:16                                                   ` Nick Clifton
2020-12-16 14:49                                                     ` [PATCH] ld: Call plugin hooks only if they are available H.J. Lu
2020-12-16 18:34                                                       ` Howard Chu
2020-12-16 18:40                                                         ` H.J. Lu
2020-12-16 19:06                                                           ` Howard Chu
2020-12-16 19:11                                                             ` [PATCH] ld: Skip libdep plugin if not all plugin hooks " H.J. Lu
2020-12-16 21:26                                                               ` Howard Chu
2020-12-16 21:47                                                                 ` H.J. Lu
2020-12-16 18:44                                                         ` [PATCH] ld: Call plugin hooks only if they " Howard Chu
2020-12-15 20:33                             ` [PATCH] dependency list for static libraries Cary Coutant
2020-12-15 20:53                               ` Howard Chu
2020-12-16 11:18                                 ` Nick Clifton
2020-12-23 13:27                         ` Matthias Klose
2020-12-23 18:23                           ` Howard Chu
2020-09-30 10:33 Peter Smith
2020-10-28 14:35 ` Howard Chu

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=feee3401-bb83-14fe-af28-6c46ce19b088@symas.com \
    --to=hyc@symas.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).