From patchwork Wed Sep 11 21:04:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 1161278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105148-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="mZTJNL1A"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Jfaergqf"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46TDvM0z6jz9s00 for ; Thu, 12 Sep 2019 07:05:34 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; q=dns; s=default; b=YB0d3dwz tjUWn5cLp54bky2XuppeHe+E9iWv8b+/z/dINFX4sn+o6QN2RKftAWbSUyf+iB4Q 4Eb79XmozlGCIUecs9QTjxck3k/H1niOCSagYKLl/pvOBqAdxb9cO7SLs6kMlnOF 2DLmutftbVAuMl0z+fbfn7HlsfK/Oo2RiKA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; s=default; bh=I35Gj01NV7xsz6 lDXegCVVftbbg=; b=mZTJNL1ANVxG9H1fWZdEj2yKF8uHg7mUOPrMbqGQYVmNbr 4arVXJELXflXJLRyRvnobi0Ia0PQ5GGacvGUURppGX2jbneq3VdaUBSnJqD84y+2 Tq6t06suApctSjl9qroXnqcOM9t6akEEtS4JO4hYhT/CfJ/Z/PyZqEmZmfsxc= Received: (qmail 94237 invoked by alias); 11 Sep 2019 21:05:11 -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 94119 invoked by uid 89); 11 Sep 2019 21:05:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:sk:mail-pl, HX-HELO:sk:mail-pl, HX-Spam-Relays-External:sk:mail-pl, H*RU:sk:mail-pl X-HELO: mail-pl1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=k4TFcnRqPdSlwuldclXmI+oHlYIch6ZC9vc9ZPToIfE=; b=JfaergqfxAC0fC3XFscEa577Et3aL4DkYAdduqO4XxXsL4nB0wiUPjxhzUWVcDszSC mxJtztn8gwrP+8Ganp23XZ9FF5N8Gs/OXt36VjKmXqXJJpMGmBh4imsr+pX9y2rLbkUN zJDp0YW1FXRtCt8jA9vhV2aeNcjPfE6ZIuVQ6tg2b+ueJ6Y5BWwRKViPekofO2+TNygR UaZ3zILq5MYffDup25giHQLuHVk2etCT1sjbxp7ret2M8yP7IPk6+/ez/A6A1jUE4H8D zVTI61KYXGMaw75Z9unLLrZj2wVVOHtXDDlCx8fUolCBCuiprVwvlEJDvJb+3boeOANv YAUA== From: Isaku Yamahata To: libc-alpha@sourceware.org Cc: isaku.yamahata@intel.com, Isaku Yamahata Subject: [RFC PATCH 02/11] elf: add macro to define note section for LibOS Date: Wed, 11 Sep 2019 14:04:00 -0700 Message-Id: <3a8a966bae935849c4d4f2116c181c0156fb40ca.1568219399.git.isaku.yamahata@gmail.com> In-Reply-To: References: In-Reply-To: References: This patch defines macro to define note section for LibOS. Later patches will use those macros. Signed-off-by: Isaku Yamahata --- elf/libos.h | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 elf/libos.h diff --git a/elf/libos.h b/elf/libos.h new file mode 100644 index 0000000000..0610c212ff --- /dev/null +++ b/elf/libos.h @@ -0,0 +1,84 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _LIBOS_H +#define _LIBOS_H 1 + +#include + +#define STRINGIFY(name) STRINGIFY_1(name) +#define STRINGIFY_1(name) #name + +#define NT_LIBOS 0x4f62694c /* "LibO" in little endian */ +#define ELF_NOTE_LIBOS "LibOS" +#define LIBOS_NOTE_VERSION 1 +#define LIBOS_NOTE_FUNCTION 2 +#define LIBOS_NOTE_VARIABLE 3 + +struct libos_note_desc { + ElfW(Word) name_sz; + ElfW(Word) type; + ElfW(Addr) ptr; + ElfW(Word) sz; + /* name */ +}; + +#if __SIZEOF_PTRDIFF_T__ == 8 +#define LIBOS_NOTES(n_name, type, ptr, sz, name) \ + __asm__ ( \ + " .pushsection .note.libos." n_name ",\"a\",@note\n" \ + " .balign 8\n" \ + " .long 1f - 0f\n" /* name length */ \ + " .long 5f - 2f\n" /* desc size */ \ + " .long " STRINGIFY(NT_LIBOS) "\n" /* note type*/ \ + "0: .asciz \"libos\"\n" \ + "1:\n" \ + " .balign 8\n" \ + "2:\n" \ + " .long 4f - 3f\n" \ + " .long " STRINGIFY(type) "\n" \ + " .quad " STRINGIFY(ptr) "\n" \ + " .quad " STRINGIFY(sz) "\n" \ + "3: .asciz \"" name "\"\n" \ + "4:\n" \ + " .balign 8\n" \ + "5:\n" \ + " .popsection\n") +#elif __SIZEOF_PTRDIFF_T__ == 4 +#define LIBOS_NOTES(n_name, type, ptr, sz, name) \ + __asm__ ( \ + " .pushsection .note.libos." n_name ",\"a\",@note\n" \ + " .balign 4\n" \ + " .long 1f - 0f\n" /* name length */ \ + " .long 5f - 2f\n" /* desc size */ \ + " .long " STRINGIFY(NT_LIBOS) "\n" /* note type*/ \ + "0: .asciz \"libos\"\n" \ + "1:\n" \ + " .balign 4\n" \ + "2:\n" \ + " .long 4f - 3f\n" \ + " .long " STRINGIFY(type) "\n" \ + " .long " STRINGIFY(ptr) "\n" \ + " .long " STRINGIFY(sz) "\n" \ + "3: .asciz \"" name "\"\n" \ + "4:\n" \ + " .balign 4\n" \ + "5:\n" \ + " .popsection\n") +#endif + +#endif /* libos.h */