[llvm-bugs] [Bug 43243] New: clang-9 fails to drop static symbols with an alias

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 6 07:35:46 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43243

            Bug ID: 43243
           Summary: clang-9 fails to drop static symbols with an alias
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arnd at linaro.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

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:

https://godbolt.org/z/Azn8pH

$ 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190906/2b842bad/attachment.html>


More information about the llvm-bugs mailing list