Commit Graph

10 Commits

Author SHA1 Message Date
Donald Sharp
a7209c2dbc lib: Make coverity happy about close
The error condition handled both failure to open
and a fstat failure.  Just double check that the close
is appropriate to call.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-04-21 09:12:08 -04:00
David Lamparter
acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
David Lamparter
a185874504 lib/clippy: fix symbol validity check
If symvalid is false, looking at symidx is bogus.

This fixes a build-time SEGV on mips64el.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-06 17:05:25 +01:00
David Lamparter
5b4f4e626f build: first header *must* be zebra.h or config.h
This has already been a requirement for Solaris, it is still a
requirement for some of the autoconf feature checks to work correctly,
and it will be a requirement for `-fms-extensions`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-04 18:33:10 +02:00
David Lamparter
cfc45e911e lib/clippy: don't endian-convert twice
elf_getdata_rawchunk() already endian-converts; doing it again is, uh,
counterproductive.

Fixes: #10051
Reported-by: Lucian Cristian <lucian.cristian@gmail.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-18 10:20:34 +01:00
David Lamparter
3942ee1f7b lib: fix elf_py TLS section handling
... need to ignore TLS sections, their address is effectively
meaningless but can overlap other sections we actually need to access.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-10 15:30:56 +01:00
David Lamparter
3816ea6bb6 lib/clippy: fix forgotten conditional
This fixes some spurious warnings on *BSD, where `elffile_add_dynreloc`
isn't used since `elf_getdata_rawchunk` is not available.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-28 14:27:17 +02:00
David Lamparter
81693617a2 lib: add DT_REL to elf_py/clippy ELF code
ARM (32-bit) needs DT_REL... and here I was hoping I could avoid the
trouble.

Fixes: #8355
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-04-08 00:00:08 +02:00
David Lamparter
960b9a5383 *: require semicolon after DEFINE_<typesafe...>
Again, see previous commits.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:39 +01:00
David Lamparter
5609b3af49 lib/clippy: add libelf wrapper
This adds _clippy.ELFFile, which provides a fast wrapper around libelf.
The API is similar to / a subset of pyelfutils, which unfortunately is
painfully slow (to the tune of minutes instead of seconds.)

The idea is that xrefs can be read out of ELF files by reading out the
"xref_array" section or "FRRouting/XREF" note.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23 16:56:58 +01:00