<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang-9 fails to drop static symbols with an alias"
   href="https://bugs.llvm.org/show_bug.cgi?id=43243">43243</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-9 fails to drop static symbols with an alias
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>arnd@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>A linux kernel randconfig build resulted in a link error from duplicated
symbols that were declared static:

drivers/pinctrl/aspeed/pinctrl-aspeed-g6.o:(.data+0x10): multiple definition of
`sig_exprs_0_GPIOA0'
drivers/pinctrl/aspeed/pinctrl-aspeed-g4.o:(.data+0x8): first defined here
drivers/pinctrl/aspeed/pinctrl-aspeed-g6.o:(.data+0x28): multiple definition of
`sig_exprs_1_GPIOA1'
drivers/pinctrl/aspeed/pinctrl-aspeed-g4.o:(.data+0x18): first defined here
drivers/pinctrl/aspeed/pinctrl-aspeed-g6.o:(.data+0x40): multiple definition of
`sig_exprs_2_GPIOA2'
drivers/pinctrl/aspeed/pinctrl-aspeed-g4.o:(.data+0x28): first defined here
...

I reduced this to a trivial test case:

<a href="https://godbolt.org/z/Azn8pH">https://godbolt.org/z/Azn8pH</a>

$ cat pinctrl-aspeed-g6.i
static const int sig_exprs_SCL11_I2C11[] = {};
static const int sig_exprs_0_SCL11
__attribute__((alias("sig_exprs_SCL11_I2C11")));

$ clang-9 -Wall -O2 -c pinctrl-aspeed-g6.i
$ objdump --syms pinctrl-aspeed-g6.o

pinctrl-aspeed-g6.o:     file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l    df *ABS*  0000000000000000 pinctrl-aspeed-g6.i
0000000000000000 g     O .rodata        0000000000000000 sig_exprs_0_SCL11

With clang-10, this problem is fixed:

$ clang-10 -Wall -O2 -c pinctrl-aspeed-g6.i 
$ objdump --syms pinctrl-aspeed-g6.o

pinctrl-aspeed-g6.o:     file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l    df *ABS*  0000000000000000 pinctrl-aspeed-g6.i</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>