fix: relax old linux objtool warning
This commit is contained in:
parent
18fcb473e8
commit
8e50a5f134
|
|
@ -76,7 +76,8 @@ class LinuxKbuildTreeConan(ConanFile):
|
||||||
make_base = (
|
make_base = (
|
||||||
f"make --no-print-directory -C {shlex.quote(linux)}{make_jobs} "
|
f"make --no-print-directory -C {shlex.quote(linux)}{make_jobs} "
|
||||||
f"ARCH={shlex.quote(str(arch))} "
|
f"ARCH={shlex.quote(str(arch))} "
|
||||||
f"CROSS_COMPILE={shlex.quote(str(cross_compile))}"
|
f"CROSS_COMPILE={shlex.quote(str(cross_compile))} "
|
||||||
|
f"{self._host_warning_flags_args}"
|
||||||
)
|
)
|
||||||
|
|
||||||
self._install_config(linux, make_base)
|
self._install_config(linux, make_base)
|
||||||
|
|
@ -153,6 +154,52 @@ class LinuxKbuildTreeConan(ConanFile):
|
||||||
f"linux-{archive_version}.tar.gz"
|
f"linux-{archive_version}.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _host_warning_flags_args(self):
|
||||||
|
hostcflags = []
|
||||||
|
|
||||||
|
if self._version_lt("5.16.0") and self._host_compiler_accepts(
|
||||||
|
"-Wno-error=use-after-free"
|
||||||
|
):
|
||||||
|
# Older objtool builds use -Werror and trip GCC 14's realloc(ptr)
|
||||||
|
# use-after-free diagnostic in tools/lib/subcmd/subcmd-util.h.
|
||||||
|
hostcflags.append("-Wno-error=use-after-free")
|
||||||
|
|
||||||
|
if not hostcflags:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
flags = shlex.quote(" ".join(hostcflags))
|
||||||
|
return f"HOSTCFLAGS={flags} EXTRA_CFLAGS={flags}"
|
||||||
|
|
||||||
|
def _host_compiler_accepts(self, flag):
|
||||||
|
try:
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
"gcc",
|
||||||
|
flag,
|
||||||
|
"-x",
|
||||||
|
"c",
|
||||||
|
"-c",
|
||||||
|
"-o",
|
||||||
|
os.devnull,
|
||||||
|
"-",
|
||||||
|
],
|
||||||
|
input="int main(void) { return 0; }\n",
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
except (OSError, subprocess.CalledProcessError):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _version_lt(self, other):
|
||||||
|
return self._version_tuple(str(self.version)) < self._version_tuple(other)
|
||||||
|
|
||||||
|
def _version_tuple(self, version):
|
||||||
|
return tuple(int(part) for part in version.split("."))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _kernel_arch(self):
|
def _kernel_arch(self):
|
||||||
arch = str(self.settings.arch)
|
arch = str(self.settings.arch)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue