2017-04-08 14:14:14 +08:00
# REQUIRES : x8 6
# # i3 8 6 - g o t 3 2 x - b a s e l e s s . e l f i s a f i l e p r o d u c e d u s i n g G N U a s v . 2 . 2 7
# # using f o l l o w i n g c o d e a n d c o m m a n d l i n e :
# # ( as - - 3 2 - o b a s e . o b a s e . s )
# #
# # .text
# # .globl foo
# # .type foo, @function
# # foo :
# # nop
# #
# # _start :
# # movl f o o @GOT, %eax
# # movl f o o @GOT, %ebx
# # movl f o o @GOT(%eax), %eax
# # movl f o o @GOT(%ebx), %eax
# #
# # Result f i l e c o n t a i n s f o u r R _ 3 8 6 _ G O T 3 2 X r e l o c a t i o n s . G e n e r a t e d c o d e
# # is a l s o a f o u r m o v i n s t r u c t i o n s . A n d f i r s t t w o h a s n o b a s e r e g i s t e r :
# # < _ start> :
# # 1 : 8 b 0 5 0 0 0 0 0 0 0 0 m o v 0 x0 ,% e a x
# # 7 : 8 b 1 d 0 0 0 0 0 0 0 0 m o v 0 x0 ,% e b x
# # d : 8 b 8 0 0 0 0 0 0 0 0 0 m o v 0 x0 ( % e a x ) ,% e a x
# # 13 : 8 b 8 3 0 0 0 0 0 0 0 0 m o v 0 x0 ( % e b x ) ,% e a x
# #
# # R_ 3 8 6 _ G O T 3 2 X i s c o m p u t e d a s G + A - G O T , b u t i f i t u s e d w i t h o u t b a s e
# # register, i t s h o u l d b e c a l c u l a t e d a s G + A . U s i n g w i t h o u t b a s e r e g i s t e r
# # is o n l y a l l o w e d f o r n o n - P I C c o d e .
# #
# RUN : ld. l l d % S / I n p u t s / i 3 8 6 - g o t 3 2 x - b a s e l e s s . e l f - o % t 1
# RUN : llvm- o b j d u m p - s e c t i o n - h e a d e r s - d % t 1 | F i l e C h e c k % s
# # 7 3 7 2 8 = = 0 x1 2 0 0 0 = = A D D R ( . g o t )
# CHECK : _start :
Align AArch64 and i386 image base to superpage
Summary:
As for x86_64, the default image base for AArch64 and i386 should be
aligned to a superpage appropriate for the architecture.
On AArch64, this is 2 MiB, on i386 it is 4 MiB.
Reviewers: emaste, grimar, javed.absar, espindola, ruiu, peter.smith, srhines, rprichard
Reviewed By: ruiu, peter.smith
Subscribers: jfb, markj, arichardson, krytarowski, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D50297
llvm-svn: 342746
2018-09-22 00:58:13 +08:00
# CHECK- N E X T : 4 0 1 0 0 1 : 8 b 0 5 { { . * } } m o v l 4 2 0 6 5 9 2 , % e a x
# CHECK- N E X T : 4 0 1 0 0 7 : 8 b 1 d { { . * } } m o v l 4 2 0 6 5 9 2 , % e b x
# CHECK- N E X T : 4 0 1 0 0 d : 8 b 8 0 { { . * } } m o v l - 4 ( % e a x ) , % e a x
# CHECK- N E X T : 4 0 1 0 1 3 : 8 b 8 3 { { . * } } m o v l - 4 ( % e b x ) , % e a x
2017-04-08 14:14:14 +08:00
# CHECK : Sections :
# CHECK : Name S i z e A d d r e s s
Align AArch64 and i386 image base to superpage
Summary:
As for x86_64, the default image base for AArch64 and i386 should be
aligned to a superpage appropriate for the architecture.
On AArch64, this is 2 MiB, on i386 it is 4 MiB.
Reviewers: emaste, grimar, javed.absar, espindola, ruiu, peter.smith, srhines, rprichard
Reviewed By: ruiu, peter.smith
Subscribers: jfb, markj, arichardson, krytarowski, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D50297
llvm-svn: 342746
2018-09-22 00:58:13 +08:00
# CHECK : .got 00000004 0 0 0 0 0 0 0 0 0 0 4 0 3 0 0 0
2017-04-08 14:14:14 +08:00
# RUN : not l d . l l d % S / I n p u t s / i 3 8 6 - g o t 3 2 x - b a s e l e s s . e l f - o % t 1 - p i e 2 > & 1 | \
# RUN : FileCheck % s - - c h e c k - p r e f i x =ERR
2018-03-15 06:05:12 +08:00
# ERR : error : can' t c r e a t e d y n a m i c r e l o c a t i o n R _ 3 8 6 _ G O T 3 2 X a g a i n s t s y m b o l : f o o i n r e a d o n l y s e g m e n t ; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
# ERR : error : can' t c r e a t e d y n a m i c r e l o c a t i o n R _ 3 8 6 _ G O T 3 2 X a g a i n s t s y m b o l : f o o i n r e a d o n l y s e g m e n t ; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output