autoPatchelfHook: teach it to avoid objects created by separateDebugInfo
otherwise systemd fails to build because autoPatchelfHook patches libs with debug objects and this creates circular dependencies from out to debug (of course, debug depends on out) example of faulty behavior: searching for dependencies of /nix/store/c8cd7b82py02f0rkags351nhg82wwjm6-systemd-minimal-257.5/bin/systemd-delta libsystemd-shared-257.so -> found: /nix/store/icpqrawjhsw4fbi4i2hp7cxvf3kbzq7m-systemd-minimal-257.5-debug/lib/debug libc.so.6 -> found: /nix/store/7lyblga0bzjk0sl93vp4aiwbvb57vp2x-glibc-2.40-66/lib
This commit is contained in:
parent
24cd08426a
commit
b0d26fa2cd
@ -95,6 +95,7 @@ autoPatchelfPostFixup() {
|
||||
if [[ -z "${dontAutoPatchelf-}" ]]; then
|
||||
autoPatchelf -- $(for output in $(getAllOutputNames); do
|
||||
[ -e "${!output}" ] || continue
|
||||
[ "${output}" = debug ] && continue
|
||||
echo "${!output}"
|
||||
done)
|
||||
fi
|
||||
|
@ -42,6 +42,13 @@ def is_dynamic_executable(elf: ELFFile) -> bool:
|
||||
# section but their ELF type is DYN.
|
||||
return bool(elf.get_section_by_name(".interp"))
|
||||
|
||||
def is_separate_debug_object(elf: ELFFile) -> bool:
|
||||
# objects created by separateDebugInfo = true have all the section headers
|
||||
# of the unstripped objects but those that normal `strip` would have kept
|
||||
# are NOBITS
|
||||
text_section = elf.get_section_by_name(".text")
|
||||
return elf.has_dwarf_info() and bool(text_section) and text_section.header['sh_type'] == "SHT_NOBITS"
|
||||
|
||||
|
||||
def get_dependencies(elf: ELFFile) -> list[list[Path]]:
|
||||
dependencies = []
|
||||
@ -174,6 +181,10 @@ def populate_cache(initial: list[Path], recursive: bool =False) -> None:
|
||||
|
||||
try:
|
||||
with open_elf(path) as elf:
|
||||
if is_separate_debug_object(elf):
|
||||
print(f"skipping {path} because it looks like a separate debug object")
|
||||
continue
|
||||
|
||||
osabi = get_osabi(elf)
|
||||
arch = get_arch(elf)
|
||||
rpath = [Path(p) for p in get_rpath(elf)
|
||||
|
Loading…
x
Reference in New Issue
Block a user