diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2024-05-06 10:29:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-06 10:29:05 -0400 |
| commit | 216bac2826d60c47615cf50df1833c5c8543c75e (patch) | |
| tree | b84c9e08d3113e1dd478d7fc222a0c77b07dbcca | |
| parent | 9de2f138f0b3e76324dfb9a11d85fbf6c13b8b89 (diff) | |
| parent | 2e84c37460e2f0f3444afe6645620c556a5f209a (diff) | |
Merge pull request #15902 from opensourcerouting/build-xref-setup-hppa
build: fix missing `XREF_SETUP` (and HP PA-RISC build failure)
| -rw-r--r-- | fpm/fpm_pb.c | 5 | ||||
| -rw-r--r-- | lib/elf_py.c | 9 | ||||
| -rw-r--r-- | mgmtd/mgmt_be_nb.c | 6 | ||||
| -rw-r--r-- | mgmtd/subdir.am | 1 | ||||
| -rw-r--r-- | python/clippy/__init__.py | 1 | ||||
| -rw-r--r-- | python/clippy/elf.py | 11 | ||||
| -rw-r--r-- | python/xrelfo.py | 15 | ||||
| -rw-r--r-- | qpb/qpb.c | 5 | ||||
| -rw-r--r-- | zebra/fpm_listener.c | 2 |
9 files changed, 53 insertions, 2 deletions
diff --git a/fpm/fpm_pb.c b/fpm/fpm_pb.c index e4c9395a84..0e8f618c4d 100644 --- a/fpm/fpm_pb.c +++ b/fpm/fpm_pb.c @@ -10,3 +10,8 @@ /* * Main file for the fpm_pb library. */ + +#include "config.h" +#include "xref.h" + +XREF_SETUP(); diff --git a/lib/elf_py.c b/lib/elf_py.c index 643495d8c7..2b4fea373f 100644 --- a/lib/elf_py.c +++ b/lib/elf_py.c @@ -1358,6 +1358,15 @@ bool elf_py_init(PyObject *pymod) (void)methods_elfpy; #endif +#if defined(HAVE_GELF_GETNOTE) && defined(HAVE_ELF_GETDATA_RAWCHUNK) + PyObject *elf_notes = Py_True; +#else + PyObject *elf_notes = Py_False; +#endif + Py_INCREF(elf_notes); + if (PyModule_AddObject(pymod, "elf_notes", elf_notes)) + Py_DECREF(elf_notes); + ELFFormatError = PyErr_NewException("_clippy.ELFFormatError", PyExc_ValueError, NULL); PyModule_AddObject(pymod, "ELFFormatError", ELFFormatError); diff --git a/mgmtd/mgmt_be_nb.c b/mgmtd/mgmt_be_nb.c new file mode 100644 index 0000000000..613272d407 --- /dev/null +++ b/mgmtd/mgmt_be_nb.c @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "config.h" +#include "xref.h" + +XREF_SETUP(); diff --git a/mgmtd/subdir.am b/mgmtd/subdir.am index 5182c4a47d..14544c4f05 100644 --- a/mgmtd/subdir.am +++ b/mgmtd/subdir.am @@ -16,6 +16,7 @@ clippy_scan += \ lib_LTLIBRARIES += mgmtd/libmgmt_be_nb.la mgmtd_libmgmt_be_nb_la_SOURCES = \ + mgmtd/mgmt_be_nb.c \ zebra/zebra_cli.c \ # end nodist_mgmtd_libmgmt_be_nb_la_SOURCES = \ diff --git a/python/clippy/__init__.py b/python/clippy/__init__.py index 60119fbac0..668724ab2a 100644 --- a/python/clippy/__init__.py +++ b/python/clippy/__init__.py @@ -20,6 +20,7 @@ from _clippy import ( CMD_ATTR_HIDDEN, CMD_ATTR_DEPRECATED, CMD_ATTR_NOSH, + elf_notes, ) diff --git a/python/clippy/elf.py b/python/clippy/elf.py index cc442eeda9..fd348428f0 100644 --- a/python/clippy/elf.py +++ b/python/clippy/elf.py @@ -458,7 +458,16 @@ class ELFSubset(object): - `this[123:str]` - extract until null byte. The slice stop value is the `str` type (or, technically, `unicode`.) """ - return self._obj[k] + if k.start < getattr(self._obj, "len", float("+Inf")): + return self._obj[k] + + real_sect = self._elffile.get_section_addr(self._obj.sh_addr + k.start) + offs = self._obj.sh_addr - real_sect.sh_addr + if k.stop is str: + new_k = slice(k.start + offs, str) + else: + new_k = slice(k.start + offs, k.stop + offs) + return real_sect[new_k] def getreloc(self, offset): """ diff --git a/python/xrelfo.py b/python/xrelfo.py index a40b19e5fb..07cd74071f 100644 --- a/python/xrelfo.py +++ b/python/xrelfo.py @@ -22,7 +22,7 @@ import argparse from clippy.uidhash import uidhash from clippy.elf import * -from clippy import frr_top_src, CmdAttr +from clippy import frr_top_src, CmdAttr, elf_notes from tiabwarfo import FieldApplicator from xref2vtysh import CommandEntry @@ -327,6 +327,7 @@ class Xrelfo(dict): } ) self._xrefs = [] + self.note_warn = False def load_file(self, filename): orig_filename = filename @@ -395,6 +396,15 @@ class Xrelfo(dict): ptrs = edf.iter_data(XrefPtr, slice(start, end)) else: + if elf_notes: + self.note_warn = True + sys.stderr.write( + """%s: warning: binary has no FRRouting.XREF note +%s- one of FRR_MODULE_SETUP, FRR_DAEMON_INFO or XREF_SETUP must be used +""" + % (orig_filename, orig_filename) + ) + xrefarray = edf.get_section("xref_array") if xrefarray is None: raise ValueError("file has neither xref note nor xref_array section") @@ -471,6 +481,9 @@ def _main(args): sys.stderr.write("while processing %s:\n" % (fn)) traceback.print_exc() + if xrelfo.note_warn and args.Werror: + errors += 1 + for option in dir(args): if option.startswith("W") and option != "Werror": checks = sorted(xrelfo.check(args)) @@ -10,3 +10,8 @@ /* * Main file for the qpb library. */ + +#include "config.h" +#include "xref.h" + +XREF_SETUP(); diff --git a/zebra/fpm_listener.c b/zebra/fpm_listener.c index b31c5f7ac6..5533fa7f8b 100644 --- a/zebra/fpm_listener.c +++ b/zebra/fpm_listener.c @@ -36,6 +36,8 @@ #include "fpm/fpm.h" #include "lib/libfrr.h" +XREF_SETUP(); + struct glob { int server_sock; int sock; |
