1# RUN: llvm-mc -triple=i386-unknown-linux-gnu -filetype=obj -o %t %s 2# RUN: llvm-jitlink -noexec %t 3# 4# Check that symbol scope is demoted to local when external symbols are 5# converted to absolutes. This is demotion is necessary to avoid "unexpected 6# definition" errors. 7# 8# The reference to _GLOBAL_OFFSET_TABLE_ will trigger creation of an external 9# _GLOBAL_OFFSET_TABLE_ symbol, and the GOTOFF relocation will force creation 10# of a GOT symbol without actually introducing any GOT entries. Together these 11# should cause the external _GLOBAL_OFFSET_TABLE_ symbol to be converted to an 12# absolute symbol with address zero. If the scope is not demoted correctly this 13# will trigger an "unexpected definition" error. 14 15 .text 16 .globl main 17 .p2align 4, 0x90 18 .type main,@function 19main: 20 pushl %ebp 21 movl %esp, %ebp 22 pushl %eax 23 calll .L0$pb 24.L0$pb: 25 popl %eax 26.Ltmp0: 27 addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax 28 movl $0, -4(%ebp) 29 movl a@GOTOFF(%eax), %eax 30 addl $4, %esp 31 popl %ebp 32 retl 33 .size main, .-main 34 35 36 .type a,@object # @a 37 .data 38 .p2align 2 39a: 40 .long 42 # 0x2a 41 .size a, 4