Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2024 12:11:31 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   main (via pkgbase use): -fsanitize=address use ends up with /usr/lib/libexecinfo.so.1 reference (not just /lib/* references)
Message-ID:  <6B2031BE-E9CE-471B-87CD-4E4418CBC5B8@yahoo.com>
References:  <6B2031BE-E9CE-471B-87CD-4E4418CBC5B8.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On a pkgbase official-build based system I ended up with "ldd a.out"
showing:

libexecinfo.so.1 =3D> /usr/lib/libexecinfo.so.1 (0x5430bd2d7000)

via the following (the -lsys is for __elf_aux_vector binding currently):


# more main.c
int main(void) { return 0; }

# cc -v -fsanitize=3Daddress -lsys main.c

# cc -v -fsanitize=3Daddress -lsys main.c
FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git =
llvmorg-17.0.6-0-g6009708b4367)
Target: aarch64-unknown-freebsd15.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/cc" -cc1 -triple aarch64-unknown-freebsd15.0 -emit-obj =
-mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend =
-main-file-name main.c -mrelocation-model static =
-mframe-pointer=3Dnon-leaf -ffp-contract=3Don -fno-rounding-math =
-mconstructor-aliases -funwind-tables=3D2 -target-cpu generic =
-target-feature +neon -target-feature +v8a -target-abi aapcs =
-debugger-tuning=3Dgdb -v -fcoverage-compilation-dir=3D/root/c_tests =
-resource-dir /usr/lib/clang/17 -internal-isystem =
/usr/lib/clang/17/include -internal-externc-isystem /usr/include =
-fdebug-compilation-dir=3D/root/c_tests -ferror-limit 19 =
-fsanitize=3Daddress =
-fsanitize-system-ignorelist=3D/usr/lib/clang/17/share/asan_ignorelist.txt=
 -fno-sanitize-memory-param-retval -fsanitize-address-use-after-scope =
-fsanitize-address-globals-dead-stripping -fno-assume-sane-operator-new =
-fno-signed-char -fgnuc-version=3D4.2.1 -fcolor-diagnostics -faddrsig =
-D__GCC_HAVE_DWARF2_CFI_ASM=3D1 -o /tmp/main-b64c2c.o -x c main.c
clang -cc1 version 17.0.6 based upon LLVM 17.0.6 default target =
aarch64-unknown-freebsd15.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/clang/17/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 =
--enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o =
/usr/lib/crtbegin.o -L/usr/lib --whole-archive =
/usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-aarch64.a =
--no-whole-archive --whole-archive =
/usr/lib/clang/17/lib/freebsd/libclang_rt.asan-aarch64.a =
--no-whole-archive --export-dynamic -lsys /tmp/main-b64c2c.o =
--no-as-needed -lpthread -lrt -lm -lexecinfo -lgcc --as-needed -lgcc_s =
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed =
/usr/lib/crtend.o /usr/lib/crtn.o

(Note the -lexecinfo in the /usr/bin/ld command above.)

# ldd -a a.out
a.out:
        libsys.so.7 =3D> /lib/libsys.so.7 (0x513cd0e45000)
        libthr.so.3 =3D> /lib/libthr.so.3 (0x513ccfa85000)
        librt.so.1 =3D> /lib/librt.so.1 (0x513cd000a000)
        libm.so.5 =3D> /lib/libm.so.5 (0x513cd239b000)
        libexecinfo.so.1 =3D> /usr/lib/libexecinfo.so.1 (0x513cd0f39000)
        libgcc_s.so.1 =3D> /lib/libgcc_s.so.1 (0x513cd131a000)
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)
/lib/libthr.so.3:
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)
        libsys.so.7 =3D> /lib/libsys.so.7 (0x513cd0e45000)
/lib/librt.so.1:
        libthr.so.3 =3D> /lib/libthr.so.3 (0x513ccfa85000)
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)
/lib/libm.so.5:
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)
/usr/lib/libexecinfo.so.1:
        libelf.so.2 =3D> /lib/libelf.so.2 (0x513cd3cd8000)
        libgcc_s.so.1 =3D> /lib/libgcc_s.so.1 (0x513cd131a000)
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)
/lib/libgcc_s.so.1:
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)
/lib/libc.so.7:
        libsys.so.7 =3D> /lib/libsys.so.7 (0x513cd0e45000)
/lib/libelf.so.2:
        libc.so.7 =3D> /lib/libc.so.7 (0x513cd2bba000)


By contrast, with just "-fsanitize=3Daddress" eliminated:

# cc -v -lsys main.c
FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git =
llvmorg-17.0.6-0-g6009708b4367)
Target: aarch64-unknown-freebsd15.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/cc" -cc1 -triple aarch64-unknown-freebsd15.0 -emit-obj =
-mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend =
-main-file-name main.c -mrelocation-model static =
-mframe-pointer=3Dnon-leaf -ffp-contract=3Don -fno-rounding-math =
-mconstructor-aliases -funwind-tables=3D2 -target-cpu generic =
-target-feature +neon -target-feature +v8a -target-abi aapcs =
-debugger-tuning=3Dgdb -v -fcoverage-compilation-dir=3D/root/c_tests =
-resource-dir /usr/lib/clang/17 -internal-isystem =
/usr/lib/clang/17/include -internal-externc-isystem /usr/include =
-fdebug-compilation-dir=3D/root/c_tests -ferror-limit 19 =
-fno-signed-char -fgnuc-version=3D4.2.1 -fcolor-diagnostics -faddrsig =
-D__GCC_HAVE_DWARF2_CFI_ASM=3D1 -o /tmp/main-9e40ef.o -x c main.c
clang -cc1 version 17.0.6 based upon LLVM 17.0.6 default target =
aarch64-unknown-freebsd15.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/clang/17/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 =
--enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o =
/usr/lib/crtbegin.o -L/usr/lib -lsys /tmp/main-9e40ef.o -lgcc =
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s =
--no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o

# ldd -a a.out
a.out:
        libsys.so.7 =3D> /lib/libsys.so.7 (0x19d023f23000)
        libc.so.7 =3D> /lib/libc.so.7 (0x19d024622000)
/lib/libc.so.7:
        libsys.so.7 =3D> /lib/libsys.so.7 (0x19d023f23000)




For reference for the pkgbase install (world ended up being
e53b83a849e3 based):

# uname -apKU
FreeBSD aarch64-main-pkgs 15.0-CURRENT FreeBSD 15.0-CURRENT =
main-n268410-445d3d227e68 GENERIC-NODEBUG arm64 aarch64 1500014 1500014

However, pkgbase does not have the kernel and world at the same place
relative to git commits of source code. See my note from yesterday:

=
https://lists.freebsd.org/archives/freebsd-pkgbase/2024-February/000319.ht=
ml

Looking at /usr/src/tests/sys/kern/sigsys.c in this pkgbse context
shows the content from about 10 hours after 445d3d227e68's commit:

git: e53b83a849e3 - main - tests/sigsys: initialize parameter passed to =
sysctlbyname() Gleb Smirnoff
(CommitDate: 2024-02-20 22:37:45 +0000)

(Note: The next commit's source was not present.)


(As stands, finding what to report about the commits a pkgbase
installation is based on is a mess to deal with.)

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6B2031BE-E9CE-471B-87CD-4E4418CBC5B8>