[llvm] [llvm-objcopy] Add llvm-objcopy option --set-visibility-sym (PR #80872)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 00:38:56 PST 2024


================
@@ -254,6 +254,21 @@ parseSetSectionFlagValue(StringRef FlagValue) {
   return SFU;
 }
 
+static Expected<uint8_t> parseVisibilityType(StringRef VisType) {
+  const uint8_t Invalid = 0xff;
+  uint8_t type = StringSwitch<uint8_t>(VisType)
+                     .Case("default", ELF::STV_DEFAULT)
+                     .Case("hidden", ELF::STV_HIDDEN)
+                     .Case("internal", ELF::STV_INTERNAL)
+                     .Case("protected", ELF::STV_PROTECTED)
+                     .Default(Invalid);
+  if (type == Invalid)
+    return createStringError(errc::invalid_argument,
----------------
jh7370 wrote:

You need a test case for this error.

https://github.com/llvm/llvm-project/pull/80872


More information about the llvm-commits mailing list