pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid unsatisfied-external-reference errors in static inlines.
6+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2022-07-15 3e9ca52601  Support gcc -fkeep-inline-functions
* pgsql: Avoid unsatisfied-external-reference errors in static inlines.
@ 2022-07-13 17:37  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2022-07-13 17:37 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid unsatisfied-external-reference errors in static inlines.

Commit 9c727360b neglected the lesson we've learned before:
protect references to backend global variables with #ifndef FRONTEND.

Since there's already a place for static inlines in this file,
move the just-converted functions to that stanza.  Undo the
entirely gratuitous de-macroization of RelationGetNumberOfBlocks
(that one may be okay, since it has no global variable references,
but it's also pointless).

Per buildfarm.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/27d2693187d1bcf2563ee7142ba37d4788c8d52b

Modified Files
--------------
src/include/storage/bufmgr.h | 166 +++++++++++++++++++++----------------------
1 file changed, 80 insertions(+), 86 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Avoid unsatisfied-external-reference errors in static inlines.
@ 2022-07-13 18:12  Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Eisentraut @ 2022-07-13 18:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers@lists.postgresql.org

On 13.07.22 19:37, Tom Lane wrote:
> Avoid unsatisfied-external-reference errors in static inlines.
> 
> Commit 9c727360b neglected the lesson we've learned before:
> protect references to backend global variables with #ifndef FRONTEND.

What platforms did this fail on?  How can one observe the failure locally?





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Avoid unsatisfied-external-reference errors in static inlines.
@ 2022-07-13 18:24  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2022-07-13 18:24 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: pgsql-committers@lists.postgresql.org

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> What platforms did this fail on?  How can one observe the failure locally?

wrasse at least:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=wrasse&dt=2022-07-13%2014%3A49%3A17

I think possibly you could duplicate the problem with gcc
by using -fkeep-inline-functions, but I've not tried.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Avoid unsatisfied-external-reference errors in static inlines.
@ 2022-07-14 10:05  Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Eisentraut @ 2022-07-14 10:05 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org

On 13.07.22 20:24, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
>> What platforms did this fail on?  How can one observe the failure locally?
> 
> wrasse at least:
> 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=wrasse&dt=2022-07-13%2014%3A49%3A17
> 
> I think possibly you could duplicate the problem with gcc
> by using -fkeep-inline-functions, but I've not tried.

Confirmed, -fkeep-inline-functions will catch it.  Good to know.





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: Avoid unsatisfied-external-reference errors in static inlines.
@ 2022-07-14 14:48  Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Eisentraut @ 2022-07-14 14:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org

On 14.07.22 12:05, Peter Eisentraut wrote:
> On 13.07.22 20:24, Tom Lane wrote:
>> Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
>>> What platforms did this fail on?  How can one observe the failure 
>>> locally?
>>
>> wrasse at least:
>>
>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=wrasse&dt=2022-07-13%2014%3A49%3A17 
>>
>>
>> I think possibly you could duplicate the problem with gcc
>> by using -fkeep-inline-functions, but I've not tried.
> 
> Confirmed, -fkeep-inline-functions will catch it.  Good to know.

It seems that -fkeep-inline-functions is more demanding than what wrasse 
is running on.  I need the attached patch to get it to build cleanly.

(The first hunk undoes some parts of 
2cd2569c72b8920048e35c31c9be30a6170e1410, but the others are unrelated 
and old.)

I think this would be good to apply so that this method of checking 
inline functions is available in the future.

Attachments:

0001-WIP-Support-gcc-fkeep-inline-functions.patch (text/plain, 3.2K) download From 9e57d1d42490ac37e8bd27804a6180ddee0fbf53 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Thu, 14 Jul 2022 15:54:40 +0200 Subject: [PATCH] WIP: Support gcc -fkeep-inline-functions --- src/include/storage/bufpage.h | 24 +++++++++--------------- src/include/utils/rel.h | 2 ++ src/include/utils/snapmgr.h | 2 ++ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index fc67d396b6..6a947021ac 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -466,6 +466,15 @@ do { \ #define PIV_LOG_WARNING (1 << 0) #define PIV_REPORT_STAT (1 << 1) +#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap) \ + PageAddItemExtended(page, item, size, offsetNumber, \ + ((overwrite) ? PAI_OVERWRITE : 0) | \ + ((is_heap) ? PAI_IS_HEAP : 0)) + +#define PageIsVerified(page, blkno) \ + PageIsVerifiedExtended(page, blkno, \ + PIV_LOG_WARNING | PIV_REPORT_STAT) + /* * Check that BLCKSZ is a multiple of sizeof(size_t). In * PageIsVerifiedExtended(), it is much faster to check if a page is @@ -480,21 +489,6 @@ extern void PageInit(Page page, Size pageSize, Size specialSize); extern bool PageIsVerifiedExtended(Page page, BlockNumber blkno, int flags); extern OffsetNumber PageAddItemExtended(Page page, Item item, Size size, OffsetNumber offsetNumber, int flags); - -static inline OffsetNumber -PageAddItem(Page page, Item item, Size size, OffsetNumber offsetNumber, bool overwrite, bool is_heap) -{ - return PageAddItemExtended(page, item, size, offsetNumber, - (overwrite ? PAI_OVERWRITE : 0) | - (is_heap ? PAI_IS_HEAP : 0)); -} - -static inline bool -PageIsVerified(Page page, BlockNumber blkno) -{ - return PageIsVerifiedExtended(page, blkno, PIV_LOG_WARNING | PIV_REPORT_STAT); -} - extern Page PageGetTempPage(Page page); extern Page PageGetTempPageCopy(Page page); extern Page PageGetTempPageCopySpecial(Page page); diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 2854839ec2..00b83b8924 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -564,6 +564,7 @@ typedef struct ViewOptions * each time you need to access the SMgrRelation. It's quite cheap in * comparison to whatever an smgr function is going to do. */ +#ifndef FRONTEND static inline SMgrRelation RelationGetSmgr(Relation rel) { @@ -571,6 +572,7 @@ RelationGetSmgr(Relation rel) smgrsetowner(&(rel->rd_smgr), smgropen(rel->rd_locator, rel->rd_backend)); return rel->rd_smgr; } +#endif /* * RelationCloseSmgr diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index 67b217b1c1..06eafdf118 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -97,11 +97,13 @@ extern PGDLLIMPORT SnapshotData CatalogSnapshotData; ((snapshot)->snapshot_type == SNAPSHOT_MVCC || \ (snapshot)->snapshot_type == SNAPSHOT_HISTORIC_MVCC) +#ifndef FRONTEND static inline bool OldSnapshotThresholdActive(void) { return old_snapshot_threshold >= 0; } +#endif extern Snapshot GetTransactionSnapshot(void); extern Snapshot GetLatestSnapshot(void); -- 2.37.0
^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: pgsql: Avoid unsatisfied-external-reference errors in static inlines.
@ 2022-07-14 15:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-07-14 15:19 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: pgsql-committers@lists.postgresql.org

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> It seems that -fkeep-inline-functions is more demanding than what wrasse 
> is running on.  I need the attached patch to get it to build cleanly.

Interesting.  I'm not entirely clear on which external references
cause wrasse to spit up.

> I think this would be good to apply so that this method of checking 
> inline functions is available in the future.

+1

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2022-07-14 15:19 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 17:37 pgsql: Avoid unsatisfied-external-reference errors in static inlines. Tom Lane <tgl@sss.pgh.pa.us>
2022-07-13 18:12 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-07-13 18:24   ` Tom Lane <tgl@sss.pgh.pa.us>
2022-07-14 10:05     ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-07-14 14:48       ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-07-14 15:19         ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox