From patchwork Mon Aug 15 19:23:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keno Fischer X-Patchwork-Id: 14591 Received: (qmail 68854 invoked by alias); 15 Aug 2016 19:24:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 68832 invoked by uid 89); 15 Aug 2016 19:24:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=fulfill, ebp X-HELO: mail-ua0-f181.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FBgu2ZgjxBWLo161X4HU3mVPZ4CKsu9eczRhRj8hgwQ=; b=IaV2rP41aFPBL02fgxV9wt937xOx5GRiAeKKbnTQS/HsYb7uuPeBiiIk4Z9uRrRAh6 KzuXCazUWGe41F0YR0YE/FVqElUUB1+CEjnp3FGizf2Sf//BXiuyrV6FwcNJnj31Umgc YrpYOFuwpYKEInynfiZlpVR8WDO/rESRHrKQZ67Sq2HMU/OO1ach54mezQg16WJYan9w Qk2oFCwTQKvVVOJOCKhVrS/nBtM4b9X1G4qwx41G/kASz24plkJ8XggHiwq8+aIyFEqm WEKFQAXXKKPBpOYLKOUdUzw+tWljuezKenXvEaKWkLVqZ+OZVJ9MtoBQU93ODrpMgO2w jEyw== X-Gm-Message-State: AEkooutjl4Hw/qWHE8CZyiJmB0fAFsc1cLBVyFV/klGBpFjLncYt2nC6sUUqJ0tt/2ImGQKgHq3i+mLpYC7YLjOB X-Received: by 10.31.192.202 with SMTP id q193mr5600443vkf.44.1471289067512; Mon, 15 Aug 2016 12:24:27 -0700 (PDT) MIME-Version: 1.0 From: Keno Fischer Date: Mon, 15 Aug 2016 15:23:47 -0400 Message-ID: Subject: [PATCH] Add CFI to i386 _start functions To: libc-alpha@sourceware.org As a follow up to my patch patch for RTLD_START on x86_64, this adds cfi instructions to the _start functions in both the dynamic loader and the application startup files. --- sysdeps/i386/dl-machine.h | 14 ++++++++++---- sysdeps/i386/start.S | 10 ++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 4e3968a..b8fd5f3 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -149,11 +149,16 @@ extern ElfW(Addr) _dl_profile_fixup (struct link_map *l, .align 16\n\ .globl _start\n\ .globl _dl_start_user\n\ -_start:\n\ +_start:\n"\ +CFI_STARTPROC "\n"\ +CFI_UNDEFINED(%eip) "\n\ # Note that _dl_start gets the parameter in %eax.\n\ movl %esp, %eax\n\ - call _dl_start\n\ -_dl_start_user:\n\ + call _dl_start\n"\ +CFI_ENDPROC "\n\ +_dl_start_user:\n"\ +CFI_STARTPROC "\n"\ +CFI_UNDEFINED(%eip) "\n\ # Save the user entry point address in %edi.\n\ movl %eax, %edi\n\ # Point %ebx at the GOT.\n\ @@ -195,7 +200,8 @@ _dl_start_user:\n\ # Restore %esp _start expects.\n\ movl (%esp), %esp\n\ # Jump to the user's entry point.\n\ - jmp *%edi\n\ + jmp *%edi\n"\ +CFI_ENDPROC "\n\ .previous\n\ "); diff --git a/sysdeps/i386/start.S b/sysdeps/i386/start.S index 964e6d9..3ad1749 100644 --- a/sysdeps/i386/start.S +++ b/sysdeps/i386/start.S @@ -52,10 +52,11 @@ NULL */ - .text - .globl _start - .type _start,@function -_start: +#include + +ENTRY (_start) + /* Also use CFI to indicate outermost frame. */ + cfi_undefined (eip) /* Clear the frame pointer. The ABI suggests this be done, to mark the outermost frame obviously. */ xorl %ebp, %ebp @@ -121,6 +122,7 @@ _start: 1: movl (%esp), %ebx ret #endif +END (_start) /* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so meaningless since we don't support machines < 80386. */