Hi,
On 2025-11-06 11:39:03 +0400, Arkady Skvorcov wrote:
> I'm working on a logical decoding improvement and running into a persistent
> build issue where LTO (-flto=thin) is optimizing out my LogicalWaitForWal
> function, even though there are explicit calls to it.
>
> The situation:
>
> Function LogicalWaitForWal() is defined in
> src/backend/replication/logical/logical.c
>
> It's called directly from logical_read_xlog_page_cv() in the same file
>
> logical_read_xlog_page_cv is assigned as the page_read callback via
> XL_ROUTINE in multiple places in logical.c
>
> The function appears in the object file (nm logical.o shows it)
>
> But it's completely absent from the final binary (nm postgres shows nothing)
Presumably what is happening is that it is inlined into the caller(s)?
> Is there a PostgreSQL-specific pattern or macro I should be using to ensure
> functions aren't optimized out when they're called via function pointers
> assigned in structs?
What problem is this actually causing for you?
Greetings,
Andres Freund