Project

General

Profile

Feature #7319

Need a way to turn off ld "multiple inclusion" warnings

Added by Andrew Stormont almost 3 years ago. Updated almost 3 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-08-23
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Many build systems erroneously pass the same library to the linker multiple times and this means they can't be used with -zfatal-warnings and -zassert-deflib. Anything that uses libtool is prone to this issue, due to the way it propagates up dependencies from .la files when linking (and makes a half-hearted attempt to weed out duplicates). To work around this issue I propose we add a new -z mulincl flag which can be used to turn off this warning.

History

#1

Updated by Igor Kozhukhov almost 3 years ago

it is not a bug, it is new feature and can be discussed

#2

Updated by Andrew Stormont almost 3 years ago

  • Tracker changed from Bug to Feature
#3

Updated by Igor Kozhukhov almost 3 years ago

also, real example in bug report can show problem for better understanding of changes - what issue you try to resolve based on some component(s) builds

#4

Updated by Andrew Stormont almost 3 years ago

The libtool bug which I refer to is an old one: https://lists.gnu.org/archive/html/libtool/2012-04/msg00013.html

Considering that a) it's a warning and not a fatal error and b) it's benign because the linker ignores the other inclusions, I think it's safe to have an option to turn it off.

#5

Updated by Igor Kozhukhov almost 3 years ago

i have a lot of builds on dilos with userland apps and i have no hit it yet.
also, pkgsrc has more components and OI too.
is it real bug/issue and impact components builds?

#6

Updated by Andrew Stormont almost 3 years ago

It's a warning and only causes problem if -z fatal-warnings is passed to the linker. If you're not passing -z fatal-warning you will not have any problems.

#7

Updated by Andrew Stormont almost 3 years ago

FWIW binutils does not generate a warning for multiple inclusions.

#8

Updated by Andrew Stormont almost 3 years ago

Did that make sense Igor?

#9

Updated by Igor Kozhukhov almost 3 years ago

i have no found real example with log in this bug - it hardly to understand this issue, sorry
if you try to use some other flags - how are others platforms work with it?
like: linux, fbsd?
without real example with build log - it's hardly to me to understand how can i use it or is it really needed?
probably your issue can be resolved by another scenario without update illumos ld?
also, how you have tested it?
by one build - illumos - or by list of userland apps like OI userland or pkgsrc?
need more info about - how it can impact to others builds

#10

Updated by Andrew Stormont almost 3 years ago

Here's the gist of the issue:

I want to build with -z assert-deflib and -z fatal-warnings to stop binaries being linked with libraries outside my proto area. If you are not familiar with these options, have a look at the man page for ld.

Passing these options frequently results in build failures because libtool passes the same library to ld multiple times (hence the multiple inclusion warning) and this results in a build error when -z fatal-warnings is specified. Binutils does not generate a warning/error for this.

The correct fix for this would be to fix libtool, however the fix is not trivial. Even if we had a fix and it was accepted upstream it would be long before maintainers started to use the fixed version of libtool. Configure scripts generated against the old version would still be broken.

So this is a workaround for a difficult and very specific problem. To repeat: you will not run into the issue if you are not passing -z fatal-warnings to the linker or if you are using binutils.

#11

Updated by Andrew Stormont almost 3 years ago

  • % Done changed from 0 to 100

To answer your question about testing, I have built 238 packages with this change applied and the option enabled. Without it I get ~40 failures.

#12

Updated by Igor Kozhukhov almost 3 years ago

Andrew Stormont wrote:

Here's the gist of the issue:

I want to build with -z assert-deflib and -z fatal-warnings to stop binaries being linked with libraries outside my proto area. If you are not familiar with these options, have a look at the man page for ld.

Passing these options frequently results in build failures because libtool passes the same library to ld multiple times (hence the multiple inclusion warning) and this results in a build error when -z fatal-warnings is specified. Binutils does not generate a warning/error for this.

The correct fix for this would be to fix libtool, however the fix is not trivial. Even if we had a fix and it was accepted upstream it would be long before maintainers started to use the fixed version of libtool. Configure scripts generated against the old version would still be broken.

So this is a workaround for a difficult and very specific problem. To repeat: you will not run into the issue if you are not passing -z fatal-warnings to the linker or if you as using binutils.

you have answered to my question here - it is not a fix/feature - it is workaround to illumos ld, because you don't want to fix libtool, because it is not trivial.
and to be more clear - GNU binutils - it is GNU AS, GNU LD and others GNU tools.
what do you mean by - if you as using binutils ?
we are all using GNU AS with gcc on intel and some others GNU tools from GNU binutils.

i'm not sure it is issue in illumos ld and will wait others replies.

#13

Updated by Andrew Stormont almost 3 years ago

When I say binutils I am referring specifically to ld. illumos ld is arguably doing the "right thing", however in this case it is being more a hindrance than a help. I respect your position. Thanks for taking a look.

#14

Updated by Andrew Stormont almost 3 years ago

Sorry for the typo. I meant "if you ARE using binutils".

Also available in: Atom PDF