From 5d774c0947e8971853dc14902c9b5f2d15ccc270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Thu, 9 May 2019 00:00:02 +0000 Subject: [PATCH] gas_data_sizes.S: make PIE for all ISAs --- README.adoc | 4 ++-- userland/arch/x86_64/common_arch.h | 2 ++ userland/arch/x86_64/gas_data_sizes.S | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index ddf6c3b..b43ccd7 100644 --- a/README.adoc +++ b/README.adoc @@ -11788,7 +11788,7 @@ Conclusion: [options="header"] |=== -|byte |word |long |quad |octa +|.byte |.word |.long |.quad |.octa |x86 |1 @@ -11813,7 +11813,7 @@ Conclusion: |=== -and also keep in mind that: +and also keep in mind that according to the manual: * `.int` is the same as `.long` * `.hword` is the same as `.short` which is usually the same as `.word` diff --git a/userland/arch/x86_64/common_arch.h b/userland/arch/x86_64/common_arch.h index 1ce486c..aa035ea 100644 --- a/userland/arch/x86_64/common_arch.h +++ b/userland/arch/x86_64/common_arch.h @@ -3,6 +3,8 @@ #ifndef COMMON_ARCH_H #define COMMON_ARCH_H +/* This and other macros may make C function calls, and therefore can destroy + * non-callee saved registers. */ #define ASSERT_EQ(general1, general2) \ mov general2, %rdi; \ push %rdi; \ diff --git a/userland/arch/x86_64/gas_data_sizes.S b/userland/arch/x86_64/gas_data_sizes.S index 2219ea9..dc13f49 100644 --- a/userland/arch/x86_64/gas_data_sizes.S +++ b/userland/arch/x86_64/gas_data_sizes.S @@ -4,8 +4,9 @@ ENTRY #define ASSERT_DIFF(label1, label2, result) \ - mov $label2, %rax; \ - sub $label1, %rax; \ + lea label2(%rip), %rax; \ + lea label1(%rip), %rbx; \ + sub %rbx, %rax; \ ASSERT_EQ(%rax, $result) ASSERT_DIFF(mybyte, myword, 1)