From patchwork Fri Jun 22 17:55:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 139726 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1164235lji; Fri, 22 Jun 2018 10:55:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIPM2aWxzJLIiKDp4p68zR5iXLe7X8MBRxqTmdZwkkerC4OSqVZl5DgmdKqNAHmYDiAWc9X X-Received: by 2002:a63:2404:: with SMTP id k4-v6mr2281056pgk.191.1529690150384; Fri, 22 Jun 2018 10:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529690150; cv=none; d=google.com; s=arc-20160816; b=qx9aWY++21WVkbmsovS7KuObhtfjdpcSo6QB3OcxKb6AnKNAMnERMtYrZqKR9BX12C PrvnbTNQ/lnBqyIWEOV8037ymLawoCGtqGTSPjcFJD5TtFhk1DXQlObbBEBByxYzQ4m2 zNC7VqBFVaGqzX93afJbLyAoDP8MHETYTwMiUMRAK25fKFl3uIcaddtpe5rrtHnB04c8 uJPH1JtuhRmM9/1yk7jO7rT+xoXdQy6H3UOR6QbvLoRtJGoN8H/pc/p0p3M7LGc5cl5z NvA4YkUllFC5yL8GSFM1sNJg/RmLN3o/YN8x4hwHv3pbzfX5TgdEPBSHqsfzGn7tUDLu qd4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Jru/QPRAA04UBVBC9Vt207d17Lw2nKasmcVM0W3wgb4=; b=h+Jk04VSW1qX72TANGdxG1tvwOipP1UlYGOgy9gTl7kId795Jy240n0yimXSk9oZ+w y594IkX7QaVyCuvCkLRIJGC391HtGHjF/9n6MYkTyNbQ2LxOjADwiOLN5zhF54tqdqFt QpzKlaSXlCcTvsLbCabbLYRxQvTxmaXfbKQJdkQwz7M62yGskrMubbqpnUrMAQz4v5XQ Q57pZFa+Zr5H5BPvNmMR7oOpSk7ECoCj0/fN8k/ueoSSMH55/1/7WJJf6W6gbriIVzSZ tM7f6eljHBXC3uc3jnd+x9G9KCDad5HEUbK1sJHM89Nw0IK6DkgQGnQf2VjVMN8XDSUL XjHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=FNeduMOK; spf=pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-devel-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id z13-v6si8198164pfm.330.2018.06.22.10.55.50; Fri, 22 Jun 2018 10:55:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=FNeduMOK; spf=pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-devel-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id DACCB75549; Fri, 22 Jun 2018 17:55:46 +0000 (UTC) X-Original-To: openembedded-devel@lists.openembedded.org Delivered-To: openembedded-devel@lists.openembedded.org Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by mail.openembedded.org (Postfix) with ESMTP id DB1E17477C for ; Fri, 22 Jun 2018 17:55:19 +0000 (UTC) Received: by mail-pl0-f66.google.com with SMTP id s24-v6so3837518plq.6 for ; Fri, 22 Jun 2018 10:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fVoqnR2xOKUd9fMm5JXK0Tw88nGHL+lJRt+SIsWmof8=; b=FNeduMOKv/ufQPZ9ttQxdRSgZBqI9wi8ig9rLo8flfG5uz6Lvsh9VhxiXqlMFq8qCi 0h0wJeWQeqpaR/swXHspQ70ZJbscPvuZcoDuOIfZLXcWgL9pPl2i35VKXXjIZynHLYd6 fRCpN6/WoIUM/sgRikOd756RIX36hi52zPocrcqXoqrkxyFclWgHdumsT5DGZ+wvsr4j R6L4ItZ2hxxBzH+baIAgXP9E/NjQn6BLuG17rdLRpDGU7mfFIy3ajm3a4mzSWp+wSKUS ji8E4OJ+JTV/mgpo3Ltc2lCjJm7hJ0LidLm5Ci8YQf94lx25SFbQuZ8BG0vfRcuG7qEW ImlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fVoqnR2xOKUd9fMm5JXK0Tw88nGHL+lJRt+SIsWmof8=; b=rGe9Ucql4UwHUOFIci9MVoQNTrGpCXab1yqow49lMxWKW9fhfsUhKfjlvXUsRDJefQ K8blapxHgKtaTDIw0TAcbERLrfXsNPX5VWZN6XIp7zZ3Irv614znpFItQZ2Dx3Ka+5Vf Q6kxR9nv7or0orlphSWn158vVYLJup7cBB9l6Nvj11xEbZHWco4K46tmkbY4y2dPA/v9 AK0QKlh6jzq5KY3EHSMOlD/a5NcU7S5noW8tIFPiMZLPNx/2TlIJnbUie/rXJqFEf+sr XuYxcovwAftCigiyMowsKvOr/o6mu6ywz5PK05cpt6WZ5Hkpem2APMlV71H7NyhSYp+K ixJw== X-Gm-Message-State: APt69E0PGn9A3O78ShO8Q+tCQ1sTQL94KBdpWAEis1i0+GvsEbca+1z+ XL7riG6pb6FeO9gRCFkRJlEPqA== X-Received: by 2002:a17:902:7688:: with SMTP id m8-v6mr2683931pll.54.1529690120375; Fri, 22 Jun 2018 10:55:20 -0700 (PDT) Received: from localhost.localdomain ([2601:646:877f:9499::91a0]) by smtp.gmail.com with ESMTPSA id n83-v6sm23758992pfi.147.2018.06.22.10.55.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jun 2018 10:55:19 -0700 (PDT) From: Khem Raj To: openembedded-devel@lists.openembedded.org Date: Fri, 22 Jun 2018 10:55:18 -0700 Message-Id: <20180622175521.21628-2-raj.khem@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180622175521.21628-1-raj.khem@gmail.com> References: <20180622175521.21628-1-raj.khem@gmail.com> Subject: [oe] [meta-oe][PATCH 2/5] libhugetlbfs: Fix build on musl X-BeenThere: openembedded-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Using the OpenEmbedded metadata to build Distributions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-devel-bounces@lists.openembedded.org Errors-To: openembedded-devel-bounces@lists.openembedded.org needs more runtime testing Signed-off-by: Khem Raj --- .../0001-include-stddef.h-for-ptrdiff_t.patch | 25 ++++++++++ .../0002-Mark-glibc-specific-code-so.patch | 39 +++++++++++++++ ...sconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch | 49 +++++++++++++++++++ ...shm.c-Mark-glibc-specific-changes-so.patch | 30 ++++++++++++ .../0005-Include-dirent.h-for-ino_t.patch | 28 +++++++++++ .../0006-include-limits.h-for-PATH_MAX.patch | 42 ++++++++++++++++ .../libhugetlbfs/libhugetlbfs_git.bb | 6 +++ 7 files changed, 219 insertions(+) create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0001-include-stddef.h-for-ptrdiff_t.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0002-Mark-glibc-specific-code-so.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0004-shm.c-Mark-glibc-specific-changes-so.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0005-Include-dirent.h-for-ino_t.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0006-include-limits.h-for-PATH_MAX.patch -- 2.18.0 -- _______________________________________________ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-include-stddef.h-for-ptrdiff_t.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-include-stddef.h-for-ptrdiff_t.patch new file mode 100644 index 0000000000..bae90b4edc --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0001-include-stddef.h-for-ptrdiff_t.patch @@ -0,0 +1,25 @@ +From d3c2187716a0a1f9359a869ca383c129603554d9 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 21 Jun 2018 19:25:57 -0700 +Subject: [PATCH 1/6] include stddef.h for ptrdiff_t + +Signed-off-by: Khem Raj +--- + morecore.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/morecore.c b/morecore.c +index 62ad252..c5981d2 100644 +--- a/morecore.c ++++ b/morecore.c +@@ -19,6 +19,7 @@ + + #define _GNU_SOURCE + ++#include + #include + #include + #include +-- +2.17.1 + diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0002-Mark-glibc-specific-code-so.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0002-Mark-glibc-specific-code-so.patch new file mode 100644 index 0000000000..4354d78615 --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0002-Mark-glibc-specific-code-so.patch @@ -0,0 +1,39 @@ +From b72bf6a81fa879f32a074fe53776fc8291c83b6f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 21 Jun 2018 19:32:59 -0700 +Subject: [PATCH 2/6] Mark glibc specific code so + +Signed-off-by: Khem Raj +--- + morecore.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/morecore.c b/morecore.c +index c5981d2..ec9fafa 100644 +--- a/morecore.c ++++ b/morecore.c +@@ -347,6 +347,7 @@ void hugetlbfs_setup_morecore(void) + + INFO("setup_morecore(): heapaddr = 0x%lx\n", heapaddr); + ++#ifdef __GLIBC__ + heaptop = heapbase = (void *)heapaddr; + if (__hugetlb_opts.thp_morecore) + __morecore = &thp_morecore; +@@ -354,7 +355,6 @@ void hugetlbfs_setup_morecore(void) + __morecore = &hugetlbfs_morecore; + + /* Set some allocator options more appropriate for hugepages */ +- + if (__hugetlb_opts.shrink_ok) + mallopt(M_TRIM_THRESHOLD, hpage_size / 2); + else +@@ -364,4 +364,5 @@ void hugetlbfs_setup_morecore(void) + * This doesn't appear to prohibit malloc() from falling back + * to mmap() if we run out of hugepages. */ + mallopt(M_MMAP_MAX, 0); ++#endif + } +-- +2.17.1 + diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch new file mode 100644 index 0000000000..f6d8a10a9a --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch @@ -0,0 +1,49 @@ +From 3d6ab5ea8e23f96ee6fdd915e05acd9a751dd876 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 21 Jun 2018 19:44:26 -0700 +Subject: [PATCH 3/6] alloc.c: Avoid sysconf(_SC_LEVEL2_CACHE_LINESIZE) on + linux + +musl does not have it + +Signed-off-by: Khem Raj +--- + alloc.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/alloc.c b/alloc.c +index bce9464..cf7eb40 100644 +--- a/alloc.c ++++ b/alloc.c +@@ -245,6 +245,19 @@ void free_huge_pages(void *ptr) + __free_huge_pages(ptr, 1); + } + ++static size_t get_cacheline_size() { ++#if defined(__linux__) ++ FILE * fp = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r"); ++ unsigned int line_size = 0; ++ if (fp) { ++ fscanf(fp, "%d", &line_size); ++ fclose(fp); ++ } ++ return line_size; ++#else ++ return sysconf(_SC_LEVEL2_CACHE_LINESIZE); ++#endif ++} + /* + * Offset the buffer using bytes wasted due to alignment to avoid using the + * same cache lines for the start of every buffer returned by +@@ -261,7 +274,7 @@ void *cachecolor(void *buf, size_t len, size_t color_bytes) + + /* Lookup our cacheline size once */ + if (cacheline_size == 0) { +- cacheline_size = sysconf(_SC_LEVEL2_CACHE_LINESIZE); ++ cacheline_size = get_cacheline_size(); + linemod = time(NULL); + } + +-- +2.17.1 + diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0004-shm.c-Mark-glibc-specific-changes-so.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0004-shm.c-Mark-glibc-specific-changes-so.patch new file mode 100644 index 0000000000..960e152939 --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0004-shm.c-Mark-glibc-specific-changes-so.patch @@ -0,0 +1,30 @@ +From 7002dec46dae375e8aa1aa8577a5b274c02fc697 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 21 Jun 2018 19:48:04 -0700 +Subject: [PATCH 4/6] shm.c: Mark glibc specific changes so + +Signed-off-by: Khem Raj +--- + shm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/shm.c b/shm.c +index 1f82cab..9447b63 100644 +--- a/shm.c ++++ b/shm.c +@@ -48,10 +48,11 @@ + * system shmget() may be performed without worry as there is no dynamic + * call chain. + */ ++#ifdef __GLIBC__ + extern void *dlsym (void *__restrict __handle, __const char *__restrict __name) + __attribute__((weak)) __THROW __nonnull ((2)); + extern char *dlerror (void) __attribute__((weak)) __THROW; +- ++#endif + + /* call syscall shmget through the generic syscall mechanism */ + static int syscall_shmget(key_t key, size_t size, int shmflg) +-- +2.17.1 + diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0005-Include-dirent.h-for-ino_t.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0005-Include-dirent.h-for-ino_t.patch new file mode 100644 index 0000000000..543302b135 --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0005-Include-dirent.h-for-ino_t.patch @@ -0,0 +1,28 @@ +From 87ed1706f426ed27fc4eeca7c3b09a4086c9a2a9 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 21 Jun 2018 19:51:02 -0700 +Subject: [PATCH 5/6] Include dirent.h for ino_t + +Fixes +error: unknown type name 'ino_t'; did you mean 'int'? + +Signed-off-by: Khem Raj +--- + tests/hugetests.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/hugetests.h b/tests/hugetests.h +index 8b1d8d9..056042c 100644 +--- a/tests/hugetests.h ++++ b/tests/hugetests.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + + #include "libhugetlbfs_privutils.h" + #include "libhugetlbfs_testprobes.h" +-- +2.17.1 + diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/files/0006-include-limits.h-for-PATH_MAX.patch b/meta-oe/recipes-benchmark/libhugetlbfs/files/0006-include-limits.h-for-PATH_MAX.patch new file mode 100644 index 0000000000..35dd6e11cc --- /dev/null +++ b/meta-oe/recipes-benchmark/libhugetlbfs/files/0006-include-limits.h-for-PATH_MAX.patch @@ -0,0 +1,42 @@ +From 96c012ea31a2d124528f3b6f3b9857b71b059db3 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 21 Jun 2018 19:58:53 -0700 +Subject: [PATCH 6/6] include limits.h for PATH_MAX + +Fixes + +error: 'PATH_MAX' undeclared + +Signed-off-by: Khem Raj +--- + hugeadm.c | 1 + + tests/gethugepagesizes.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/hugeadm.c b/hugeadm.c +index fe4211d..8db274c 100644 +--- a/hugeadm.c ++++ b/hugeadm.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + #include +diff --git a/tests/gethugepagesizes.c b/tests/gethugepagesizes.c +index 9551b38..2645e3f 100644 +--- a/tests/gethugepagesizes.c ++++ b/tests/gethugepagesizes.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + #include "hugetests.h" + +-- +2.17.1 + diff --git a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb index ee1b9d0507..14c909e758 100644 --- a/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb +++ b/meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb @@ -19,6 +19,12 @@ SRC_URI = " \ file://0001-run_test.py-not-use-hard-coded-path-.-obj-hugeadm.patch \ file://libhugetlbfs-elf_i386-avoid-search-host-library-path.patch \ file://Force-text-segment-alignment-to-0x08000000-for-i386-.patch \ + file://0001-include-stddef.h-for-ptrdiff_t.patch \ + file://0002-Mark-glibc-specific-code-so.patch \ + file://0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch \ + file://0004-shm.c-Mark-glibc-specific-changes-so.patch \ + file://0005-Include-dirent.h-for-ino_t.patch \ + file://0006-include-limits.h-for-PATH_MAX.patch \ " UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+(\.\d+)+)"