From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 5CDF21F463 for ; Wed, 11 Sep 2019 21:05:31 +0000 (UTC) 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=AXZ65wvZ mS70mT5szaYVrst5OuHKBOLJh5yQqaTFFpw05iq+UlhIaF0cpdL+lYv9sqmiWw7F 4CvVpT6GxGMsn3EYd7bi6CYXjzN+yCdooCQRXrhSswibeBBeNOjAgyx6dynlv8XU WB68G68Mp4mB8xAHO1zHkaYaIzHo3Mb+vmo= 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=XJ4GeIzNE4WSt+33mtHseTXtHW5jGlGmG50tnOx/l3Eqeo HlV7yWCo3KrymUlrbhBHFQveWOY2DsUOE8rE/z/Xg73PjMhi+hBDOmVKPHoVGQxO iUppo0epIfLEbNC+QcOBphwqdg23egsBrwS5/AKaMTEOR49s2ZGPeZ8Ac8Llw= 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 Received: (qmail 94119 invoked by uid 89); 11 Sep 2019 21:05:11 -0000 Authentication-Results: sourceware.org; auth=none 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 */ -- 2.17.1