Re: git: fdd3f6f78888 - main - bsd.lib.mk: only ctfmerge if objfiles have a CTF section

From: Siva Mahadevan <siva_at_freebsd.org>
Date: Mon, 05 Oct 2026 19:55:01 UTC
On Mon Oct 5, 2026 at 106:00 UTC, Mark Johnston <markj@freebsd.org> wrote:
> On Mon, Oct 05, 2026 at 02:07:57PM +0000, Siva Mahadevan wrote:
>> The branch main has been updated by siva:
>> 
>> URL: https://cgit.FreeBSD.org/src/commit/?id=fdd3f6f78888b02a1bfa69a0572317413dc14a45
>> 
>> commit fdd3f6f78888b02a1bfa69a0572317413dc14a45
>> Author:     Siva Mahadevan <siva@FreeBSD.org>
>> AuthorDate: 2026-10-02 19:54:55 +0000
>> Commit:     Siva Mahadevan <siva@FreeBSD.org>
>> CommitDate: 2026-10-05 14:07:44 +0000
>> 
>>     bsd.lib.mk: only ctfmerge if objfiles have a CTF section
>>     
>>     PR:             299013
>>     Reported by:    Trond.Endrestol@ximalas.info
>>     Reviewed by:    emaste
>>     Fixes:          222210c6a822 ("libgcc_s: add libgcc_s_asneeded.so wrapper for gcc 16")
>>     MFC after:      3 days
>>     Sponsored by:   The FreeBSD Foundation
>>     Differential Revision:  https://reviews.freebsd.org/D60252
>> ---
>>  share/mk/bsd.lib.mk | 2 +-
>>  share/mk/sys.mk     | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
>> index e3b3d760ff28..5b7bed041b8f 100644
>> --- a/share/mk/bsd.lib.mk
>> +++ b/share/mk/bsd.lib.mk
>> @@ -291,7 +291,7 @@ ${SHLIB_NAME_FULL}: ${SOBJS}
>>  .endif
>>  	${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
>>  	    -o ${.TARGET} -Wl,-soname,${SONAME} ${SOBJS} ${LDADD}
>> -.if ${MK_CTF} != "no"
>> +.if ${MK_CTF} != "no" && defined(SOBJS) && !empty(SOBJS)
>>  	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
>>  .endif
>>  
>> diff --git a/share/mk/sys.mk b/share/mk/sys.mk
>> index bb943d2b1519..f63223e8464e 100644
>> --- a/share/mk/sys.mk
>> +++ b/share/mk/sys.mk
>> @@ -165,7 +165,7 @@ CPP		?=	cpp
>>  CTFFLAGS	?=	-L VERSION
>>  
>>  CTFCONVERT	?=	ctfconvert
>> -CTFMERGE	?=	ctfmerge
>> +CTFMERGE	?=	ctfmerge -t
>
> Is this part of the change intentional?  It doesn't seem right.  We may
> legitimately have object files without CTF info, I'm sure this happens
> in the kernel for instance.
>
>>  
>>  .if defined(CFLAGS) && (${CFLAGS:M-g} != "")
>>  CTFFLAGS	+=	-g
>> 

It was intentional, but made with the wrong understanding, thanks for
reporting this. I've submitted D60378 for review as a fix.