mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 16:54:30 +00:00
build: warn/fail on missing XREF_SETUP()
While clippy tries really, really hard to work under adverse conditions, and this catches missing XREF_SETUP() on almost all CPU architectures, this doesn't quite work on hppa. So, make it a warning on *all* platforms (or error for --enable-dev-build) in order to catch it before shipping off to Debian's buildd and blowing up there... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
3ca60d00b1
commit
85b09765c4
@ -1358,6 +1358,15 @@ bool elf_py_init(PyObject *pymod)
|
|||||||
(void)methods_elfpy;
|
(void)methods_elfpy;
|
||||||
#endif
|
#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",
|
ELFFormatError = PyErr_NewException("_clippy.ELFFormatError",
|
||||||
PyExc_ValueError, NULL);
|
PyExc_ValueError, NULL);
|
||||||
PyModule_AddObject(pymod, "ELFFormatError", ELFFormatError);
|
PyModule_AddObject(pymod, "ELFFormatError", ELFFormatError);
|
||||||
|
@ -20,6 +20,7 @@ from _clippy import (
|
|||||||
CMD_ATTR_HIDDEN,
|
CMD_ATTR_HIDDEN,
|
||||||
CMD_ATTR_DEPRECATED,
|
CMD_ATTR_DEPRECATED,
|
||||||
CMD_ATTR_NOSH,
|
CMD_ATTR_NOSH,
|
||||||
|
elf_notes,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import argparse
|
|||||||
|
|
||||||
from clippy.uidhash import uidhash
|
from clippy.uidhash import uidhash
|
||||||
from clippy.elf import *
|
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 tiabwarfo import FieldApplicator
|
||||||
from xref2vtysh import CommandEntry
|
from xref2vtysh import CommandEntry
|
||||||
|
|
||||||
@ -327,6 +327,7 @@ class Xrelfo(dict):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
self._xrefs = []
|
self._xrefs = []
|
||||||
|
self.note_warn = False
|
||||||
|
|
||||||
def load_file(self, filename):
|
def load_file(self, filename):
|
||||||
orig_filename = filename
|
orig_filename = filename
|
||||||
@ -395,6 +396,15 @@ class Xrelfo(dict):
|
|||||||
ptrs = edf.iter_data(XrefPtr, slice(start, end))
|
ptrs = edf.iter_data(XrefPtr, slice(start, end))
|
||||||
|
|
||||||
else:
|
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")
|
xrefarray = edf.get_section("xref_array")
|
||||||
if xrefarray is None:
|
if xrefarray is None:
|
||||||
raise ValueError("file has neither xref note nor xref_array section")
|
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))
|
sys.stderr.write("while processing %s:\n" % (fn))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
if xrelfo.note_warn and args.Werror:
|
||||||
|
errors += 1
|
||||||
|
|
||||||
for option in dir(args):
|
for option in dir(args):
|
||||||
if option.startswith("W") and option != "Werror":
|
if option.startswith("W") and option != "Werror":
|
||||||
checks = sorted(xrelfo.check(args))
|
checks = sorted(xrelfo.check(args))
|
||||||
|
Loading…
Reference in New Issue
Block a user