lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ft3eujyv.fsf@nvidia.com>
Date:   Wed, 6 Jan 2021 17:08:08 +0100
From:   Petr Machata <petrm@...dia.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
CC:     Roi Dayan <roid@...dia.com>, Petr Machata <petrm@...dia.com>,
        <netdev@...r.kernel.org>, David Ahern <dsahern@...il.com>,
        Petr Machata <me@...chata.org>
Subject: Re: [PATCH iproute2] build: Fix link errors on some systems


Stephen Hemminger <stephen@...workplumber.org> writes:

> On Wed, 6 Jan 2021 10:42:35 +0200
> Roi Dayan <roid@...dia.com> wrote:
>
>> > 
>> > I think that just adding an unnecessary -lm is more of a tidiness issue
>> > than anything else. One way to avoid it is to split the -lm deps out
>> > from util.c / json_print.c to like util_math.c / json_print_math.c. That
>> > way they will be in an .o of their own, and won't be linked in unless
>> > the binary in question needs the code. Then the binaries that do call it
>> > can keep on linking in -lm like they did so far.
>> > 
>> > Thoughts?
>> >   
>
> Adding -lm to just some tools is not really required.
> The linker will ignore the shared library if not used.

I don't think that's true.

$ echo 'int main() {}' | gcc -x c /dev/stdin -lm
$ ldd a.out
	linux-vdso.so.1 (0x00007fff903e5000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fa475d75000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fa475bab000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fa475ee4000)

Anyway, without the split to math / non-math modules, the DSO will
actually end up being necessary, because the undefined references to
floor() etc. in util.o / json_print.o will bring it in. Except of course
not everybody actually uses the code...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ