From e8327f1600567ef370213bf770a02a9233ecac2f Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Mon, 29 Jul 2019 18:23:23 -0700 Subject: [PATCH] [LibOS, Pal] add .file directive to .S file to make debug easier gas includes dwarf info about compilation unit into .o compiled from .S. Hoever, without .file directive, gnu linker drops dwarf compilation unit info about .S. from .so (libpal.so libsysdb.so). As result gdb fails to open .S when debugging .S file. Add .file directive to .S files to make debug .S easier. My ld version is > $ ld --version > GNU ld (GNU Binutils for Ubuntu) 2.30 Signed-off-by: Isaku Yamahata --- LibOS/shim/src/start.S | 1 + LibOS/shim/src/syscallas.S | 1 + LibOS/shim/src/vdso/vdso-data.S | 1 + LibOS/shim/src/vdso/vdso-note.S | 1 + Pal/src/host/Linux-SGX/enclave_entry.S | 2 ++ Pal/src/host/Linux-SGX/sgx_entry.S | 2 ++ Pal/src/host/Linux/clone-x86_64.S | 2 ++ Pal/src/host/Linux/gettimeofday-x86_64.S | 2 ++ Pal/src/user_start.S | 1 + 9 files changed, 13 insertions(+) diff --git a/LibOS/shim/src/start.S b/LibOS/shim/src/start.S index c2a68ed6..a65544e9 100644 --- a/LibOS/shim/src/start.S +++ b/LibOS/shim/src/start.S @@ -16,6 +16,7 @@ ... NULL */ + .file "start.S" .text .globl shim_start .type shim_start,@function diff --git a/LibOS/shim/src/syscallas.S b/LibOS/shim/src/syscallas.S index 09415c5d..af028303 100644 --- a/LibOS/shim/src/syscallas.S +++ b/LibOS/shim/src/syscallas.S @@ -24,6 +24,7 @@ #include "asm-offsets.h" + .file "syscallas.S" .global syscalldb .type syscalldb, @function .extern shim_table, debug_unsupp diff --git a/LibOS/shim/src/vdso/vdso-data.S b/LibOS/shim/src/vdso/vdso-data.S index 54c23730..bbcd27e9 100644 --- a/LibOS/shim/src/vdso/vdso-data.S +++ b/LibOS/shim/src/vdso/vdso-data.S @@ -1,3 +1,4 @@ + .file "vdso-data.S" .section .rodata .global vdso_so diff --git a/LibOS/shim/src/vdso/vdso-note.S b/LibOS/shim/src/vdso/vdso-note.S index 545bc476..291ded1c 100644 --- a/LibOS/shim/src/vdso/vdso-note.S +++ b/LibOS/shim/src/vdso/vdso-note.S @@ -1,3 +1,4 @@ + .file "vdso-note.S" /* This .note section informs dynamic linker about vDSO */ .section .note.Linux, "a", @note diff --git a/Pal/src/host/Linux-SGX/enclave_entry.S b/Pal/src/host/Linux-SGX/enclave_entry.S index fecc1014..4ab4a5ba 100644 --- a/Pal/src/host/Linux-SGX/enclave_entry.S +++ b/Pal/src/host/Linux-SGX/enclave_entry.S @@ -1,6 +1,8 @@ #include "sgx_arch.h" #include "asm-offsets.h" + .file "enclave_entry.S" + # In some cases, like bogus parameters passed to enclave_entry, it's tricky to # return cleanly (passing the correct return address to EEXIT, OCALL_EXIT can # be interrupted, etc.). Since those cases should only ever happen with a diff --git a/Pal/src/host/Linux-SGX/sgx_entry.S b/Pal/src/host/Linux-SGX/sgx_entry.S index ff6667b9..b32f3d06 100644 --- a/Pal/src/host/Linux-SGX/sgx_entry.S +++ b/Pal/src/host/Linux-SGX/sgx_entry.S @@ -3,6 +3,8 @@ #include "asm-offsets.h" + .file "sgx_entry.S" + .extern tcs_base .global sgx_ecall diff --git a/Pal/src/host/Linux/clone-x86_64.S b/Pal/src/host/Linux/clone-x86_64.S index 2c2564e7..56731552 100644 --- a/Pal/src/host/Linux/clone-x86_64.S +++ b/Pal/src/host/Linux/clone-x86_64.S @@ -30,6 +30,8 @@ #include "sysdep-x86_64.h" + .file "clone-x86_64.S" + #define CLONE_VM 0x00000100 #define CLONE_THREAD 0x00010000 diff --git a/Pal/src/host/Linux/gettimeofday-x86_64.S b/Pal/src/host/Linux/gettimeofday-x86_64.S index 9c10416e..ef2d1cd3 100644 --- a/Pal/src/host/Linux/gettimeofday-x86_64.S +++ b/Pal/src/host/Linux/gettimeofday-x86_64.S @@ -26,6 +26,8 @@ #include "sysdep-x86_64.h" + .file "gettimeofday-x86_64.S" + /* For the calculation see asm/vsyscall.h. */ #define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 diff --git a/Pal/src/user_start.S b/Pal/src/user_start.S index 8866da2e..2f9d1ed8 100644 --- a/Pal/src/user_start.S +++ b/Pal/src/user_start.S @@ -17,6 +17,7 @@ NULL */ + .file "user_start.S" .text .globl _start .type _start,@function