1# RUN: llvm-mc -triple=x86_64-unknown-linux-gnu -filetype=obj -o %t %s 2# RUN: llvm-jitlink -phony-externals -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 .file "ELF_external_to_absolute_conversion.s" 17 .globl main 18 .p2align 4, 0x90 19 .type main,@function 20main: 21.L0$pb: 22 leaq .L0$pb(%rip), %rax 23 movabsq $_GLOBAL_OFFSET_TABLE_-.L0$pb, %rcx 24 movabsq $_foo@GOTOFF, %rax 25 xorq %rax, %rax 26 retq 27