Use hidden visibility for jpeg_nbits_table.

The non-upstream change to reuse one copy of jpeg_nbits_table rather
than inline it with the two assembler routines that use it causes issues
when generating a shared library with lld. Specifically:

  movzx edx, byte [GOTOFF(ebp, jpeg_nbits_table + ecx)]

causes invalid relocations for jpeg_nbits_table.

Normally if the target symbol is local, both movl $1, foo@GOTOFF(%ecx)
and leal foo@GOTOFF(%eax), %eax will produce a R_386_GOTOFF relocation
referencing a STT_SECTION local symbol. There is no issue for GNU ld or
LLD.

If the target symbol is global and preemptible LLD will report an error
(GNU ld permissively allows it).

The fix is to make jpeg_nbits_table hidden.

Bug: http://b/162610242
Bug: https://issuetracker.google.com/135180511
Change-Id: I4fe75ca0069a047db05ab18eb36e94bf535878f5
diff --git a/README.chromium b/README.chromium
index 1831dae..c0992dd 100644
--- a/README.chromium
+++ b/README.chromium
@@ -48,7 +48,11 @@
   in the header instead of static const and moving the definition to
   a new .c file fixes this so only one copy is referenced. Also added
   extern wrappers around usage in asm files. The jpeg_nbits_table.inc
-  file was also deleted.
+  file was also deleted. It was also necessary to give this table hidden
+  visibility to avoid invalid relocations (ignored by ld but rejected by
+  lld) arising from attempts to reference the table from assembler on
+  32-bit x86. This only affects shared libraries, but that's important
+  for downstream Android builds.
 * Arm NEON patches to improve performance and maintainability. These changes
   are tracked by the following Chromium issue: https://crbug.com/922430
   - Add memory alignment size check in jmemmgr.c
diff --git a/jpeg_nbits_table.c b/jpeg_nbits_table.c
index 70fd120..afcee74 100644
--- a/jpeg_nbits_table.c
+++ b/jpeg_nbits_table.c
@@ -1,5 +1,9 @@
 #include "jpeg_nbits_table.h"
 
+/* NOTE: Both GCC and Clang define __GNUC__ */
+#if defined __GNUC__
+__attribute__((visibility("hidden")))
+#endif
 const unsigned char jpeg_nbits_table[65536] = {
    0,  1,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  4,  4,  4,  4,
    5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,