New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 42377 - static linkage ignored with alias attribute
Summary: static linkage ignored with alias attribute
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-24 14:33 PDT by David Lamparter
Modified: 2019-08-22 14:06 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Lamparter 2019-06-24 14:33:45 PDT
Hi,


when compiling this 2-liner:
$ cat > test.c

static int x;
static int y __attribute__((alias("x")));

$ clang-8 -c -o test.o test.c
$ objdump -t test.o

test.o:     file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l    df *ABS*	0000000000000000 test.c
0000000000000000 l     O .bss	0000000000000004 x
0000000000000000 g     O .bss	0000000000000004 y


The "y" symbol ends up global (g) instead of the expected static (l).

ELF visibility attributes don't seem to work either.

Behaviour is the same on
* clang version 8.0.0 (tags/RELEASE_800/final)
* clang version 7.0.1-8 (tags/RELEASE_701/final)

Cheers,

David
Comment 1 Richard Smith 2019-06-24 14:40:58 PDT
Still reproduces with trunk, and also for function aliases.
Comment 2 Nick Desaulniers 2019-08-07 14:32:00 PDT
arm32 Linux kernel builds on the -next tree started failing due to this:
https://github.com/ClangBuiltLinux/linux/issues/631
Comment 3 Nick Desaulniers 2019-08-20 12:54:41 PDT
https://reviews.llvm.org/D66492
Comment 4 Nick Desaulniers 2019-08-22 14:06:07 PDT
https://reviews.llvm.org/rL369705