All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ross Burton" <ross@burtonini.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH][pseudo 6/7] makewrappers: support architecture-overrides in wrapper modifiers
Date: Fri,  8 Jan 2021 14:06:39 +0000	[thread overview]
Message-ID: <20210108140640.1069133-6-ross.burton@arm.com> (raw)
In-Reply-To: <20210108140640.1069133-1-ross.burton@arm.com>

Pseudo allows wrappers to define special comments in the wrapper lists to
pass extra arguments such as version=GLIBC_2.3 to control which symbol
version to search for.  However, these arguments can be architecture-specific.

When parsing the arguments, check for flags that end in the architecture name
(as returned by platform.machine()) and use those values instead.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 makewrappers | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/makewrappers b/makewrappers
index e68f6a9..6681e11 100755
--- a/makewrappers
+++ b/makewrappers
@@ -11,6 +11,7 @@ import glob
 import sys
 import re
 import os.path
+import platform
 import string
 import subprocess
 from templatefile import TemplateFile
@@ -290,10 +291,18 @@ class Function:
 
         # handle special comments, such as flags=AT_SYMLINK_NOFOLLOW
         if self.comments:
-            modifiers = self.comments.split(', ')
-            for mod in modifiers:
-                key, value = mod.split('=')
-                value = value.rstrip()
+            # Build a dictionary of key=value, key=value pairs
+            modifiers = dict(mod.split("=") for mod in self.comments.split(','))
+            # Strip all leading/trailing whitespace
+            modifiers = {k.strip():v.strip() for k, v in modifiers.items()}
+
+            arch = "-" + platform.machine()
+            # Sorted so that versions-foo appear after versions, so overrides are easy
+            for key in sorted(modifiers):
+                value = modifiers[key]
+                # If the key is version-arm64 and we're on arm64 then rename this to version
+                if key.endswith(arch):
+                    key = key.replace(arch, "")
                 setattr(self, key, value)
     
     def maybe_inode64(self):
-- 
2.25.1


  parent reply	other threads:[~2021-01-08 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 14:06 [PATCH][pseudo 1/7] pseudo_util: don't overrun strings when looking for keys Ross Burton
2021-01-08 14:06 ` [PATCH][pseudo 2/7] Silence switch block warnings Ross Burton
2021-01-08 14:06 ` [PATCH][pseudo 3/7] Disable deprecated function warnings Ross Burton
2021-01-08 14:06 ` [PATCH][pseudo 4/7] Fix some memory leaks Ross Burton
2021-01-08 16:01   ` [OE-core] " Seebs
2021-01-08 14:06 ` [PATCH][pseudo 5/7] makewrappers: fix Python 2 hangover Ross Burton
2021-01-08 14:06 ` Ross Burton [this message]
2021-01-08 14:06 ` [PATCH][pseudo 7/7] ports/linux/xattr: add arm64 versions for xattr calls Ross Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210108140640.1069133-6-ross.burton@arm.com \
    --to=ross@burtonini.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.