public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Howard Chu <hyc@symas.com>
To: Peter Smith <Peter.Smith@arm.com>, Fangrui Song <i@maskray.me>
Cc: "binutils@sourceware.org" <binutils@sourceware.org>
Subject: Re: [PATCH] dependency list for static libraries
Date: Wed, 28 Oct 2020 14:35:45 +0000	[thread overview]
Message-ID: <456f47ed-cc44-c2bd-2851-dc977c1ec74f@symas.com> (raw)
In-Reply-To: <VI1PR08MB3198682E169C337F0AE2DE6CF8330@VI1PR08MB3198.eurprd08.prod.outlook.com>

Peter Smith via Binutils wrote:
> Apologies in advance if the webmail client mangles the response or threading.
> 
> Just wanted to add to MaskRay's concerns about what the semantics are for a linker.
> * Where are the static library dependencies placed in the order of input files? Immediately after the static library seems the most logical choice although this will make it harder for users to interpose objects/libraries to override choices.

One major advantage of this approach is that if an end user needs to make changes, they can easily do
so without requiring the original source code or a compiler.

> * What happens when there are cyclic dependencies between libraries? Would the user be expected to know to wrap an individual library in a start-group end-group? Should the linker implicitly add start-group end-group around the dependencies?

I don't see how this is relevant. Circular dependencies would be a problem and would require the same
solution regardless.

> * This does seem like it will work for libraries designed to be incorporated as a whole (like a dynamic library), but it seems like it could have awkward corner cases.
> 
> Although not fundamentally opposed to this; personally I'm not a fan of encoding dependencies for static libraries. I see these more of a collection of objects and not a single entity like a dynamic library. If static libraries are being used whole, one way of implementing this would be to add a member to the library that is just a linker script with INPUT and GROUP commands, and link using --whole-archive.

If you're making a lot of use of --whole-archive You're Doing It Wrong. Should just use "ld -r -o aggregate.o foo.o bar.o ..."
and save the linker trouble later. Though this raises an interesting point, why not just eliminate the distinction between
libraries and individual .o files, like the AIX linker does? I.e., the AIX linker is capable of extracting individual required
symbols from a .o file, instead of just linking the entire thing as a unit.

-- 
  -- 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-10-28 14:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 10:33 Peter Smith
2020-10-28 14:35 ` Howard Chu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-19 15:49 Howard Chu
2017-09-19 16:54 ` Joseph Myers
     [not found]   ` <WM!83b6ad7285aa96ce69fcd1944d4eae8f20e5f19dfbf161f45313f5393bcffe1b77231520b8f4e24145a3f85eeafb39ed!@mailstronghold-1.zmailcloud.com>
2017-09-19 22:01     ` Howard Chu
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
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-15 20:33                             ` 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

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=456f47ed-cc44-c2bd-2851-dc977c1ec74f@symas.com \
    --to=hyc@symas.com \
    --cc=Peter.Smith@arm.com \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    /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).