[llvm-objcopy] Add support for special section indexes in symbol table greater than SHN_LORESERVE

As is indexes above SHN_LORESERVE will not be handled correctly because
they'll be treated as indexes of sections rather than special values
that should just be copied. This change adds support to copy them
though.

Patch by Jake Ehrlich

Differential Revision: https://reviews.llvm.org/D37393

llvm-svn: 312756
diff --git a/llvm/test/tools/llvm-objcopy/section-index-unsupported.test b/llvm/test/tools/llvm-objcopy/section-index-unsupported.test
new file mode 100644
index 0000000..f2d32b6
--- /dev/null
+++ b/llvm/test/tools/llvm-objcopy/section-index-unsupported.test
@@ -0,0 +1,15 @@
+# RUN: yaml2obj %s > %t
+# RUN: not llvm-objcopy %t %t2 2>&1 >/dev/null | FileCheck %s
+
+!ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_EXEC
+  Machine:         EM_X86_64
+Symbols:
+  Global:
+    - Name:     test
+      Index:    0xff05
+
+# CHECK: [[_:.*]] Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65285