Re: typedefs.list glitches - Mailing list pgsql-hackers

From Tom Lane
Subject Re: typedefs.list glitches
Date
Msg-id 534625.1652390503@sss.pgh.pa.us
Whole thread Raw
In response to typedefs.list glitches  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: typedefs.list glitches
List pgsql-hackers
I wrote:
> every buildfarm member that's contributing to the typedefs list
> builds with OpenSSL.  That wouldn't surprise me, except that
> my own animal sifaka should be filling that gap.  Looking at
> its latest attempt[1], it seems to be generating an empty list,
> which I guess means that our recipe for extracting typedefs
> doesn't work on macOS/arm64.  I shall investigate.

Found it.  Current macOS produces

$ objdump -W
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: error: unknown argument
'-W'

where last year's vintage produced

$ objdump -W
objdump: Unknown command line argument '-W'.  Try:
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump--help' 
objdump: Did you mean '-C'?

This confuses run_build.pl into taking the "Linux and sometimes windows"
code path instead of the $using_osx one.  I think simplest fix is to
move the $using_osx branch ahead of the heuristic ones, as attached.

            regards, tom lane

--- run_build.pl.orig    2022-01-29 10:18:03.000000000 -0500
+++ run_build.pl    2022-05-12 16:59:58.000000000 -0400
@@ -2163,7 +2163,32 @@ sub find_typedefs
         next if $bin =~ m!bin/(ipcclean|pltcl_)!;
         next unless -f $bin;
         next if -l $bin;    # ignore symlinks to plain files (e.g. postmaster)
-        if (@err == 1)      # Linux and sometimes windows
+        if ($using_osx)
+        {
+            # no run_log due to redirections.
+            @dumpout =
+              `dwarfdump $bin 2>/dev/null | egrep -A2 TAG_typedef 2>/dev/null`;
+            foreach (@dumpout)
+            {
+                ## no critic (RegularExpressions::ProhibitCaptureWithoutTest)
+                @flds = split;
+                if (@flds == 3)
+                {
+                    # old format
+                    next unless ($flds[0] eq "AT_name(");
+                    next unless ($flds[1] =~ m/^"(.*)"$/);
+                    $syms{$1} = 1;
+                }
+                elsif (@flds == 2)
+                {
+                    # new format
+                    next unless ($flds[0] eq "DW_AT_name");
+                    next unless ($flds[1] =~ m/^\("(.*)"\)$/);
+                    $syms{$1} = 1;
+                }
+            }
+        }
+        elsif (@err == 1)      # Linux and sometimes windows
         {
             my $cmd = "$objdump -Wi $bin 2>/dev/null | "
               . "egrep -A3 DW_TAG_typedef 2>/dev/null";
@@ -2194,31 +2219,6 @@ sub find_typedefs
                 $syms{ $flds[-1] } = 1;
             }
         }
-        elsif ($using_osx)
-        {
-            # no run_log due to redirections.
-            @dumpout =
-              `dwarfdump $bin 2>/dev/null | egrep -A2 TAG_typedef 2>/dev/null`;
-            foreach (@dumpout)
-            {
-                ## no critic (RegularExpressions::ProhibitCaptureWithoutTest)
-                @flds = split;
-                if (@flds == 3)
-                {
-                    # old format
-                    next unless ($flds[0] eq "AT_name(");
-                    next unless ($flds[1] =~ m/^"(.*)"$/);
-                    $syms{$1} = 1;
-                }
-                elsif (@flds == 2)
-                {
-                    # new format
-                    next unless ($flds[0] eq "DW_AT_name");
-                    next unless ($flds[1] =~ m/^\("(.*)"\)$/);
-                    $syms{$1} = 1;
-                }
-            }
-        }
         else
         {
             # no run_log due to redirections.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: typedefs.list glitches
Next
From: Simon Riggs
Date:
Subject: Re: Comments on Custom RMGRs