27 lines · plain
1# RUN: llvm-mc -triple=x86_64-unknown-linux-gnu -filetype=obj -o %t %s2# RUN: llvm-jitlink -phony-externals -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 .file "ELF_external_to_absolute_conversion.s"17 .globl main18 .p2align 4, 0x9019 .type main,@function20main:21.L0$pb:22 leaq .L0$pb(%rip), %rax23 movabsq $_GLOBAL_OFFSET_TABLE_-.L0$pb, %rcx24 movabsq $_foo@GOTOFF, %rax25 xorq %rax, %rax26 retq27