41 lines · plain
1# RUN: llvm-mc -triple=i386-unknown-linux-gnu -filetype=obj -o %t %s2# RUN: llvm-jitlink -noexec %t3#4# Check that symbol scope is demoted to local when external symbols are5# converted to absolutes. This is demotion is necessary to avoid "unexpected6# definition" errors.7#8# The reference to _GLOBAL_OFFSET_TABLE_ will trigger creation of an external9# _GLOBAL_OFFSET_TABLE_ symbol, and the GOTOFF relocation will force creation10# of a GOT symbol without actually introducing any GOT entries. Together these11# should cause the external _GLOBAL_OFFSET_TABLE_ symbol to be converted to an12# absolute symbol with address zero. If the scope is not demoted correctly this13# will trigger an "unexpected definition" error.14 15 .text16 .globl main 17 .p2align 4, 0x9018 .type main,@function19main: 20 pushl %ebp21 movl %esp, %ebp22 pushl %eax23 calll .L0$pb24.L0$pb:25 popl %eax26.Ltmp0:27 addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax28 movl $0, -4(%ebp)29 movl a@GOTOFF(%eax), %eax30 addl $4, %esp31 popl %ebp32 retl33 .size main, .-main34 35 36 .type a,@object # @a37 .data38 .p2align 239a:40 .long 42 # 0x2a41 .size a, 4