This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add support for link-time warning on DLL usage


Dixitur illum ica2_ts@csv.ica.uni-stuttgart.de scribere...

>Thorsten Glaser wrote:
>> Hello all,
>> 
>> the patch below adds support for emitting a link-time warning each
>> time a DLL is used.
>
>Wouldn't it be simpler to just remove offending shared libraries
>from your system?

No, because, for example:
if you have a GPL-incompatible library and a GPL'd application, and
link them together, you can use the binary totally fine, you just
can't redistribute it.

Or, you might want to warn users from pitfalls.

>> We can already offer link-time warnings for used symbols (OpenBSD
>> uses this for strcpy() for example;
>
>What is this good for? For correct usage of strcpy(), it is annoying.

It is a design question, and the operating system developers' policy.
If you feel like this, you need not use the OS in question.

If you are an OS developer who wants to patch software in order to get
rid of these, this kind of warning is good, because it spots uses of
functions you might've overlooked.

>If the use of strcpy() is unwanted for some reason, you have to
>search and change the source code anyway. If you want to find out
>if the C library's strcpy() is used by some object, you have nm or
>readelf or objdump. If the C compiler happens to use a builtin
>strcpy(), the check will fail.

If you are actively hunting for e.g. string functions, there's a
gcc option which disables builtins.
Whether you want to use this in a production OS release, is a
different thing.

I'm not going into explaining why the OpenBSD people chose to add
the .gnu.warning.strcpy section to their libc, nor why I want to
emit DLL link-time warnings.
I'd just like to offer this patch as a possible extension for GNU
binutils, because other people might find it useful (and if not,
they need not use it). It's even no added bload.

Just my 0.02 EUR,
//Thorsten
-- 
Solange man keine schmutzigen Tricks macht, und ich meine *wirklich*
schmutzige Tricks, wie bei einer doppelt verketteten Liste beide
Pointer XORen und in nur einem Word speichern, funktioniert Boehm ganz
hervorragend.		-- Andreas Bogk über boehm-gc in d.a.s.r


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]