Testcase: port biology/dsr-pdb @ rev.cf118ccf875508b9a1c570044c93cfcc82bd455c Error: > ld: error: undefined symbol: .mcount
This port seems to unconditionally pass -pg: work/dsr-pdb-1.0.3/lib/Makefile.am 5:AM_CPPFLAGS = -I../include -pg work/dsr-pdb-1.0.3/lib/Makefile.in 183:AM_CPPFLAGS = -I../include -pg
(In reply to Ed Maste from comment #1) To go along with your note, I'll quote main's [so: 14's] "man src.conf": QUOTE WITH_PROFILE Build profiled libraries for use with gprof(8). This option is deprecated and is not present in FreeBSD 14. END QUOTE So, going forward to after stable/13 , it would not be just aarch64 that would not work.
The -pg option still works in main / 14, it's just that we don't build special versions of the system libraries already compiled with -pg.
(In reply to Ed Maste from comment #3) If that is not what leads to "undefined symbol: .mcount", then sorry for the noise.
(In reply to Mark Millard from comment #4) Looks like the issue is just that we don't have the low-level mcount bits on arm64; see sys/arm64/include/profile.h and compare with sys/amd64/include/profile.h. See also NetBSD sys/arch/aarch64/include/profile.h OpenBSD sys/arch/arm64/include/profile.h
See https://reviews.freebsd.org/D34634 for an implementation of .mcount for arm64.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=16d5f9a1649e6a3e5841c6c41d6af9430ed9f064 commit 16d5f9a1649e6a3e5841c6c41d6af9430ed9f064 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-03-22 15:46:15 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2022-03-23 15:16:59 +0000 Add an implementation of .mcount on arm64 To support cc -pg on arm64 we need to implement .mcount. As clang and gcc think it is function like it just needs to load the arguments to _mcount and call it. On gcc the first argument is passed in x0, however this is missing on clang so we need to load it from the stack. As it's the caller return address this will be at a known location. PR: 262709 Reviewed by: emaste (earlier version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34634 lib/libc/aarch64/Symbol.map | 1 + sys/arm64/include/profile.h | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2e38975e5aa41c576b87e5766b51d28fed0034ee commit 2e38975e5aa41c576b87e5766b51d28fed0034ee Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-03-22 15:46:15 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2022-04-19 09:18:02 +0000 Add an implementation of .mcount on arm64 To support cc -pg on arm64 we need to implement .mcount. As clang and gcc think it is function like it just needs to load the arguments to _mcount and call it. On gcc the first argument is passed in x0, however this is missing on clang so we need to load it from the stack. As it's the caller return address this will be at a known location. PR: 262709 Reviewed by: emaste (earlier version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34634 (cherry picked from commit 16d5f9a1649e6a3e5841c6c41d6af9430ed9f064) lib/libc/aarch64/Symbol.map | 1 + sys/arm64/include/profile.h | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-)