Skip to content

Commit 4fb0ee7

Browse files
authored
Add audit pass to check OS/ABI for FreeBSD libraries (#612)
1 parent f30ed3c commit 4fb0ee7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Auditor.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include("auditor/symlink_translator.jl")
66
include("auditor/compiler_abi.jl")
77
include("auditor/soname_matching.jl")
88
include("auditor/filesystems.jl")
9+
include("auditor/extra_checks.jl")
910

1011
# AUDITOR TODO LIST:
1112
#
@@ -82,6 +83,7 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
8283
all_ok &= check_dynamic_linkage(oh, prefix, bin_files;
8384
platform=platform, silent=silent,
8485
verbose=verbose, autofix=autofix)
86+
all_ok &= check_os_abi(oh, platform, verbose = verbose)
8587
end
8688
end
8789
catch e

src/auditor/extra_checks.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file contains some extra checks that don't fall into the other
2+
# categories, for example because they're very platform-specific.
3+
4+
check_os_abi(::ObjectHandle, ::Platform, rest...; verbose::Bool = false, kwargs...) = true
5+
6+
function check_os_abi(oh::ELFHandle, ::FreeBSD, rest...; verbose::Bool = false, kwargs...)
7+
if oh.ei.osabi != 0x09
8+
# The dynamic loader should not have problems in this case, but the
9+
# linker may not appreciate. Let the user know about this.
10+
if verbose
11+
@warn "OS/ABI is not set to FreeBSD (0x09) in the file header, this may be an issue at linking time"
12+
end
13+
return false
14+
end
15+
return true
16+
end

0 commit comments

Comments
 (0)