From owner-svn-src-vendor@freebsd.org Wed Jun 14 16:23:16 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87668BEE602; Wed, 14 Jun 2017 16:23:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6434F6F62F; Wed, 14 Jun 2017 16:23:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EGNFdc067190; Wed, 14 Jun 2017 16:23:15 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EGNFI1067187; Wed, 14 Jun 2017 16:23:15 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201706141623.v5EGNFI1067187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 14 Jun 2017 16:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319945 - in vendor/illumos/dist/lib: libzfs/common libzfs_core/common X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 16:23:16 -0000 Author: avg Date: Wed Jun 14 16:23:15 2017 New Revision: 319945 URL: https://svnweb.freebsd.org/changeset/base/319945 Log: 8264 want support for promoting datasets in libzfs_core illumos/illumos-gate@a4b8c9aa65a0a735aba318024a424a90d7b06c37 https://github.com/illumos/illumos-gate/commit/a4b8c9aa65a0a735aba318024a424a90d7b06c37 https://www.illumos.org/issues/8264 Oddly there is a lzc_clone function, but no lzc_promote function. Reviewed by: Andriy Gapon Reviewed by: Matthew Ahrens Reviewed by: Dan McDonald Approved by: Dan McDonald Author: Andrew Stormont Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Jun 14 16:13:20 2017 (r319944) +++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Wed Jun 14 16:23:15 2017 (r319945) @@ -30,6 +30,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. * Copyright 2016 Igor Kozhukhov + * Copyright 2017 RackTop Systems. */ #include @@ -3630,8 +3631,7 @@ int zfs_promote(zfs_handle_t *zhp) { libzfs_handle_t *hdl = zhp->zfs_hdl; - zfs_cmd_t zc = { 0 }; - char parent[MAXPATHLEN]; + char snapname[ZFS_MAX_DATASET_NAME_LEN]; int ret; char errbuf[1024]; @@ -3644,31 +3644,25 @@ zfs_promote(zfs_handle_t *zhp) return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); } - (void) strlcpy(parent, zhp->zfs_dmustats.dds_origin, sizeof (parent)); - if (parent[0] == '\0') { + if (zhp->zfs_dmustats.dds_origin[0] == '\0') { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "not a cloned filesystem")); return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); } - (void) strlcpy(zc.zc_value, zhp->zfs_dmustats.dds_origin, - sizeof (zc.zc_value)); - (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); - ret = zfs_ioctl(hdl, ZFS_IOC_PROMOTE, &zc); + ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname)); if (ret != 0) { - int save_errno = errno; - - switch (save_errno) { + switch (ret) { case EEXIST: /* There is a conflicting snapshot name. */ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "conflicting snapshot '%s' from parent '%s'"), - zc.zc_string, parent); + snapname, zhp->zfs_dmustats.dds_origin); return (zfs_error(hdl, EZFS_EXISTS, errbuf)); default: - return (zfs_standard_error(hdl, save_errno, errbuf)); + return (zfs_standard_error(hdl, ret, errbuf)); } } return (ret); Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Wed Jun 14 16:13:20 2017 (r319944) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.c Wed Jun 14 16:23:15 2017 (r319945) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 RackTop Systems. */ /* @@ -203,6 +204,28 @@ lzc_clone(const char *fsname, const char *origin, return (error); } +int +lzc_promote(const char *fsname, char *snapnamebuf, int snapnamelen) +{ + /* + * The promote ioctl is still legacy, so we need to construct our + * own zfs_cmd_t rather than using lzc_ioctl(). + */ + zfs_cmd_t zc = { 0 }; + + ASSERT3S(g_refcount, >, 0); + VERIFY3S(g_fd, !=, -1); + + (void) strlcpy(zc.zc_name, fsname, sizeof (zc.zc_name)); + if (ioctl(g_fd, ZFS_IOC_PROMOTE, &zc) != 0) { + int error = errno; + if (error == EEXIST && snapnamebuf != NULL) + (void) strlcpy(snapnamebuf, zc.zc_string, snapnamelen); + return (error); + } + return (0); +} + /* * Creates snapshots. * @@ -330,7 +353,7 @@ lzc_exists(const char *dataset) { /* * The objset_stats ioctl is still legacy, so we need to construct our - * own zfs_cmd_t rather than using zfsc_ioctl(). + * own zfs_cmd_t rather than using lzc_ioctl(). */ zfs_cmd_t zc = { 0 }; Modified: vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Wed Jun 14 16:13:20 2017 (r319944) +++ vendor/illumos/dist/lib/libzfs_core/common/libzfs_core.h Wed Jun 14 16:23:15 2017 (r319945) @@ -22,6 +22,7 @@ /* * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 RackTop Systems. */ #ifndef _LIBZFS_CORE_H @@ -49,6 +50,7 @@ enum lzc_dataset_type { int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **); int lzc_create(const char *, enum lzc_dataset_type, nvlist_t *); int lzc_clone(const char *, const char *, nvlist_t *); +int lzc_promote(const char *, char *, int); int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **); int lzc_bookmark(nvlist_t *, nvlist_t **); int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **); From owner-svn-src-vendor@freebsd.org Wed Jun 14 16:27:56 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 367CCBEE758; Wed, 14 Jun 2017 16:27:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F29CB6F841; Wed, 14 Jun 2017 16:27:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EGRtfn067384; Wed, 14 Jun 2017 16:27:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EGRtmk067383; Wed, 14 Jun 2017 16:27:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201706141627.v5EGRtmk067383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 14 Jun 2017 16:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319946 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 16:27:56 -0000 Author: avg Date: Wed Jun 14 16:27:54 2017 New Revision: 319946 URL: https://svnweb.freebsd.org/changeset/base/319946 Log: 8264 want support for promoting datasets in libzfs_core illumos/illumos-gate@a4b8c9aa65a0a735aba318024a424a90d7b06c37 https://github.com/illumos/illumos-gate/commit/a4b8c9aa65a0a735aba318024a424a90d7b06c37 https://www.illumos.org/issues/8264 Oddly there is a lzc_clone function, but no lzc_promote function. Reviewed by: Andriy Gapon Reviewed by: Matthew Ahrens Reviewed by: Dan McDonald Approved by: Dan McDonald Author: Andrew Stormont Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Jun 14 16:23:15 2017 (r319945) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Wed Jun 14 16:27:54 2017 (r319946) @@ -31,6 +31,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome + * Copyright 2017 RackTop Systems. */ /* @@ -4702,7 +4703,6 @@ zfs_ioc_pool_reopen(zfs_cmd_t *zc) /* * inputs: * zc_name name of filesystem - * zc_value name of origin snapshot * * outputs: * zc_string name of conflicting snapshot, if there is one @@ -4710,16 +4710,49 @@ zfs_ioc_pool_reopen(zfs_cmd_t *zc) static int zfs_ioc_promote(zfs_cmd_t *zc) { + dsl_pool_t *dp; + dsl_dataset_t *ds, *ods; + char origin[ZFS_MAX_DATASET_NAME_LEN]; char *cp; + int error; + error = dsl_pool_hold(zc->zc_name, FTAG, &dp); + if (error != 0) + return (error); + + error = dsl_dataset_hold(dp, zc->zc_name, FTAG, &ds); + if (error != 0) { + dsl_pool_rele(dp, FTAG); + return (error); + } + + if (!dsl_dir_is_clone(ds->ds_dir)) { + dsl_dataset_rele(ds, FTAG); + dsl_pool_rele(dp, FTAG); + return (SET_ERROR(EINVAL)); + } + + error = dsl_dataset_hold_obj(dp, + dsl_dir_phys(ds->ds_dir)->dd_origin_obj, FTAG, &ods); + if (error != 0) { + dsl_dataset_rele(ds, FTAG); + dsl_pool_rele(dp, FTAG); + return (error); + } + + dsl_dataset_name(ods, origin); + dsl_dataset_rele(ods, FTAG); + dsl_dataset_rele(ds, FTAG); + dsl_pool_rele(dp, FTAG); + /* * We don't need to unmount *all* the origin fs's snapshots, but * it's easier. */ - cp = strchr(zc->zc_value, '@'); + cp = strchr(origin, '@'); if (cp) *cp = '\0'; - (void) dmu_objset_find(zc->zc_value, + (void) dmu_objset_find(origin, zfs_unmount_snap_cb, NULL, DS_FIND_SNAPSHOTS); return (dsl_dataset_promote(zc->zc_name, zc->zc_string)); } From owner-svn-src-vendor@freebsd.org Wed Jun 14 16:36:03 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BE67BEEB9F; Wed, 14 Jun 2017 16:36:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17DA96FFC2; Wed, 14 Jun 2017 16:36:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EGa2at071411; Wed, 14 Jun 2017 16:36:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EGa1EW071404; Wed, 14 Jun 2017 16:36:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201706141636.v5EGa1EW071404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 14 Jun 2017 16:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319948 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 16:36:03 -0000 Author: avg Date: Wed Jun 14 16:36:01 2017 New Revision: 319948 URL: https://svnweb.freebsd.org/changeset/base/319948 Log: 5428 provide fts(), reallocarray(), and strtonum() illumos/illumos-gate@4585130b259133a26efae68275dbe56b08366deb https://github.com/illumos/illumos-gate/commit/4585130b259133a26efae68275dbe56b08366deb https://www.illumos.org/issues/5428 Reviewed by: Robert Mustacchi Approved by: Joshua M. Clulow Author: Yuri Pankov Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_errlog.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_deadlist.c Wed Jun 14 16:36:01 2017 (r319948) @@ -85,7 +85,7 @@ dsl_deadlist_load_tree(dsl_deadlist_t *dl) zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) { dsl_deadlist_entry_t *dle = kmem_alloc(sizeof (*dle), KM_SLEEP); - dle->dle_mintxg = strtonum(za.za_name, NULL); + dle->dle_mintxg = zfs_strtonum(za.za_name, NULL); VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os, za.za_first_integer)); avl_add(&dl->dl_tree, dle); @@ -490,7 +490,7 @@ dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, d for (zap_cursor_init(&zc, dl->dl_os, obj); zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) { - uint64_t mintxg = strtonum(za.za_name, NULL); + uint64_t mintxg = zfs_strtonum(za.za_name, NULL); dsl_deadlist_insert_bpobj(dl, za.za_first_integer, mintxg, tx); VERIFY3U(0, ==, zap_remove_int(dl->dl_os, obj, mintxg, tx)); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_scan.c Wed Jun 14 16:36:01 2017 (r319948) @@ -1365,7 +1365,7 @@ dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx) dsl_dataset_t *ds; uint64_t dsobj; - dsobj = strtonum(za.za_name, NULL); + dsobj = zfs_strtonum(za.za_name, NULL); VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, dsobj, tx)); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_userhold.c Wed Jun 14 16:36:01 2017 (r319948) @@ -340,7 +340,7 @@ static int dsl_dataset_hold_obj_string(dsl_pool_t *dp, const char *dsobj, void *tag, dsl_dataset_t **dsp) { - return (dsl_dataset_hold_obj(dp, strtonum(dsobj, NULL), tag, dsp)); + return (dsl_dataset_hold_obj(dp, zfs_strtonum(dsobj, NULL), tag, dsp)); } static int Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_errlog.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_errlog.c Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_errlog.c Wed Jun 14 16:36:01 2017 (r319948) @@ -73,13 +73,13 @@ bookmark_to_name(zbookmark_phys_t *zb, char *buf, size static void name_to_bookmark(char *buf, zbookmark_phys_t *zb) { - zb->zb_objset = strtonum(buf, &buf); + zb->zb_objset = zfs_strtonum(buf, &buf); ASSERT(*buf == ':'); - zb->zb_object = strtonum(buf + 1, &buf); + zb->zb_object = zfs_strtonum(buf + 1, &buf); ASSERT(*buf == ':'); - zb->zb_level = (int)strtonum(buf + 1, &buf); + zb->zb_level = (int)zfs_strtonum(buf + 1, &buf); ASSERT(*buf == ':'); - zb->zb_blkid = strtonum(buf + 1, &buf); + zb->zb_blkid = zfs_strtonum(buf + 1, &buf); ASSERT(*buf == '\0'); } #endif Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa_misc.c Wed Jun 14 16:36:01 2017 (r319948) @@ -1481,7 +1481,7 @@ zfs_panic_recover(const char *fmt, ...) * lowercase hexadecimal numbers that don't overflow. */ uint64_t -strtonum(const char *str, char **nptr) +zfs_strtonum(const char *str, char **nptr) { uint64_t val = 0; char c; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa.h Wed Jun 14 16:36:01 2017 (r319948) @@ -829,7 +829,7 @@ extern int spa_maxblocksize(spa_t *spa); extern void zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp); extern int spa_mode(spa_t *spa); -extern uint64_t strtonum(const char *str, char **nptr); +extern uint64_t zfs_strtonum(const char *str, char **nptr); extern char *spa_his_ievent_table[]; Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c Wed Jun 14 16:31:36 2017 (r319947) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vfsops.c Wed Jun 14 16:36:01 2017 (r319948) @@ -632,7 +632,7 @@ fuidstr_to_sid(zfsvfs_t *zfsvfs, const char *fuidstr, uint64_t fuid; const char *domain; - fuid = strtonum(fuidstr, NULL); + fuid = zfs_strtonum(fuidstr, NULL); domain = zfs_fuid_find_by_idx(zfsvfs, FUID_INDEX(fuid)); if (domain) From owner-svn-src-vendor@freebsd.org Wed Jun 14 16:44:12 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39619BEF190; Wed, 14 Jun 2017 16:44:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D0D7083A; Wed, 14 Jun 2017 16:44:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EGiBng075700; Wed, 14 Jun 2017 16:44:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EGiBA4075699; Wed, 14 Jun 2017 16:44:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201706141644.v5EGiBA4075699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 14 Jun 2017 16:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319950 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 16:44:12 -0000 Author: avg Date: Wed Jun 14 16:44:10 2017 New Revision: 319950 URL: https://svnweb.freebsd.org/changeset/base/319950 Log: 5220 L2ARC does not support devices that do not provide 512B access illumos/illumos-gate@403a8da73c64ff9dfb6230ba045c765a242213fb https://github.com/illumos/illumos-gate/commit/403a8da73c64ff9dfb6230ba045c765a242213fb https://www.illumos.org/issues/5220 There are disk devices that have logical sector size larger than 512B, for example 4KB. That is, their physical sector size is larger than 512B and they do not provide emulation for 512B sector sizes. For such devices both a data offset and a data size must be properly aligned. L2ARC should arrange that because it uses physical I/O. zio_vdev_io_start() performs a necessary transformation if io_size is not aligned to vdev_ashift, but that is done only for logical I/O. Something similar should be done in L2ARC code. * a temporary write buffer should be allocated if the original buffer is not going to be compressed and its size is not aligned * size of a temporary compression buffer should be ashift aligned * for the reads, if a size of a target buffer is not sufficiently large and it is not aligned then a temporary read buffer should be allocated Reviewed by: George Wilson Reviewed by: Dan Kimmel Reviewed by: Saso Kiselkov Approved by: Dan McDonald Author: Andriy Gapon Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Wed Jun 14 16:42:38 2017 (r319949) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Wed Jun 14 16:44:10 2017 (r319950) @@ -1075,6 +1075,7 @@ typedef struct l2arc_read_callback { blkptr_t l2rcb_bp; /* original blkptr */ zbookmark_phys_t l2rcb_zb; /* original bookmark */ int l2rcb_flags; /* original flags */ + abd_t *l2rcb_abd; /* temporary buffer */ } l2arc_read_callback_t; typedef struct l2arc_write_callback { @@ -5048,6 +5049,8 @@ top: !HDR_L2_WRITING(hdr) && !HDR_L2_EVICTED(hdr) && !(l2arc_noprefetch && HDR_PREFETCH(hdr))) { l2arc_read_callback_t *cb; + abd_t *abd; + uint64_t asize; DTRACE_PROBE1(l2arc__hit, arc_buf_hdr_t *, hdr); ARCSTAT_BUMP(arcstat_l2_hits); @@ -5059,8 +5062,17 @@ top: cb->l2rcb_zb = *zb; cb->l2rcb_flags = zio_flags; + asize = vdev_psize_to_asize(vd, size); + if (asize != size) { + abd = abd_alloc_for_io(asize, + HDR_ISTYPE_METADATA(hdr)); + cb->l2rcb_abd = abd; + } else { + abd = hdr->b_l1hdr.b_pabd; + } + ASSERT(addr >= VDEV_LABEL_START_SIZE && - addr + lsize < vd->vdev_psize - + addr + asize <= vd->vdev_psize - VDEV_LABEL_END_SIZE); /* @@ -5072,7 +5084,7 @@ top: ASSERT3U(HDR_GET_COMPRESS(hdr), !=, ZIO_COMPRESS_EMPTY); rzio = zio_read_phys(pio, vd, addr, - size, hdr->b_l1hdr.b_pabd, + asize, abd, ZIO_CHECKSUM_OFF, l2arc_read_done, cb, priority, zio_flags | ZIO_FLAG_DONT_CACHE | @@ -6566,6 +6578,33 @@ l2arc_read_done(zio_t *zio) mutex_enter(hash_lock); ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); + /* + * If the data was read into a temporary buffer, + * move it and free the buffer. + */ + if (cb->l2rcb_abd != NULL) { + ASSERT3U(arc_hdr_size(hdr), <, zio->io_size); + if (zio->io_error == 0) { + abd_copy(hdr->b_l1hdr.b_pabd, cb->l2rcb_abd, + arc_hdr_size(hdr)); + } + + /* + * The following must be done regardless of whether + * there was an error: + * - free the temporary buffer + * - point zio to the real ARC buffer + * - set zio size accordingly + * These are required because zio is either re-used for + * an I/O of the block in the case of the error + * or the zio is passed to arc_read_done() and it + * needs real data. + */ + abd_free(cb->l2rcb_abd); + zio->io_size = zio->io_orig_size = arc_hdr_size(hdr); + zio->io_abd = zio->io_orig_abd = hdr->b_l1hdr.b_pabd; + } + ASSERT3P(zio->io_abd, !=, NULL); /* @@ -6903,23 +6942,34 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint * Normally the L2ARC can use the hdr's data, but if * we're sharing data between the hdr and one of its * bufs, L2ARC needs its own copy of the data so that - * the ZIO below can't race with the buf consumer. To - * ensure that this copy will be available for the + * the ZIO below can't race with the buf consumer. + * Another case where we need to create a copy of the + * data is when the buffer size is not device-aligned + * and we need to pad the block to make it such. + * That also keeps the clock hand suitably aligned. + * + * To ensure that the copy will be available for the * lifetime of the ZIO and be cleaned up afterwards, we * add it to the l2arc_free_on_write queue. */ + uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev, + size); abd_t *to_write; - if (!HDR_SHARED_DATA(hdr)) { + if (!HDR_SHARED_DATA(hdr) && size == asize) { to_write = hdr->b_l1hdr.b_pabd; } else { - to_write = abd_alloc_for_io(size, + to_write = abd_alloc_for_io(asize, HDR_ISTYPE_METADATA(hdr)); abd_copy(to_write, hdr->b_l1hdr.b_pabd, size); + if (asize != size) { + abd_zero_off(to_write, size, + asize - size); + } l2arc_free_abd_on_write(to_write, size, arc_buf_type(hdr)); } wzio = zio_write_phys(pio, dev->l2ad_vdev, - hdr->b_l2hdr.b_daddr, size, to_write, + hdr->b_l2hdr.b_daddr, asize, to_write, ZIO_CHECKSUM_OFF, NULL, hdr, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_CANFAIL, B_FALSE); @@ -6929,11 +6979,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint zio_t *, wzio); write_asize += size; - /* - * Keep the clock hand suitably device-aligned. - */ - uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev, - size); write_psize += asize; dev->l2ad_hand += asize; From owner-svn-src-vendor@freebsd.org Wed Jun 14 16:46:50 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA740BEF488; Wed, 14 Jun 2017 16:46:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 861D070C5D; Wed, 14 Jun 2017 16:46:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5EGkn4C075841; Wed, 14 Jun 2017 16:46:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5EGkntI075839; Wed, 14 Jun 2017 16:46:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201706141646.v5EGkntI075839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 14 Jun 2017 16:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319951 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2017 16:46:50 -0000 Author: avg Date: Wed Jun 14 16:46:49 2017 New Revision: 319951 URL: https://svnweb.freebsd.org/changeset/base/319951 Log: 8311 ZFS_READONLY is a little too strict illumos/illumos-gate@2889ec41c05e9ffe1890b529b3111354da325aeb https://github.com/illumos/illumos-gate/commit/2889ec41c05e9ffe1890b529b3111354da325aeb https://www.illumos.org/issues/8311 Description: There was a misunderstanding about the enforcement details of the "Read-only" flag introduced for SMB/CIFS compatibility, way back in 2007 in the Sun PSARC 2007/315 case. The original authors thought enforcement of the READONLY flag should work similarly as the IMMUTABLE flag. Unfortunately, that enforcement is incompatible with the expectations of Windows applications using this feature through the SMB service. Applications assume (and the MS File System Algorithms MS-FSA confirms they should) that an SMB client can: (a) Open an SMB handle on a file with read/write access, (b) Set the DOS attributes to include the READONLY flag, (c) continue to have write access via that handle. This access model is essentially the same as a Unix/POSIX application that creates a file (with read/write access), uses fchmod() to change the file mode to something not granting write access (i.e. 0444), and then continues to write that file using the open handle it got before the mode change. Currently, the SMB server works-around this problem in a way that will become difficult to maintain as we implement support for SMB3 persistent handles, so SMB depends on this fix. I've written a test program that can be used to demonstrate this problem, and added it to zfs-tests (tests/functional/acl/cifs/cifs_attr_004_pos). It currently fails, but will pass when this problem fixed. Steps to Reproduce: Run the test program on a ZFS file system. Expected Results: Pass Actual Results: Fail. Reviewed by: Sanjay Nadkarni Reviewed by: Yuri Pankov Reviewed by: Andrew Stormont Reviewed by: Matt Ahrens Reviewed by: John Kennedy Approved by: Prakash Surya Author: Gordon Ross Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed Jun 14 16:44:10 2017 (r319950) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_acl.c Wed Jun 14 16:46:49 2017 (r319951) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ #include @@ -2035,13 +2035,11 @@ zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mod } /* - * Only check for READONLY on non-directories. + * Intentionally allow ZFS_READONLY through here. + * See zfs_zaccess_common(). */ if ((v4_mode & WRITE_MASK_DATA) && - (((ZTOV(zp)->v_type != VDIR) && - (zp->z_pflags & (ZFS_READONLY | ZFS_IMMUTABLE))) || - (ZTOV(zp)->v_type == VDIR && - (zp->z_pflags & ZFS_IMMUTABLE)))) { + (zp->z_pflags & ZFS_IMMUTABLE)) { return (SET_ERROR(EPERM)); } @@ -2251,6 +2249,24 @@ zfs_zaccess_common(znode_t *zp, uint32_t v4_mode, uint if (skipaclchk) { *working_mode = 0; return (0); + } + + /* + * Note: ZFS_READONLY represents the "DOS R/O" attribute. + * When that flag is set, we should behave as if write access + * were not granted by anything in the ACL. In particular: + * We _must_ allow writes after opening the file r/w, then + * setting the DOS R/O attribute, and writing some more. + * (Similar to how you can write after fchmod(fd, 0444).) + * + * Therefore ZFS_READONLY is ignored in the dataset check + * above, and checked here as if part of the ACL check. + * Also note: DOS R/O is ignored for directories. + */ + if ((v4_mode & WRITE_MASK_DATA) && + (ZTOV(zp)->v_type != VDIR) && + (zp->z_pflags & ZFS_READONLY)) { + return (SET_ERROR(EPERM)); } return (zfs_zaccess_aces_check(zp, working_mode, B_FALSE, cr)); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Jun 14 16:44:10 2017 (r319950) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_vnops.c Wed Jun 14 16:46:49 2017 (r319951) @@ -707,9 +707,11 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t } /* - * If immutable or not appending then return EPERM + * If immutable or not appending then return EPERM. + * Intentionally allow ZFS_READONLY through here. + * See zfs_zaccess_common() */ - if ((zp->z_pflags & (ZFS_IMMUTABLE | ZFS_READONLY)) || + if ((zp->z_pflags & ZFS_IMMUTABLE) || ((zp->z_pflags & ZFS_APPENDONLY) && !(ioflag & FAPPEND) && (uio->uio_loffset < zp->z_size))) { ZFS_EXIT(zfsvfs); @@ -2791,10 +2793,9 @@ zfs_setattr(vnode_t *vp, vattr_t *vap, int flags, cred return (SET_ERROR(EPERM)); } - if ((mask & AT_SIZE) && (zp->z_pflags & ZFS_READONLY)) { - ZFS_EXIT(zfsvfs); - return (SET_ERROR(EPERM)); - } + /* + * Note: ZFS_READONLY is handled in zfs_zaccess_common. + */ /* * Verify timestamps doesn't overflow 32 bits. @@ -4698,8 +4699,12 @@ zfs_map(vnode_t *vp, offset_t off, struct as *as, cadd ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); + /* + * Note: ZFS_READONLY is handled in zfs_zaccess_common. + */ + if ((prot & PROT_WRITE) && (zp->z_pflags & - (ZFS_IMMUTABLE | ZFS_READONLY | ZFS_APPENDONLY))) { + (ZFS_IMMUTABLE | ZFS_APPENDONLY))) { ZFS_EXIT(zfsvfs); return (SET_ERROR(EPERM)); } From owner-svn-src-vendor@freebsd.org Fri Jun 16 06:12:10 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECEF0BF766D; Fri, 16 Jun 2017 06:12:10 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E4A371EE6; Fri, 16 Jun 2017 06:12:10 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5G6C9pD096714; Fri, 16 Jun 2017 06:12:09 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5G6C8Uq096006; Fri, 16 Jun 2017 06:12:08 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201706160612.v5G6C8Uq096006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Fri, 16 Jun 2017 06:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319997 - in vendor/Juniper/libxo/dist: doc libxo tests/core tests/core/saved xohtml X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 06:12:11 -0000 Author: phil Date: Fri Jun 16 06:12:07 2017 New Revision: 319997 URL: https://svnweb.freebsd.org/changeset/base/319997 Log: Import libxo 0.8.2 Modified: vendor/Juniper/libxo/dist/doc/libxo-manual.html vendor/Juniper/libxo/dist/libxo/libxo.c vendor/Juniper/libxo/dist/tests/core/saved/test_01.E.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.H.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.HIPx.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.HP.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.JP.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.T.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.X.out vendor/Juniper/libxo/dist/tests/core/saved/test_01.XP.out vendor/Juniper/libxo/dist/tests/core/saved/test_02.J.out vendor/Juniper/libxo/dist/tests/core/saved/test_02.JP.out vendor/Juniper/libxo/dist/tests/core/test_01.c vendor/Juniper/libxo/dist/xohtml/xohtml.css vendor/Juniper/libxo/dist/xohtml/xohtml.sh.in Modified: vendor/Juniper/libxo/dist/doc/libxo-manual.html ============================================================================== --- vendor/Juniper/libxo/dist/doc/libxo-manual.html Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/doc/libxo-manual.html Fri Jun 16 06:12:07 2017 (r319997) @@ -22011,7 +22011,7 @@ jQuery(function ($) { -June 8, 2017 +June 14, 2017

libxo: The Easy Way to Generate text, XML, JSON, and HTML output
libxo-manual

Modified: vendor/Juniper/libxo/dist/libxo/libxo.c ============================================================================== --- vendor/Juniper/libxo/dist/libxo/libxo.c Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/libxo/libxo.c Fri Jun 16 06:12:07 2017 (r319997) @@ -95,6 +95,14 @@ #include #endif /* HAVE_GETTEXT */ +/* Rather lame that we can't count on these... */ +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + /* * Three styles of specifying thread-local variables are supported. * configure.ac has the brains to run each possibility through the @@ -473,6 +481,7 @@ static void xo_buf_append_div (xo_handle_t *xop, const char *class, xo_xff_flags_t flags, const char *name, ssize_t nlen, const char *value, ssize_t vlen, + const char *fmt, ssize_t flen, const char *encoding, ssize_t elen); static void @@ -1761,7 +1770,8 @@ xo_message_hcv (xo_handle_t *xop, int code, const char rc += rc2; } - xo_buf_append_div(xop, "message", 0, NULL, 0, bp, rc, NULL, 0); + xo_buf_append_div(xop, "message", 0, NULL, 0, bp, rc, + NULL, 0, NULL, 0); } break; @@ -2703,6 +2713,8 @@ xo_format_string_direct (xo_handle_t *xop, xo_buffer_t if ((flags & XFF_UNESCAPE) && (*cp == '\\' || *cp == '%')) { cp += 1; len -= 1; + if (len == 0 || *cp == '\0') + break; } } @@ -3644,6 +3656,10 @@ xo_do_format_field (xo_handle_t *xop, xo_buffer_t *xbp return 0; } +/* + * Remove any numeric precision/width format from the format string by + * inserting the "%" after the [0-9]+, returning the substring. + */ static char * xo_fix_encoding (xo_handle_t *xop UNUSED, char *encoding) { @@ -3657,8 +3673,7 @@ xo_fix_encoding (xo_handle_t *xop UNUSED, char *encodi break; } - cp -= 1; - *cp = '%'; + *--cp = '%'; /* Back off and insert the '%' */ return cp; } @@ -3777,10 +3792,35 @@ xo_format_humanize (xo_handle_t *xop, xo_buffer_t *xbp } } +/* + * Convenience function that either append a fixed value (if one is + * given) or formats a field using a format string. If it's + * encode_only, then we can't skip formatting the field, since it may + * be pulling arguments off the stack. + */ +static inline void +xo_simple_field (xo_handle_t *xop, unsigned encode_only, + const char *value, ssize_t vlen, + const char *fmt, ssize_t flen, xo_xff_flags_t flags) +{ + if (encode_only) + flags |= XFF_NO_OUTPUT; + + if (vlen == 0) + xo_do_format_field(xop, NULL, fmt, flen, flags); + else if (!encode_only) + xo_data_append_content(xop, value, vlen, flags); +} + +/* + * Html mode: append a
to the output buffer contain a field + * along with all the supporting information indicated by the flags. + */ static void xo_buf_append_div (xo_handle_t *xop, const char *class, xo_xff_flags_t flags, const char *name, ssize_t nlen, const char *value, ssize_t vlen, + const char *fmt, ssize_t flen, const char *encoding, ssize_t elen) { static char div_start[] = "
xo_columns; save.xhs_anchor_columns = xop->xo_anchor_columns; - xo_do_format_field(xop, NULL, value, vlen, flags); + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); if (flags & XFF_HUMANIZE) { /* @@ -4023,14 +4063,14 @@ xo_format_text (xo_handle_t *xop, const char *str, ssi break; case XO_STYLE_HTML: - xo_buf_append_div(xop, "text", 0, NULL, 0, str, len, NULL, 0); + xo_buf_append_div(xop, "text", 0, NULL, 0, str, len, NULL, 0, NULL, 0); break; } } static void xo_format_title (xo_handle_t *xop, xo_field_info_t *xfip, - const char *str, ssize_t len) + const char *value, ssize_t vlen) { const char *fmt = xfip->xfi_format; ssize_t flen = xfip->xfi_flen; @@ -4054,8 +4094,7 @@ xo_format_title (xo_handle_t *xop, xo_field_info_t *xf * Even though we don't care about text, we need to do * enough parsing work to skip over the right bits of xo_vap. */ - if (len == 0) - xo_do_format_field(xop, NULL, fmt, flen, flags | XFF_NO_OUTPUT); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); return; } @@ -4074,17 +4113,17 @@ xo_format_title (xo_handle_t *xop, xo_field_info_t *xf } start = xbp->xb_curp - xbp->xb_bufp; /* Reset start */ - if (len) { + if (vlen) { char *newfmt = alloca(flen + 1); memcpy(newfmt, fmt, flen); newfmt[flen] = '\0'; /* If len is non-zero, the format string apply to the name */ - char *newstr = alloca(len + 1); - memcpy(newstr, str, len); - newstr[len] = '\0'; + char *newstr = alloca(vlen + 1); + memcpy(newstr, value, vlen); + newstr[vlen] = '\0'; - if (newstr[len - 1] == 's') { + if (newstr[vlen - 1] == 's') { char *bp; rc = snprintf(NULL, 0, newfmt, newstr); @@ -4166,8 +4205,9 @@ xo_arg (xo_handle_t *xop) static void xo_format_value (xo_handle_t *xop, const char *name, ssize_t nlen, - const char *format, ssize_t flen, - const char *encoding, ssize_t elen, xo_xff_flags_t flags) + const char *value, ssize_t vlen, + const char *fmt, ssize_t flen, + const char *encoding, ssize_t elen, xo_xff_flags_t flags) { int pretty = XOF_ISSET(xop, XOF_PRETTY); int quote; @@ -4253,7 +4293,7 @@ xo_format_value (xo_handle_t *xop, const char *name, s save.xhs_columns = xop->xo_columns; save.xhs_anchor_columns = xop->xo_anchor_columns; - xo_do_format_field(xop, NULL, format, flen, flags); + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); if (flags & XFF_HUMANIZE) xo_format_humanize(xop, xbp, &save, flags); @@ -4263,8 +4303,8 @@ xo_format_value (xo_handle_t *xop, const char *name, s if (flags & XFF_ENCODE_ONLY) flags |= XFF_NO_OUTPUT; - xo_buf_append_div(xop, "data", flags, name, nlen, - format, flen, encoding, elen); + xo_buf_append_div(xop, "data", flags, name, nlen, value, vlen, + fmt, flen, encoding, elen); break; case XO_STYLE_XML: @@ -4273,25 +4313,24 @@ xo_format_value (xo_handle_t *xop, const char *name, s * let the formatting code handle the va_arg popping. */ if (flags & XFF_DISPLAY_ONLY) { - flags |= XFF_NO_OUTPUT; - xo_do_format_field(xop, NULL, format, flen, flags); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); break; } if (encoding) { - format = encoding; + fmt = encoding; flen = elen; } else { char *enc = alloca(flen + 1); - memcpy(enc, format, flen); + memcpy(enc, fmt, flen); enc[flen] = '\0'; - format = xo_fix_encoding(xop, enc); - flen = strlen(format); + fmt = xo_fix_encoding(xop, enc); + flen = strlen(fmt); } if (nlen == 0) { static char missing[] = "missing-field-name"; - xo_failure(xop, "missing field name: %s", format); + xo_failure(xop, "missing field name: %s", fmt); name = missing; nlen = sizeof(missing) - 1; } @@ -4327,7 +4366,9 @@ xo_format_value (xo_handle_t *xop, const char *name, s } xo_data_append(xop, ">", 1); - xo_do_format_field(xop, NULL, format, flen, flags); + + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); + xo_data_append(xop, "", 1); @@ -4337,20 +4378,19 @@ xo_format_value (xo_handle_t *xop, const char *name, s case XO_STYLE_JSON: if (flags & XFF_DISPLAY_ONLY) { - flags |= XFF_NO_OUTPUT; - xo_do_format_field(xop, NULL, format, flen, flags); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); break; } if (encoding) { - format = encoding; + fmt = encoding; flen = elen; } else { char *enc = alloca(flen + 1); - memcpy(enc, format, flen); + memcpy(enc, fmt, flen); enc[flen] = '\0'; - format = xo_fix_encoding(xop, enc); - flen = strlen(format); + fmt = xo_fix_encoding(xop, enc); + flen = strlen(fmt); } int first = (xop->xo_stack[xop->xo_depth].xs_flags & XSF_NOT_FIRST) @@ -4362,18 +4402,20 @@ xo_format_value (xo_handle_t *xop, const char *name, s quote = 1; else if (flags & XFF_NOQUOTE) quote = 0; + else if (vlen != 0) + quote = 1; else if (flen == 0) { quote = 0; - format = "true"; /* JSON encodes empty tags as a boolean true */ + fmt = "true"; /* JSON encodes empty tags as a boolean true */ flen = 4; - } else if (strchr("diouDOUeEfFgG", format[flen - 1]) == NULL) + } else if (strchr("diouDOUeEfFgG", fmt[flen - 1]) == NULL) quote = 1; else quote = 0; if (nlen == 0) { static char missing[] = "missing-field-name"; - xo_failure(xop, "missing field name: %s", format); + xo_failure(xop, "missing field name: %s", fmt); name = missing; nlen = sizeof(missing) - 1; } @@ -4407,7 +4449,7 @@ xo_format_value (xo_handle_t *xop, const char *name, s if (quote) xo_data_append(xop, "\"", 1); - xo_do_format_field(xop, NULL, format, flen, flags); + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); if (quote) xo_data_append(xop, "\"", 1); @@ -4415,39 +4457,39 @@ xo_format_value (xo_handle_t *xop, const char *name, s case XO_STYLE_SDPARAMS: if (flags & XFF_DISPLAY_ONLY) { - flags |= XFF_NO_OUTPUT; - xo_do_format_field(xop, NULL, format, flen, flags); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); break; } if (encoding) { - format = encoding; + fmt = encoding; flen = elen; } else { char *enc = alloca(flen + 1); - memcpy(enc, format, flen); + memcpy(enc, fmt, flen); enc[flen] = '\0'; - format = xo_fix_encoding(xop, enc); - flen = strlen(format); + fmt = xo_fix_encoding(xop, enc); + flen = strlen(fmt); } if (nlen == 0) { static char missing[] = "missing-field-name"; - xo_failure(xop, "missing field name: %s", format); + xo_failure(xop, "missing field name: %s", fmt); name = missing; nlen = sizeof(missing) - 1; } xo_data_escape(xop, name, nlen); xo_data_append(xop, "=\"", 2); - xo_do_format_field(xop, NULL, format, flen, flags); + + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); + xo_data_append(xop, "\" ", 2); break; case XO_STYLE_ENCODER: if (flags & XFF_DISPLAY_ONLY) { - flags |= XFF_NO_OUTPUT; - xo_do_format_field(xop, NULL, format, flen, flags); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); break; } @@ -4457,27 +4499,27 @@ xo_format_value (xo_handle_t *xop, const char *name, s quote = 0; else if (flen == 0) { quote = 0; - format = "true"; /* JSON encodes empty tags as a boolean true */ + fmt = "true"; /* JSON encodes empty tags as a boolean true */ flen = 4; - } else if (strchr("diouxXDOUeEfFgGaAcCp", format[flen - 1]) == NULL) + } else if (strchr("diouxXDOUeEfFgGaAcCp", fmt[flen - 1]) == NULL) quote = 1; else quote = 0; if (encoding) { - format = encoding; + fmt = encoding; flen = elen; } else { char *enc = alloca(flen + 1); - memcpy(enc, format, flen); + memcpy(enc, fmt, flen); enc[flen] = '\0'; - format = xo_fix_encoding(xop, enc); - flen = strlen(format); + fmt = xo_fix_encoding(xop, enc); + flen = strlen(fmt); } if (nlen == 0) { static char missing[] = "missing-field-name"; - xo_failure(xop, "missing field name: %s", format); + xo_failure(xop, "missing field name: %s", fmt); name = missing; nlen = sizeof(missing) - 1; } @@ -4487,7 +4529,9 @@ xo_format_value (xo_handle_t *xop, const char *name, s xo_data_append(xop, "", 1); ssize_t value_offset = xo_buf_offset(&xop->xo_data); - xo_do_format_field(xop, NULL, format, flen, flags); + + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); + xo_data_append(xop, "", 1); xo_encoder_handle(xop, quote ? XO_OP_STRING : XO_OP_CONTENT, @@ -4536,37 +4580,27 @@ xo_set_gettext_domain (xo_handle_t *xop, xo_field_info static void xo_format_content (xo_handle_t *xop, const char *class_name, const char *tag_name, - const char *str, ssize_t len, const char *fmt, ssize_t flen, + const char *value, ssize_t vlen, + const char *fmt, ssize_t flen, xo_xff_flags_t flags) { switch (xo_style(xop)) { case XO_STYLE_TEXT: - if (len) - xo_data_append_content(xop, str, len, flags); - else - xo_do_format_field(xop, NULL, fmt, flen, flags); + xo_simple_field(xop, FALSE, value, vlen, fmt, flen, flags); break; case XO_STYLE_HTML: - if (len == 0) { - str = fmt; - len = flen; - } - - xo_buf_append_div(xop, class_name, flags, NULL, 0, str, len, NULL, 0); + xo_buf_append_div(xop, class_name, flags, NULL, 0, + value, vlen, fmt, flen, NULL, 0); break; case XO_STYLE_XML: case XO_STYLE_JSON: case XO_STYLE_SDPARAMS: if (tag_name) { - if (len == 0) { - str = fmt; - len = flen; - } - xo_open_container_h(xop, tag_name); - xo_format_value(xop, "message", 7, str, len, NULL, 0, flags); + xo_format_value(xop, "message", 7, value, vlen, + fmt, flen, NULL, 0, flags); xo_close_container_h(xop, tag_name); } else { @@ -4574,16 +4608,12 @@ xo_format_content (xo_handle_t *xop, const char *class * Even though we don't care about labels, we need to do * enough parsing work to skip over the right bits of xo_vap. */ - if (len == 0) - xo_do_format_field(xop, NULL, fmt, flen, - flags | XFF_NO_OUTPUT); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); } break; case XO_STYLE_ENCODER: - if (len == 0) - xo_do_format_field(xop, NULL, fmt, flen, - flags | XFF_NO_OUTPUT); + xo_simple_field(xop, TRUE, value, vlen, fmt, flen, flags); break; } } @@ -4898,7 +4928,7 @@ xo_colors_handle_html (xo_handle_t *xop, xo_colors_t * static void xo_format_colors (xo_handle_t *xop, xo_field_info_t *xfip, - const char *str, ssize_t len) + const char *value, ssize_t vlen) { const char *fmt = xfip->xfi_format; ssize_t flen = xfip->xfi_flen; @@ -4906,13 +4936,13 @@ xo_format_colors (xo_handle_t *xop, xo_field_info_t *x xo_buffer_t xb; /* If the string is static and we've in an encoding style, bail */ - if (len != 0 && xo_style_is_encoding(xop)) + if (vlen != 0 && xo_style_is_encoding(xop)) return; xo_buf_init(&xb); - if (len) - xo_buf_append(&xb, str, len); + if (vlen) + xo_buf_append(&xb, value, vlen); else if (flen) xo_do_format_field(xop, &xb, fmt, flen, 0); else @@ -4972,7 +5002,7 @@ xo_format_colors (xo_handle_t *xop, xo_field_info_t *x static void xo_format_units (xo_handle_t *xop, xo_field_info_t *xfip, - const char *str, ssize_t len) + const char *value, ssize_t vlen) { const char *fmt = xfip->xfi_format; ssize_t flen = xfip->xfi_flen; @@ -4982,7 +5012,7 @@ xo_format_units (xo_handle_t *xop, xo_field_info_t *xf static char units_start_html[] = " data-units=\""; if (!XOIF_ISSET(xop, XOIF_UNITS_PENDING)) { - xo_format_content(xop, "units", NULL, str, len, fmt, flen, flags); + xo_format_content(xop, "units", NULL, value, vlen, fmt, flen, flags); return; } @@ -4997,8 +5027,8 @@ xo_format_units (xo_handle_t *xop, xo_field_info_t *xf else return; - if (len) - xo_data_escape(xop, str, len); + if (vlen) + xo_data_escape(xop, value, vlen); else xo_do_format_field(xop, NULL, fmt, flen, flags); @@ -5026,7 +5056,7 @@ xo_format_units (xo_handle_t *xop, xo_field_info_t *xf static ssize_t xo_find_width (xo_handle_t *xop, xo_field_info_t *xfip, - const char *str, ssize_t len) + const char *value, ssize_t vlen) { const char *fmt = xfip->xfi_format; ssize_t flen = xfip->xfi_flen; @@ -5035,10 +5065,10 @@ xo_find_width (xo_handle_t *xop, xo_field_info_t *xfip char *bp; char *cp; - if (len) { - bp = alloca(len + 1); /* Make local NUL-terminated copy of str */ - memcpy(bp, str, len); - bp[len] = '\0'; + if (vlen) { + bp = alloca(vlen + 1); /* Make local NUL-terminated copy of value */ + memcpy(bp, value, vlen); + bp[vlen] = '\0'; width = strtol(bp, &cp, 0); if (width == LONG_MIN || width == LONG_MAX @@ -5075,7 +5105,7 @@ xo_anchor_clear (xo_handle_t *xop) */ static void xo_anchor_start (xo_handle_t *xop, xo_field_info_t *xfip, - const char *str, ssize_t len) + const char *value, ssize_t vlen) { if (xo_style(xop) != XO_STYLE_TEXT && xo_style(xop) != XO_STYLE_HTML) return; @@ -5092,12 +5122,12 @@ xo_anchor_start (xo_handle_t *xop, xo_field_info_t *xf * Now we find the width, if possible. If it's not there, * we'll get it on the end anchor. */ - xop->xo_anchor_min_width = xo_find_width(xop, xfip, str, len); + xop->xo_anchor_min_width = xo_find_width(xop, xfip, value, vlen); } static void xo_anchor_stop (xo_handle_t *xop, xo_field_info_t *xfip, - const char *str, ssize_t len) + const char *value, ssize_t vlen) { if (xo_style(xop) != XO_STYLE_TEXT && xo_style(xop) != XO_STYLE_HTML) return; @@ -5109,7 +5139,7 @@ xo_anchor_stop (xo_handle_t *xop, xo_field_info_t *xfi XOIF_CLEAR(xop, XOIF_UNITS_PENDING); - ssize_t width = xo_find_width(xop, xfip, str, len); + ssize_t width = xo_find_width(xop, xfip, value, vlen); if (width == 0) width = xop->xo_anchor_min_width; @@ -6213,12 +6243,12 @@ xo_do_emit_fields (xo_handle_t *xop, xo_field_info_t * if (flags & XFF_WS) { xo_format_content(xop, "padding", NULL, " ", 1, NULL, 0, flags); - flags &= ~XFF_WS; /* Block later handling of this */ + flags &= ~XFF_WS; /* Prevent later handling of this flag */ } } if (ftype == 'V') - xo_format_value(xop, content, clen, + xo_format_value(xop, content, clen, NULL, 0, xfip->xfi_format, xfip->xfi_flen, xfip->xfi_encoding, xfip->xfi_elen, flags); else if (ftype == '[') @@ -7899,7 +7929,8 @@ xo_error_hv (xo_handle_t *xop, const char *fmt, va_lis case XO_STYLE_HTML: va_copy(xop->xo_vap, vap); - xo_buf_append_div(xop, "error", 0, NULL, 0, fmt, strlen(fmt), NULL, 0); + xo_buf_append_div(xop, "error", 0, NULL, 0, NULL, 0, + fmt, strlen(fmt), NULL, 0); if (XOIF_ISSET(xop, XOIF_DIV_OPEN)) xo_line_close(xop); @@ -7915,7 +7946,8 @@ xo_error_hv (xo_handle_t *xop, const char *fmt, va_lis va_copy(xop->xo_vap, vap); xo_open_container_h(xop, "error"); - xo_format_value(xop, "message", 7, fmt, strlen(fmt), NULL, 0, 0); + xo_format_value(xop, "message", 7, NULL, 0, + fmt, strlen(fmt), NULL, 0, 0); xo_close_container_h(xop, "error"); va_end(xop->xo_vap); @@ -8132,7 +8164,7 @@ xo_emit_warn_hcv (xo_handle_t *xop, int as_warning, in xo_buffer_t *src = &temp.xo_data; xo_format_value(xop, "message", 7, src->xb_bufp, - src->xb_curp - src->xb_bufp, NULL, 0, 0); + src->xb_curp - src->xb_bufp, NULL, 0, NULL, 0, 0); xo_free(temp.xo_stack); xo_buf_cleanup(src); Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.E.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.E.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.E.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,5 +1,6 @@ op create: [] [] [0] op open_container: [top] [] [0x810] +op content: [used-percent] [12] [0] op content: [kve_start] [0xdeadbeef] [0x8] op content: [kve_end] [0xcabb1e] [0x8] op string: [host] [my-box] [0x200000] @@ -129,6 +130,9 @@ op string: [mode_octal] [octal] [0x8] op string: [links] [links] [0x1000] op string: [user] [user] [0x1000] op string: [group] [group] [0x1000] +op string: [pre] [that] [0x8] +op content: [links] [3] [0x1000] +op string: [post] [this] [0x1000] op string: [mode] [/some/file] [0x1000] op content: [mode_octal] [640] [0x8] op content: [links] [1] [0x1000] Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.H.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.H.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.H.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,2 +1,2 @@ -
testing argument modifier
my-box
.
example.com
...
testing argument modifier with encoding to
.
example.com
...
Label text
value
very
42
42 -
Connecting to
my-box
.
example.com
...
Item
Total Sold
In Stock
On Order
SKU
gum
1412
54
10
GRO-000-415
rope
85
4
2
HRD-000-212
ladder
0
2
1
HRD-000-517
bolt
4123
144
42
HRD-000-632
water
17
14
2
GRO-000-2331
Item
'
gum
':
Total sold
:
1412.0
In stock
:
54
On order
:
10
SKU
:
GRO-000-415
Item
'
rope
':
Total sold
:
85.0
In stock
:
4
On order
:
2
SKU
:
HRD-000-212
Item
'
ladder
':
Total sold
! :
0
In stock
:
2
On order
:
1
SKU
:
HRD-000-517
Item
'
bolt
':
Total sold
:
4123.0
In s tock
:
144
On order
:
42
SKU
:
HRD-000-632
Item
'
water
':
Total sold
:
17.0
In stock
:
14
On order
:
2
SKU
:
GRO-000-2331
Item
'
fish
':
Total sold
:
1321.0
In stock
:
45
On order
:
1
SKU
:
GRO-000-533
Item
:
gum
Item
:
rope
Item
:
ladder
Item
:
bolt
Item
:
water
X
X
X
X
X
X
X
X
X
X
Cost
:
425
X
X
Cost
:
455
links
user
group
/some/file
1
user
group
\ No newline at end of file +
df
12
%
testing argument modifier
my-box
.
example.com
...
testing argument modifier with encoding to
.
example.com
...
Label text
value
very
42
42 +
Connecting to
my-box
.
example.com
...
Item
Total Sold
In Stock
On Order
SKU
gum
1412
54
10
GRO-000-415
rope
85
4
2
HRD-000-212
ladder
0
2
1
HRD-000-517
bolt
4123
144
42
HRD-000-632
water
17
14
2
GRO-000-2331
Item
'
gum
':
Total sold
:
1412.0
In stock
:
54
On order
:
10
SKU
:
GRO-000-415
Item
'
rope
':
Total sold
:
85.0
In stock
:
4
On order
:
2
SKU
:
HRD-000-212
Item
'
ladder
':
Total sold
! :
0
In stock
:
2
On order
:
1
SKU
:
HRD-000-517
Item
'
bolt
':
Total sold
:
4123.0
In s tock
:
144
On order
:
42
SKU
:
HRD-000-632
Item
'
water
':
Total sold
:
17.0
In stock
:
14
On order
:
2
SKU
:
GRO-000-2331
Item
'
fish
':
Total sold
:
1321.0
In stock
:
45
On order
:
1
SKU
:
GRO-000-533
Item
:
gum
Item
:
rope
Item
:
ladder
Item
:
bolt
Item
:
water
X
X
X
X
X
X
X
X
X
X
Cost
:
425
X
X
Cost
:
455
links
user
group
3
this
/some/file
1
user
group
\ No newline at end of file Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.HIPx.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.HIPx.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.HIPx.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,4 +1,9 @@
+
df
+
12
+
%
+
+
testing argument modifier
my-box
.
@@ -331,6 +336,10 @@
group
+
+
+
3
+
this
/some/file
Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.HP.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.HP.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.HP.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,4 +1,9 @@
+
df
+
12
+
%
+
+
testing argument modifier
my-box
.
@@ -331,6 +336,10 @@
group
+
+
+
3
+
this
/some/file
Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.J.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.J.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.J.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,2 +1,2 @@ -{"top": {"kve_start":"0xdeadbeef","kve_end":"0xcabb1e","host":"my-box","domain":"example.com","host":"my-box","domain":"example.com","label":"value","max-chaos":"very","min-chaos":42,"some-chaos":"[42]","host":"my-box","domain":"example.com", "data": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17,"in-stock":14,"on-order":2}]}, "data2": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412.0,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85.0,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123.0,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"w ater","sold":17.0,"in-stock":14,"on-order":2}]}, "data3": {"item": [{"sku":"GRO-000-533","name":"fish","sold":1321.0,"in-stock":45,"on-order":1}]}, "data4": {"item": ["gum","rope","ladder","bolt","water"]},"cost":425,"cost":455,"mode":"mode","mode_octal":"octal","links":"links","user":"user","group":"group","mode":"/some/file","mode_octal":640,"links":1,"user":"user","group":"group"} +{"top": {"used-percent":12,"kve_start":"0xdeadbeef","kve_end":"0xcabb1e","host":"my-box","domain":"example.com","host":"my-box","domain":"example.com","label":"value","max-chaos":"very","min-chaos":42,"some-chaos":"[42]","host":"my-box","domain":"example.com", "data": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123,"in-stock":144,"on-order":42}, {"sku":"GRO-000-2331","name":"water","sold":17,"in-stock":14,"on-order":2}]}, "data2": {"item": [{"sku":"GRO-000-415","name":"gum","sold":1412.0,"in-stock":54,"on-order":10}, {"sku":"HRD-000-212","name":"rope","sold":85.0,"in-stock":4,"on-order":2}, {"sku":"HRD-000-517","name":"ladder","sold":0,"in-stock":2,"on-order":1}, {"sku":"HRD-000-632","name":"bolt","sold":4123.0,"in-stock":144,"on-order":42}, {"sku":"GRO-0 00-2331","name":"water","sold":17.0,"in-stock":14,"on-order":2}]}, "data3": {"item": [{"sku":"GRO-000-533","name":"fish","sold":1321.0,"in-stock":45,"on-order":1}]}, "data4": {"item": ["gum","rope","ladder","bolt","water"]},"cost":425,"cost":455,"mode":"mode","mode_octal":"octal","links":"links","user":"user","group":"group","pre":"that","links":3,"post":"this","mode":"/some/file","mode_octal":640,"links":1,"user":"user","group":"group"} } Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.JP.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.JP.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.JP.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,5 +1,6 @@ { "top": { + "used-percent": 12, "kve_start": "0xdeadbeef", "kve_end": "0xcabb1e", "host": "my-box", @@ -117,6 +118,9 @@ "links": "links", "user": "user", "group": "group", + "pre": "that", + "links": 3, + "post": "this", "mode": "/some/file", "mode_octal": 640, "links": 1, Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.T.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.T.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.T.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,3 +1,4 @@ +df 12% testing argument modifier my-box.example.com... testing argument modifier with encoding to .example.com... Label text value @@ -50,4 +51,5 @@ XXXXXXXX X XCost: 425 X XCost: 455 links user group +3 this /some/file 1 user group Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.X.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.X.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.X.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1 +1 @@ -0xdeadbeef0xcabb1emy-boxexample.commy-boxexample.comvery42[42]my-boxexample.comGRO-000-415gum14125410HRD-000-212rope8542HRD-000-517ladder021HRD-000-632bolt412314442GRO-000-2331water17142GRO-000-415gum1412.05410HRD-000-212rope85.042HRD-000-517ladder021HRD-000-632bolt4123.014442GRO-000-2331water17.0142GRO-000-533fish1321.0451gumrope ladderboltwater425455modeoctallinksusergroup/some/file6401usergroup \ No newline at end of file +120xdeadbeef0xcabb1emy-boxexample.commy-boxexample.comvery42[42]my-boxexample.comGRO-000-415gum14125410HRD-000-212rope8542HRD-000-517ladder021HRD-000-632bolt412314442GRO-000-2331water17142GRO-000-415gum1412.05410HRD-000-212rope85.042HRD-000-517ladder021HRD-000-632bolt4123.014442GRO-000-2331water17.0142GRO-000-533fish1321.0451gum< /item>ropeladderboltwater425455modeoctallinksusergroup
that
3this/some/file6401usergroup
\ No newline at end of file Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_01.XP.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_01.XP.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_01.XP.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,4 +1,5 @@ + 12 0xdeadbeef 0xcabb1e my-box @@ -108,6 +109,9 @@ links user group +
that
+ 3 + this /some/file 640 1 Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_02.J.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_02.J.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_02.J.out Fri Jun 16 06:12:07 2017 (r319997) @@ -1,2 +1,2 @@ -{"top": {"data": {"what":"braces","length":"abcdef","fd":-1,"error":"Bad file descriptor","test":"good","fd":-1,"error":"Bad fi","test":"good","lines":20,"words":30,"characters":40, "bytes": [0,1,2,3,4],"mbuf-current":10,"mbuf-cache":20,"mbuf-total":30,"distance":50,"location":"Boston","memory":64,"total":640,"memory":64,"total":640,"ten":10,"eleven":11,"unknown":1010,"unknown":1010,"min":15,"cur":20,"max":30,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"val1":21,"val2":58368,"val3":100663296,"val4":44470272,"val5":1342172800, "flag": ["one","two","three"],"works":null,"empty-tag":true,"t1":"1000","t2":"test5000","t3":"ten-longx","t4":"xtest", "__error": {"message":"this is an error"}, "__error": {"message":"two more errors"}, "__warning": {"message":this is an warning}, "__warning": {"message":"two more warnings"},"count":10,"test":4, "error": {"message":"Shut 'er down, Clancey! She's a-pumpin' mud! <>!,\"!<>\n"}}} +{"top": {"data": {"what":"braces","length":"abcdef","fd":-1,"error":"Bad file descriptor","test":"good","fd":-1,"error":"Bad fi","test":"good","lines":20,"words":30,"characters":40, "bytes": [0,1,2,3,4],"mbuf-current":10,"mbuf-cache":20,"mbuf-total":30,"distance":50,"location":"Boston","memory":64,"total":640,"memory":64,"total":640,"ten":10,"eleven":11,"unknown":1010,"unknown":1010,"min":15,"cur":20,"max":30,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"min":15,"cur":20,"max":125,"val1":21,"val2":58368,"val3":100663296,"val4":44470272,"val5":1342172800, "flag": ["one","two","three"],"works":null,"empty-tag":true,"t1":"1000","t2":"test5000","t3":"ten-longx","t4":"xtest", "__error": {"message":"this is an error"}, "__error": {"message":"two more errors"}, "__warning": {"message":"this is an warning"}, "__warning": {"message":"two more warnings"},"count":10,"test":4, "error": {"message":"Shut 'er down, Clancey! She's a-pumpin' mud! <>!,\"!<>\n"}}} } Modified: vendor/Juniper/libxo/dist/tests/core/saved/test_02.JP.out ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/saved/test_02.JP.out Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/saved/test_02.JP.out Fri Jun 16 06:12:07 2017 (r319997) @@ -67,7 +67,7 @@ "message": "two more errors" }, "__warning": { - "message": this is an warning + "message": "this is an warning" }, "__warning": { "message": "two more warnings" Modified: vendor/Juniper/libxo/dist/tests/core/test_01.c ============================================================================== --- vendor/Juniper/libxo/dist/tests/core/test_01.c Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/tests/core/test_01.c Fri Jun 16 06:12:07 2017 (r319997) @@ -80,6 +80,8 @@ main (int argc, char **argv) xo_open_container_h(NULL, "top"); + xo_emit("df {:used-percent/%5.0f}{U:%%}\n", (double) 12); + xo_emit("{e:kve_start/%#jx}", (uintmax_t) 0xdeadbeef); xo_emit("{e:kve_end/%#jx}", (uintmax_t) 0xcabb1e); @@ -189,6 +191,8 @@ main (int argc, char **argv) "{t:user/%s} {t:group/%s} \n", "mode", "octal", "links", "user", "group", "extra1", "extra2", "extra3"); + + xo_emit("{e:pre/%s}{t:links/%-*u}{t:post/%-*s}\n", "that", 8, 3, 8, "this"); xo_emit("{t:mode/%s}{e:mode_octal/%03o} {t:links/%*u} " "{t:user/%-*s} {t:group/%-*s} \n", Modified: vendor/Juniper/libxo/dist/xohtml/xohtml.css ============================================================================== --- vendor/Juniper/libxo/dist/xohtml/xohtml.css Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/xohtml/xohtml.css Fri Jun 16 06:12:07 2017 (r319997) @@ -124,7 +124,7 @@ div.muxer-buttons { padding: 20px; } -div.text, div.decoration, div.data, div.header, div.pad, div.item { +div.text, div.decoration, div.data, div.header, div.pad, div.item, div.units { font-family: monospace; display: inline; vertical-align: middle; Modified: vendor/Juniper/libxo/dist/xohtml/xohtml.sh.in ============================================================================== --- vendor/Juniper/libxo/dist/xohtml/xohtml.sh.in Fri Jun 16 04:28:10 2017 (r319996) +++ vendor/Juniper/libxo/dist/xohtml/xohtml.sh.in Fri Jun 16 06:12:07 2017 (r319997) @@ -57,7 +57,8 @@ if [ "$CMD" = "cat" -a -t 0 ]; then do_help fi -echo "\n\n" +echo '' +echo '' echo '' echo '' echo '' @@ -66,10 +67,12 @@ echo '' echo '' -echo "\n\n" +echo '' +echo '' $CMD -echo "\n\n" +echo '' +echo '' exit 0 From owner-svn-src-vendor@freebsd.org Fri Jun 16 06:15:27 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7DABBF7727; Fri, 16 Jun 2017 06:15:27 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C3F87209D; Fri, 16 Jun 2017 06:15:27 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5G6FQeF096875; Fri, 16 Jun 2017 06:15:26 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5G6FQG2096874; Fri, 16 Jun 2017 06:15:26 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201706160615.v5G6FQG2096874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Fri, 16 Jun 2017 06:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319998 - vendor/Juniper/libxo/0.8.2 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 06:15:28 -0000 Author: phil Date: Fri Jun 16 06:15:26 2017 New Revision: 319998 URL: https://svnweb.freebsd.org/changeset/base/319998 Log: Tag libxo 0.8.2 Added: - copied from r319997, vendor/Juniper/libxo/dist/ Directory Properties: vendor/Juniper/libxo/0.8.2/ (props changed) From owner-svn-src-vendor@freebsd.org Fri Jun 16 06:34:28 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38060BF7E6C; Fri, 16 Jun 2017 06:34:28 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0321372B21; Fri, 16 Jun 2017 06:34:27 +0000 (UTC) (envelope-from phil@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5G6YR5U005125; Fri, 16 Jun 2017 06:34:27 GMT (envelope-from phil@FreeBSD.org) Received: (from phil@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5G6YRQn005124; Fri, 16 Jun 2017 06:34:27 GMT (envelope-from phil@FreeBSD.org) Message-Id: <201706160634.v5G6YRQn005124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phil set sender to phil@FreeBSD.org using -f From: Phil Shafer Date: Fri, 16 Jun 2017 06:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320000 - vendor/Juniper/libxo X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 06:34:28 -0000 Author: phil Date: Fri Jun 16 06:34:26 2017 New Revision: 320000 URL: https://svnweb.freebsd.org/changeset/base/320000 Log: Update libxo's import shell for xohtml Submitted by: phil Modified: vendor/Juniper/libxo/import.sh Modified: vendor/Juniper/libxo/import.sh ============================================================================== --- vendor/Juniper/libxo/import.sh Fri Jun 16 06:29:21 2017 (r319999) +++ vendor/Juniper/libxo/import.sh Fri Jun 16 06:34:26 2017 (r320000) @@ -295,6 +295,7 @@ Cd $HEAD run "copying xo_config.h" "(echo '/* \$FreeBSD\$ */' ; cat $CWD/dist/build/libxo/xo_config.h ) > $HEAD/lib/libxo/xo_config.h" run "copying add.man" "(echo '.\\\" \$FreeBSD\$' ; cat $CWD/dist/build/libxo/add.man ) > $HEAD/lib/libxo/add.man" +run "copying xohtml.sh" "(echo '#!/bin/sh' ; echo '# \$FreeBSD\$' ; cat $CWD/dist/build/xohtml/xohtml.sh ) > $HEAD/usr.bin/xohtml/xohtml.sh" #BUILDDIRS="lib/libxo usr.bin/xo" #for dir in $BUILDDIRS ; do From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:03:32 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75043D8915A; Fri, 16 Jun 2017 21:03:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27BB26F4C0; Fri, 16 Jun 2017 21:03:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL3Vcv063394; Fri, 16 Jun 2017 21:03:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL3VX9063393; Fri, 16 Jun 2017 21:03:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162103.v5GL3VX9063393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320014 - vendor/llvm/llvm-trunk-r305575 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:03:32 -0000 Author: dim Date: Fri Jun 16 21:03:31 2017 New Revision: 320014 URL: https://svnweb.freebsd.org/changeset/base/320014 Log: Tag llvm trunk r305575. Added: vendor/llvm/llvm-trunk-r305575/ - copied from r320013, vendor/llvm/dist/ From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:03:28 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D518D89156; Fri, 16 Jun 2017 21:03:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE62A6F4BF; Fri, 16 Jun 2017 21:03:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL3Qdp063347; Fri, 16 Jun 2017 21:03:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL3PQc063335; Fri, 16 Jun 2017 21:03:25 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162103.v5GL3PQc063335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320013 - in vendor/llvm/dist: cmake/modules docs include/llvm/ADT include/llvm/Analysis include/llvm/BinaryFormat include/llvm/Bitcode include/llvm/CodeGen include/llvm/CodeGen/GlobalI... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:03:28 -0000 Author: dim Date: Fri Jun 16 21:03:24 2017 New Revision: 320013 URL: https://svnweb.freebsd.org/changeset/base/320013 Log: Vendor import of llvm trunk r305575: https://llvm.org/svn/llvm-project/llvm/trunk@305575 Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h (contents, props changed) vendor/llvm/dist/include/llvm/Testing/ vendor/llvm/dist/include/llvm/Testing/Support/ vendor/llvm/dist/include/llvm/Testing/Support/Error.h (contents, props changed) vendor/llvm/dist/include/llvm/Testing/Support/SupportHelpers.h (contents, props changed) vendor/llvm/dist/lib/DebugInfo/CodeView/StringsAndChecksums.cpp (contents, props changed) vendor/llvm/dist/lib/Fuzzer/test/inline-8bit-counters/ vendor/llvm/dist/lib/Fuzzer/test/inline-8bit-counters.test vendor/llvm/dist/lib/Fuzzer/test/inline-8bit-counters/CMakeLists.txt (contents, props changed) vendor/llvm/dist/lib/Testing/ vendor/llvm/dist/lib/Testing/CMakeLists.txt (contents, props changed) vendor/llvm/dist/lib/Testing/LLVMBuild.txt (contents, props changed) vendor/llvm/dist/lib/Testing/Support/ vendor/llvm/dist/lib/Testing/Support/CMakeLists.txt (contents, props changed) vendor/llvm/dist/lib/Testing/Support/Error.cpp (contents, props changed) vendor/llvm/dist/lib/Testing/Support/LLVMBuild.txt (contents, props changed) vendor/llvm/dist/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp (contents, props changed) vendor/llvm/dist/test/Analysis/ScalarEvolution/limit-depth.ll vendor/llvm/dist/test/Bitcode/DIExpression-minus-upgrade.ll vendor/llvm/dist/test/Bitcode/DIExpression-minus-upgrade.ll.bc (contents, props changed) vendor/llvm/dist/test/Bitcode/upgrade-linker-options.ll vendor/llvm/dist/test/CodeGen/AArch64/fast-isel-sp-adjust.ll vendor/llvm/dist/test/CodeGen/AMDGPU/GlobalISel/legalize-add.mir vendor/llvm/dist/test/CodeGen/AMDGPU/always-uniform.ll vendor/llvm/dist/test/CodeGen/BPF/rodata_1.ll vendor/llvm/dist/test/CodeGen/BPF/rodata_2.ll vendor/llvm/dist/test/CodeGen/BPF/rodata_3.ll vendor/llvm/dist/test/CodeGen/BPF/rodata_4.ll vendor/llvm/dist/test/CodeGen/Hexagon/loop-idiom/pmpy-shiftconv-fail.ll vendor/llvm/dist/test/CodeGen/Hexagon/mulh.ll vendor/llvm/dist/test/CodeGen/Hexagon/mux-kill.mir vendor/llvm/dist/test/CodeGen/Hexagon/mux-kill2.mir vendor/llvm/dist/test/CodeGen/Hexagon/store-imm-stack-object.ll vendor/llvm/dist/test/CodeGen/Mips/brundef.ll vendor/llvm/dist/test/CodeGen/PowerPC/licm-tocReg.ll vendor/llvm/dist/test/CodeGen/PowerPC/ppc64-P9-mod.ll vendor/llvm/dist/test/CodeGen/PowerPC/vec_revb.ll vendor/llvm/dist/test/CodeGen/X86/pr32368.ll vendor/llvm/dist/test/DebugInfo/Inputs/dwarfdump-str-offsets-dwp.x86_64.o (contents, props changed) vendor/llvm/dist/test/DebugInfo/Inputs/dwarfdump-test-zlib.o.elf-x86-64 (contents, props changed) vendor/llvm/dist/test/DebugInfo/PDB/Inputs/unknown-symbol.yaml vendor/llvm/dist/test/DebugInfo/PDB/pdb-unknown-symbol.test vendor/llvm/dist/test/DebugInfo/X86/double-declare.ll vendor/llvm/dist/test/DebugInfo/dwarfdump-str-offsets-dwp.test vendor/llvm/dist/test/Instrumentation/InstrProfiling/always_inline.ll vendor/llvm/dist/test/LTO/Resolution/X86/Inputs/dead-strip-fulllto.ll vendor/llvm/dist/test/LTO/Resolution/X86/dead-strip-fulllto.ll vendor/llvm/dist/test/LibDriver/use-paths.test vendor/llvm/dist/test/MC/AMDGPU/flat-gfx9.s (contents, props changed) vendor/llvm/dist/test/MC/WebAssembly/external-func-address.ll vendor/llvm/dist/test/MC/WebAssembly/func-address.ll vendor/llvm/dist/test/ThinLTO/X86/cfi-icall.ll vendor/llvm/dist/test/Transforms/CodeExtractor/live_shrink.ll vendor/llvm/dist/test/Transforms/CodeExtractor/live_shrink_gep.ll vendor/llvm/dist/test/Transforms/CodeExtractor/live_shrink_hoist.ll vendor/llvm/dist/test/Transforms/CodeExtractor/live_shrink_multiple.ll vendor/llvm/dist/test/Transforms/CodeExtractor/live_shrink_unsafe.ll vendor/llvm/dist/test/Transforms/CrossDSOCFI/cfi_functions.ll vendor/llvm/dist/test/Transforms/EarlyCSE/pr33406.ll vendor/llvm/dist/test/Transforms/GVN/pr32314.ll vendor/llvm/dist/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml vendor/llvm/dist/test/Transforms/LowerTypeTests/export-icall.ll vendor/llvm/dist/test/Transforms/LowerTypeTests/import-icall.ll vendor/llvm/dist/test/Transforms/RewriteStatepointsForGC/drop-invalid-metadata.ll vendor/llvm/dist/test/Transforms/Util/PredicateInfo/pr33456.ll vendor/llvm/dist/test/Transforms/Util/PredicateInfo/pr33457.ll vendor/llvm/dist/test/tools/llvm-cvtres/Inputs/combined.obj.coff (contents, props changed) vendor/llvm/dist/test/tools/llvm-cvtres/Inputs/languages.rc vendor/llvm/dist/test/tools/llvm-cvtres/Inputs/languages.res (contents, props changed) vendor/llvm/dist/test/tools/llvm-cvtres/Inputs/test_resource.obj.coff.arm (contents, props changed) vendor/llvm/dist/test/tools/llvm-cvtres/Inputs/test_resource.obj.coff.x64 (contents, props changed) vendor/llvm/dist/test/tools/llvm-cvtres/combined.test vendor/llvm/dist/test/tools/llvm-cvtres/help.test vendor/llvm/dist/test/tools/llvm-cvtres/machine.test vendor/llvm/dist/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/FormatUtil.cpp (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/FormatUtil.h (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/MinimalSymbolDumper.cpp (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/MinimalSymbolDumper.h (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/MinimalTypeDumper.cpp (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/MinimalTypeDumper.h (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/RawOutputStyle.cpp (contents, props changed) vendor/llvm/dist/tools/llvm-pdbutil/RawOutputStyle.h (contents, props changed) vendor/llvm/dist/unittests/Support/DynamicLibrary/ExportedFuncs.cxx (contents, props changed) Deleted: vendor/llvm/dist/test/CodeGen/PowerPC/testComparesinesll.ll vendor/llvm/dist/test/CodeGen/PowerPC/testComparesineull.ll vendor/llvm/dist/test/CodeGen/PowerPC/testComparesllnesll.ll vendor/llvm/dist/test/CodeGen/PowerPC/testComparesllneull.ll vendor/llvm/dist/test/DebugInfo/PDB/pdb-yaml-types.test vendor/llvm/dist/test/tools/llvm-cvtres/basic.test vendor/llvm/dist/test/tools/llvm-pdbdump/raw-stream-data.test vendor/llvm/dist/tools/llvm-pdbutil/LLVMOutputStyle.cpp vendor/llvm/dist/tools/llvm-pdbutil/LLVMOutputStyle.h vendor/llvm/dist/unittests/DebugInfo/CodeView/ErrorChecking.h vendor/llvm/dist/unittests/DebugInfo/PDB/ErrorChecking.h Modified: vendor/llvm/dist/cmake/modules/TableGen.cmake vendor/llvm/dist/docs/BranchWeightMetadata.rst vendor/llvm/dist/docs/LangRef.rst vendor/llvm/dist/docs/Lexicon.rst vendor/llvm/dist/docs/Phabricator.rst vendor/llvm/dist/include/llvm/ADT/AllocatorList.h vendor/llvm/dist/include/llvm/ADT/ArrayRef.h vendor/llvm/dist/include/llvm/ADT/BreadthFirstIterator.h vendor/llvm/dist/include/llvm/ADT/DAGDeltaAlgorithm.h vendor/llvm/dist/include/llvm/ADT/DeltaAlgorithm.h vendor/llvm/dist/include/llvm/ADT/DenseMap.h vendor/llvm/dist/include/llvm/ADT/DenseMapInfo.h vendor/llvm/dist/include/llvm/ADT/DenseSet.h vendor/llvm/dist/include/llvm/ADT/DepthFirstIterator.h vendor/llvm/dist/include/llvm/ADT/EquivalenceClasses.h vendor/llvm/dist/include/llvm/ADT/FoldingSet.h vendor/llvm/dist/include/llvm/ADT/GraphTraits.h vendor/llvm/dist/include/llvm/ADT/ImmutableList.h vendor/llvm/dist/include/llvm/ADT/ImmutableMap.h vendor/llvm/dist/include/llvm/ADT/ImmutableSet.h vendor/llvm/dist/include/llvm/ADT/IndexedMap.h vendor/llvm/dist/include/llvm/ADT/IntervalMap.h vendor/llvm/dist/include/llvm/ADT/IntrusiveRefCntPtr.h vendor/llvm/dist/include/llvm/ADT/MapVector.h vendor/llvm/dist/include/llvm/ADT/Optional.h vendor/llvm/dist/include/llvm/ADT/PackedVector.h vendor/llvm/dist/include/llvm/ADT/PointerEmbeddedInt.h vendor/llvm/dist/include/llvm/ADT/PointerUnion.h vendor/llvm/dist/include/llvm/ADT/ScopedHashTable.h vendor/llvm/dist/include/llvm/ADT/SmallBitVector.h vendor/llvm/dist/include/llvm/ADT/SmallSet.h vendor/llvm/dist/include/llvm/ADT/StringExtras.h vendor/llvm/dist/include/llvm/ADT/Triple.h vendor/llvm/dist/include/llvm/ADT/ilist_base.h vendor/llvm/dist/include/llvm/ADT/ilist_iterator.h vendor/llvm/dist/include/llvm/ADT/ilist_node.h vendor/llvm/dist/include/llvm/ADT/iterator.h vendor/llvm/dist/include/llvm/ADT/simple_ilist.h vendor/llvm/dist/include/llvm/Analysis/MemorySSA.h vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfo.h vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfoImpl.h vendor/llvm/dist/include/llvm/Analysis/TypeMetadataUtils.h vendor/llvm/dist/include/llvm/Analysis/ValueTracking.h vendor/llvm/dist/include/llvm/BinaryFormat/ELF.h vendor/llvm/dist/include/llvm/Bitcode/BitcodeReader.h vendor/llvm/dist/include/llvm/Bitcode/BitcodeWriter.h vendor/llvm/dist/include/llvm/Bitcode/LLVMBitCodes.h vendor/llvm/dist/include/llvm/CodeGen/BasicTTIImpl.h vendor/llvm/dist/include/llvm/CodeGen/FunctionLoweringInfo.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h vendor/llvm/dist/include/llvm/CodeGen/RuntimeLibcalls.h vendor/llvm/dist/include/llvm/CodeGen/SelectionDAG.h vendor/llvm/dist/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeView.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/Formatters.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/SymbolRecord.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/TypeIndex.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFVerifier.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/InfoStream.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/PDBFile.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/PublicsStream.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/RawConstants.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/SymbolStream.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h vendor/llvm/dist/include/llvm/IR/Constants.h vendor/llvm/dist/include/llvm/IR/DebugInfoMetadata.h vendor/llvm/dist/include/llvm/IR/GlobalVariable.h vendor/llvm/dist/include/llvm/IR/IRBuilder.h vendor/llvm/dist/include/llvm/IR/InstrTypes.h vendor/llvm/dist/include/llvm/IR/Instructions.h vendor/llvm/dist/include/llvm/IR/IntrinsicInst.h vendor/llvm/dist/include/llvm/IR/Intrinsics.td vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndex.h vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndexYAML.h vendor/llvm/dist/include/llvm/IR/Operator.h vendor/llvm/dist/include/llvm/IR/PatternMatch.h vendor/llvm/dist/include/llvm/LTO/LTO.h vendor/llvm/dist/include/llvm/LTO/legacy/LTOModule.h vendor/llvm/dist/include/llvm/MC/MCSymbolWasm.h vendor/llvm/dist/include/llvm/MC/MCWasmObjectWriter.h vendor/llvm/dist/include/llvm/Object/ArchiveWriter.h vendor/llvm/dist/include/llvm/Object/WindowsResource.h vendor/llvm/dist/include/llvm/ObjectYAML/COFFYAML.h vendor/llvm/dist/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h vendor/llvm/dist/include/llvm/ObjectYAML/CodeViewYAMLTypes.h vendor/llvm/dist/include/llvm/Option/Arg.h vendor/llvm/dist/include/llvm/Option/ArgList.h vendor/llvm/dist/include/llvm/Option/OptSpecifier.h vendor/llvm/dist/include/llvm/Option/OptTable.h vendor/llvm/dist/include/llvm/Option/Option.h vendor/llvm/dist/include/llvm/Support/BinaryStreamArray.h vendor/llvm/dist/include/llvm/Support/DebugCounter.h vendor/llvm/dist/include/llvm/Support/FormatAdapters.h vendor/llvm/dist/include/llvm/Support/FormatCommon.h vendor/llvm/dist/include/llvm/Support/MathExtras.h vendor/llvm/dist/include/llvm/Support/ThreadPool.h vendor/llvm/dist/include/llvm/TableGen/Main.h vendor/llvm/dist/include/llvm/TableGen/Record.h vendor/llvm/dist/include/llvm/TableGen/SetTheory.h vendor/llvm/dist/include/llvm/TableGen/StringMatcher.h vendor/llvm/dist/include/llvm/Target/TargetLoweringObjectFile.h vendor/llvm/dist/include/llvm/Target/TargetRegisterInfo.h vendor/llvm/dist/include/llvm/Transforms/Scalar/GVNExpression.h vendor/llvm/dist/include/llvm/Transforms/Utils/CodeExtractor.h vendor/llvm/dist/include/llvm/Transforms/Utils/Mem2Reg.h vendor/llvm/dist/lib/Analysis/BasicAliasAnalysis.cpp vendor/llvm/dist/lib/Analysis/CallGraphSCCPass.cpp vendor/llvm/dist/lib/Analysis/DivergenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/MemorySSA.cpp vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp vendor/llvm/dist/lib/Analysis/TargetTransformInfo.cpp vendor/llvm/dist/lib/Analysis/ValueTracking.cpp vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp vendor/llvm/dist/lib/Bitcode/Writer/BitcodeWriter.cpp vendor/llvm/dist/lib/CMakeLists.txt vendor/llvm/dist/lib/CodeGen/AsmPrinter/AsmPrinter.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfDebug.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfDebug.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfExpression.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfExpression.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.cpp vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/LegalizerHelper.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp vendor/llvm/dist/lib/CodeGen/MachineBlockPlacement.cpp vendor/llvm/dist/lib/CodeGen/MachineLICM.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp vendor/llvm/dist/lib/CodeGen/SplitKit.cpp vendor/llvm/dist/lib/CodeGen/StackColoring.cpp vendor/llvm/dist/lib/CodeGen/TargetLoweringBase.cpp vendor/llvm/dist/lib/CodeGen/TargetLoweringObjectFileImpl.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/CMakeLists.txt vendor/llvm/dist/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/SymbolDumper.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/TypeDatabase.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/TypeIndex.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFContext.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFVerifier.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/InfoStream.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PDBFile.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PDBStringTable.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PublicsStream.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/TpiHashing.cpp vendor/llvm/dist/lib/DebugInfo/PDB/UDTLayout.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerDriver.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerLoop.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerTracePC.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerTracePC.h vendor/llvm/dist/lib/Fuzzer/test/AbsNegAndConstant64Test.cpp vendor/llvm/dist/lib/Fuzzer/test/CMakeLists.txt vendor/llvm/dist/lib/Fuzzer/test/FourIndependentBranchesTest.cpp vendor/llvm/dist/lib/Fuzzer/test/FuzzerUnittest.cpp vendor/llvm/dist/lib/Fuzzer/test/ShrinkControlFlowTest.cpp vendor/llvm/dist/lib/Fuzzer/test/SimpleHashTest.cpp vendor/llvm/dist/lib/Fuzzer/test/SingleStrncmpTest.cpp vendor/llvm/dist/lib/Fuzzer/test/TableLookupTest.cpp vendor/llvm/dist/lib/Fuzzer/test/fuzzer-dirs.test vendor/llvm/dist/lib/Fuzzer/test/trace-pc/CMakeLists.txt vendor/llvm/dist/lib/IR/ConstantFold.cpp vendor/llvm/dist/lib/IR/ConstantsContext.h vendor/llvm/dist/lib/IR/DebugInfoMetadata.cpp vendor/llvm/dist/lib/IR/IRBuilder.cpp vendor/llvm/dist/lib/IR/Metadata.cpp vendor/llvm/dist/lib/IR/ModuleSummaryIndex.cpp vendor/llvm/dist/lib/IR/Verifier.cpp vendor/llvm/dist/lib/LLVMBuild.txt vendor/llvm/dist/lib/LTO/LTO.cpp vendor/llvm/dist/lib/LTO/LTOModule.cpp vendor/llvm/dist/lib/MC/MCParser/ELFAsmParser.cpp vendor/llvm/dist/lib/MC/MCSectionELF.cpp vendor/llvm/dist/lib/MC/WasmObjectWriter.cpp vendor/llvm/dist/lib/Object/ArchiveWriter.cpp vendor/llvm/dist/lib/Object/ELF.cpp vendor/llvm/dist/lib/Object/IRSymtab.cpp vendor/llvm/dist/lib/Object/WindowsResource.cpp vendor/llvm/dist/lib/ObjectYAML/COFFYAML.cpp vendor/llvm/dist/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp vendor/llvm/dist/lib/ObjectYAML/CodeViewYAMLSymbols.cpp vendor/llvm/dist/lib/ObjectYAML/CodeViewYAMLTypes.cpp vendor/llvm/dist/lib/ObjectYAML/ELFYAML.cpp vendor/llvm/dist/lib/Option/Arg.cpp vendor/llvm/dist/lib/Option/ArgList.cpp vendor/llvm/dist/lib/Option/OptTable.cpp vendor/llvm/dist/lib/Option/Option.cpp vendor/llvm/dist/lib/Passes/PassBuilder.cpp vendor/llvm/dist/lib/Support/BinaryStreamWriter.cpp vendor/llvm/dist/lib/Support/DebugCounter.cpp vendor/llvm/dist/lib/Support/FoldingSet.cpp vendor/llvm/dist/lib/Support/ThreadPool.cpp vendor/llvm/dist/lib/Support/Unix/Program.inc vendor/llvm/dist/lib/TableGen/Record.cpp vendor/llvm/dist/lib/TableGen/SetTheory.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64.td vendor/llvm/dist/lib/Target/AArch64/AArch64FastISel.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64SchedFalkorDetails.td vendor/llvm/dist/lib/Target/AArch64/AArch64Subtarget.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64TargetTransformInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp vendor/llvm/dist/lib/Target/AMDGPU/FLATInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/SIISelLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIInstrInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIInstrInfo.td vendor/llvm/dist/lib/Target/ARM/ARMCallLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMInstrVFP.td vendor/llvm/dist/lib/Target/ARM/ARMLegalizerInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMTargetTransformInfo.h vendor/llvm/dist/lib/Target/BPF/BPFAsmPrinter.cpp vendor/llvm/dist/lib/Target/BPF/BPFISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.td vendor/llvm/dist/lib/Target/Hexagon/HexagonGenMux.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonPatterns.td vendor/llvm/dist/lib/Target/Hexagon/HexagonTargetMachine.cpp vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsInstrInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsLongBranch.cpp vendor/llvm/dist/lib/Target/Mips/MipsSEISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Mips/MipsSEISelDAGToDAG.h vendor/llvm/dist/lib/Target/Mips/MipsSEISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsSubtarget.h vendor/llvm/dist/lib/Target/PowerPC/PPCISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCISelLowering.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCISelLowering.h vendor/llvm/dist/lib/Target/PowerPC/PPCInstr64Bit.td vendor/llvm/dist/lib/Target/PowerPC/PPCInstrInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCInstrInfo.td vendor/llvm/dist/lib/Target/PowerPC/PPCInstrVSX.td vendor/llvm/dist/lib/Target/PowerPC/PPCRegisterInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCRegisterInfo.h vendor/llvm/dist/lib/Target/PowerPC/PPCTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCTargetTransformInfo.h vendor/llvm/dist/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZTargetTransformInfo.h vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td vendor/llvm/dist/lib/Target/X86/X86InstrFragmentsSIMD.td vendor/llvm/dist/lib/Target/X86/X86InstrInfo.cpp vendor/llvm/dist/lib/Transforms/IPO/CrossDSOCFI.cpp vendor/llvm/dist/lib/Transforms/IPO/Inliner.cpp vendor/llvm/dist/lib/Transforms/IPO/LowerTypeTests.cpp vendor/llvm/dist/lib/Transforms/IPO/PartialInlining.cpp vendor/llvm/dist/lib/Transforms/IPO/PassManagerBuilder.cpp vendor/llvm/dist/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCalls.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineInternal.h vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineShifts.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/CMakeLists.txt vendor/llvm/dist/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/InstrProfiling.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/SanitizerCoverage.cpp vendor/llvm/dist/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp vendor/llvm/dist/lib/Transforms/Scalar/EarlyCSE.cpp vendor/llvm/dist/lib/Transforms/Scalar/GVNSink.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopIdiomRecognize.cpp vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp vendor/llvm/dist/lib/Transforms/Utils/CodeExtractor.cpp vendor/llvm/dist/lib/Transforms/Utils/PredicateInfo.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyIndVar.cpp vendor/llvm/dist/test/Assembler/diexpression.ll vendor/llvm/dist/test/Bitcode/DIExpression-deref.ll vendor/llvm/dist/test/Bitcode/DIGlobalVariableExpression.ll vendor/llvm/dist/test/CodeGen/AArch64/GlobalISel/legalize-load-store.mir vendor/llvm/dist/test/CodeGen/AArch64/arm64-sincos.ll vendor/llvm/dist/test/CodeGen/AArch64/misched-fusion-aes.ll vendor/llvm/dist/test/CodeGen/AArch64/sincos-expansion.ll vendor/llvm/dist/test/CodeGen/AArch64/swifterror.ll vendor/llvm/dist/test/CodeGen/AMDGPU/GlobalISel/inst-select-load-flat.mir vendor/llvm/dist/test/CodeGen/AMDGPU/GlobalISel/inst-select-store-flat.mir vendor/llvm/dist/test/CodeGen/AMDGPU/cgp-addressing-modes-flat.ll vendor/llvm/dist/test/CodeGen/AMDGPU/code-object-metadata-kernel-debug-props.ll vendor/llvm/dist/test/CodeGen/AMDGPU/constant-fold-imm-immreg.mir vendor/llvm/dist/test/CodeGen/AMDGPU/flat-address-space.ll vendor/llvm/dist/test/CodeGen/AMDGPU/flat_atomics.ll vendor/llvm/dist/test/CodeGen/AMDGPU/global_smrd_cfg.ll vendor/llvm/dist/test/CodeGen/AMDGPU/inserted-wait-states.mir vendor/llvm/dist/test/CodeGen/AMDGPU/limit-coalesce.mir vendor/llvm/dist/test/CodeGen/AMDGPU/rename-independent-subregs-invalid-mac-operands.mir vendor/llvm/dist/test/CodeGen/AMDGPU/sdwa-scalar-ops.mir vendor/llvm/dist/test/CodeGen/AMDGPU/waitcnt.mir vendor/llvm/dist/test/CodeGen/ARM/GlobalISel/arm-irtranslator.ll vendor/llvm/dist/test/CodeGen/ARM/GlobalISel/arm-isel-divmod.ll vendor/llvm/dist/test/CodeGen/ARM/GlobalISel/arm-legalize-divmod.mir vendor/llvm/dist/test/CodeGen/ARM/GlobalISel/arm-unsupported.ll vendor/llvm/dist/test/CodeGen/ARM/cortex-a57-misched-vfma.ll vendor/llvm/dist/test/CodeGen/ARM/debug-info-blocks.ll vendor/llvm/dist/test/CodeGen/ARM/sincos.ll vendor/llvm/dist/test/CodeGen/ARM/swifterror.ll vendor/llvm/dist/test/CodeGen/Mips/2008-06-05-Carry.ll vendor/llvm/dist/test/CodeGen/Mips/dsp-patterns.ll vendor/llvm/dist/test/CodeGen/Mips/llcarry.ll vendor/llvm/dist/test/CodeGen/Mips/llvm-ir/add.ll vendor/llvm/dist/test/CodeGen/Mips/llvm-ir/sub.ll vendor/llvm/dist/test/CodeGen/Mips/longbranch.ll vendor/llvm/dist/test/CodeGen/Mips/madd-msub.ll vendor/llvm/dist/test/CodeGen/PowerPC/atomic-2.ll vendor/llvm/dist/test/CodeGen/PowerPC/atomics-constant.ll vendor/llvm/dist/test/CodeGen/PowerPC/atomics-regression.ll vendor/llvm/dist/test/CodeGen/PowerPC/logic-ops-on-compares.ll vendor/llvm/dist/test/CodeGen/SystemZ/fp-sincos-01.ll vendor/llvm/dist/test/CodeGen/X86/2012-01-11-split-cv.ll vendor/llvm/dist/test/CodeGen/X86/StackColoring.ll vendor/llvm/dist/test/CodeGen/X86/add-sub-nsw-nuw.ll vendor/llvm/dist/test/CodeGen/X86/addcarry.ll vendor/llvm/dist/test/CodeGen/X86/avx-vperm2x128.ll vendor/llvm/dist/test/CodeGen/X86/bt.ll vendor/llvm/dist/test/CodeGen/X86/cmov-into-branch.ll vendor/llvm/dist/test/CodeGen/X86/combine-64bit-vec-binop.ll vendor/llvm/dist/test/CodeGen/X86/element-wise-atomic-memory-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/fast-isel-select-sse.ll vendor/llvm/dist/test/CodeGen/X86/fp-logic-replace.ll vendor/llvm/dist/test/CodeGen/X86/fp-logic.ll vendor/llvm/dist/test/CodeGen/X86/fp-select-cmp-and.ll vendor/llvm/dist/test/CodeGen/X86/immediate_merging64.ll vendor/llvm/dist/test/CodeGen/X86/lea-opt-with-debug.mir vendor/llvm/dist/test/CodeGen/X86/loop-search.ll vendor/llvm/dist/test/CodeGen/X86/mask-negated-bool.ll vendor/llvm/dist/test/CodeGen/X86/memset-2.ll vendor/llvm/dist/test/CodeGen/X86/memset-nonzero.ll vendor/llvm/dist/test/CodeGen/X86/memset64-on-x86-32.ll vendor/llvm/dist/test/CodeGen/X86/negate-i1.ll vendor/llvm/dist/test/CodeGen/X86/negate-shift.ll vendor/llvm/dist/test/CodeGen/X86/negate.ll vendor/llvm/dist/test/CodeGen/X86/negative-sin.ll vendor/llvm/dist/test/CodeGen/X86/no-sse2-avg.ll vendor/llvm/dist/test/CodeGen/X86/not-and-simplify.ll vendor/llvm/dist/test/CodeGen/X86/pr13577.ll vendor/llvm/dist/test/CodeGen/X86/pr18014.ll vendor/llvm/dist/test/CodeGen/X86/rem.ll vendor/llvm/dist/test/CodeGen/X86/sar_fold64.ll vendor/llvm/dist/test/CodeGen/X86/select-with-and-or.ll vendor/llvm/dist/test/CodeGen/X86/sext-setcc-self.ll vendor/llvm/dist/test/CodeGen/X86/shift-pcmp.ll vendor/llvm/dist/test/CodeGen/X86/sincos-opt.ll vendor/llvm/dist/test/CodeGen/X86/sse-intrinsics-x86-upgrade.ll vendor/llvm/dist/test/CodeGen/X86/sse41-intrinsics-x86-upgrade.ll vendor/llvm/dist/test/CodeGen/X86/stack-folding-int-avx512.ll vendor/llvm/dist/test/CodeGen/X86/stack-folding-int-avx512vl.ll vendor/llvm/dist/test/CodeGen/X86/statepoint-live-in.ll vendor/llvm/dist/test/CodeGen/X86/swifterror.ll vendor/llvm/dist/test/CodeGen/X86/urem-i8-constant.ll vendor/llvm/dist/test/CodeGen/X86/urem-power-of-two.ll vendor/llvm/dist/test/CodeGen/X86/vec3.ll vendor/llvm/dist/test/CodeGen/X86/vector-compare-combines.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-256-v16.ll vendor/llvm/dist/test/CodeGen/X86/vzero-excess.ll vendor/llvm/dist/test/CodeGen/X86/x86-interleaved-access.ll vendor/llvm/dist/test/DebugInfo/COFF/array-odr-violation.ll vendor/llvm/dist/test/DebugInfo/COFF/inlining-same-name.ll vendor/llvm/dist/test/DebugInfo/Generic/block-asan.ll vendor/llvm/dist/test/DebugInfo/Inputs/dwarfdump-str-offsets.s vendor/llvm/dist/test/DebugInfo/Inputs/dwarfdump-test-zlib.cc vendor/llvm/dist/test/DebugInfo/MIR/ARM/split-superreg-complex.mir vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-debug-subsections.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-headers.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-mergeids.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-mergetypes.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-raw-blocks.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-raw-stream.test vendor/llvm/dist/test/DebugInfo/PDB/pdbdump-readwrite.test vendor/llvm/dist/test/DebugInfo/X86/block-capture.ll vendor/llvm/dist/test/DebugInfo/X86/debug-info-block-captured-self.ll vendor/llvm/dist/test/DebugInfo/X86/debug-info-blocks.ll vendor/llvm/dist/test/DebugInfo/X86/dw_op_minus.ll vendor/llvm/dist/test/DebugInfo/X86/dw_op_minus_direct.ll vendor/llvm/dist/test/DebugInfo/X86/safestack-byval.ll vendor/llvm/dist/test/DebugInfo/X86/stack-value-dwarf2.ll vendor/llvm/dist/test/DebugInfo/X86/unattached-global.ll vendor/llvm/dist/test/DebugInfo/dwarfdump-zlib.test vendor/llvm/dist/test/Instrumentation/SanitizerCoverage/inline-8bit-counters.ll vendor/llvm/dist/test/LTO/Resolution/X86/symtab-elf.ll vendor/llvm/dist/test/LTO/Resolution/X86/symtab.ll vendor/llvm/dist/test/MC/AMDGPU/flat.s vendor/llvm/dist/test/MC/COFF/cv-compiler-info.ll vendor/llvm/dist/test/MC/COFF/linker-options.ll vendor/llvm/dist/test/MC/Disassembler/PowerPC/ppc64-encoding.txt vendor/llvm/dist/test/MC/Disassembler/PowerPC/ppc64le-encoding.txt vendor/llvm/dist/test/MC/ELF/section.s vendor/llvm/dist/test/MC/MachO/linker-options.ll vendor/llvm/dist/test/MC/PowerPC/ppc64-encoding.s vendor/llvm/dist/test/MC/WebAssembly/external-data.ll vendor/llvm/dist/test/Transforms/GlobalMerge/debug-info.ll vendor/llvm/dist/test/Transforms/Inline/always-inline.ll vendor/llvm/dist/test/Transforms/InstCombine/debuginfo-dce.ll vendor/llvm/dist/test/Transforms/InstCombine/element-atomic-memcpy-to-loads.ll vendor/llvm/dist/test/Transforms/InstCombine/ffs-1.ll vendor/llvm/dist/test/Transforms/InstCombine/lshr.ll vendor/llvm/dist/test/Transforms/InstCombine/onehot_merge.ll vendor/llvm/dist/test/Transforms/InstCombine/or-xor.ll vendor/llvm/dist/test/Transforms/InstCombine/select-with-bitwise-ops.ll vendor/llvm/dist/test/Transforms/InstCombine/shift.ll vendor/llvm/dist/test/Transforms/InstCombine/xor2.ll vendor/llvm/dist/test/Transforms/LoopIdiom/X86/unordered-atomic-memcpy.ll vendor/llvm/dist/test/Transforms/LoopIdiom/unordered-atomic-memcpy-noarch.ll vendor/llvm/dist/test/Transforms/PGOProfile/memop_size_opt.ll vendor/llvm/dist/test/Transforms/SLPVectorizer/X86/arith-add.ll vendor/llvm/dist/test/Transforms/SLPVectorizer/X86/arith-fp.ll vendor/llvm/dist/test/Transforms/SLPVectorizer/X86/arith-mul.ll vendor/llvm/dist/test/Transforms/SLPVectorizer/X86/arith-sub.ll vendor/llvm/dist/test/Transforms/SafeStack/X86/debug-loc.ll vendor/llvm/dist/test/Transforms/SafeStack/X86/debug-loc2.ll vendor/llvm/dist/test/Verifier/element-wise-atomic-memory-intrinsics.ll vendor/llvm/dist/test/lit.cfg vendor/llvm/dist/test/tools/llvm-cvtres/object.test vendor/llvm/dist/test/tools/llvm-cvtres/parse.test vendor/llvm/dist/test/tools/llvm-readobj/resources.test vendor/llvm/dist/tools/llvm-ar/llvm-ar.cpp vendor/llvm/dist/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp vendor/llvm/dist/tools/llvm-cvtres/llvm-cvtres.cpp vendor/llvm/dist/tools/llvm-dwarfdump/llvm-dwarfdump.cpp vendor/llvm/dist/tools/llvm-pdbutil/CMakeLists.txt vendor/llvm/dist/tools/llvm-pdbutil/LinePrinter.cpp vendor/llvm/dist/tools/llvm-pdbutil/LinePrinter.h vendor/llvm/dist/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp vendor/llvm/dist/tools/llvm-pdbutil/YAMLOutputStyle.cpp vendor/llvm/dist/tools/llvm-pdbutil/llvm-pdbutil.cpp vendor/llvm/dist/tools/llvm-pdbutil/llvm-pdbutil.h vendor/llvm/dist/tools/llvm-readobj/COFFDumper.cpp vendor/llvm/dist/tools/llvm-readobj/ELFDumper.cpp vendor/llvm/dist/tools/llvm-stress/llvm-stress.cpp vendor/llvm/dist/tools/obj2yaml/CMakeLists.txt vendor/llvm/dist/tools/obj2yaml/coff2yaml.cpp vendor/llvm/dist/tools/yaml2obj/CMakeLists.txt vendor/llvm/dist/tools/yaml2obj/yaml2coff.cpp vendor/llvm/dist/tools/yaml2obj/yaml2obj.cpp vendor/llvm/dist/unittests/ADT/SCCIteratorTest.cpp vendor/llvm/dist/unittests/ADT/SmallVectorTest.cpp vendor/llvm/dist/unittests/ADT/StringRefTest.cpp vendor/llvm/dist/unittests/CodeGen/LowLevelTypeTest.cpp vendor/llvm/dist/unittests/DebugInfo/CodeView/CMakeLists.txt vendor/llvm/dist/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp vendor/llvm/dist/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp vendor/llvm/dist/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp vendor/llvm/dist/unittests/DebugInfo/PDB/CMakeLists.txt vendor/llvm/dist/unittests/DebugInfo/PDB/HashTableTest.cpp vendor/llvm/dist/unittests/DebugInfo/PDB/MSFBuilderTest.cpp vendor/llvm/dist/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp vendor/llvm/dist/unittests/DebugInfo/PDB/StringTableBuilderTest.cpp vendor/llvm/dist/unittests/DebugInfo/PDB/TypeServerHandlerTest.cpp vendor/llvm/dist/unittests/IR/MetadataTest.cpp vendor/llvm/dist/unittests/IR/PatternMatch.cpp vendor/llvm/dist/unittests/MI/LiveIntervalTest.cpp vendor/llvm/dist/unittests/Support/BinaryStreamTest.cpp vendor/llvm/dist/unittests/Support/CMakeLists.txt vendor/llvm/dist/unittests/Support/CommandLineTest.cpp vendor/llvm/dist/unittests/Support/DynamicLibrary/CMakeLists.txt vendor/llvm/dist/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp vendor/llvm/dist/unittests/Support/DynamicLibrary/PipSqueak.cxx vendor/llvm/dist/unittests/Support/DynamicLibrary/PipSqueak.h vendor/llvm/dist/unittests/Support/FormatVariadicTest.cpp vendor/llvm/dist/unittests/Target/AArch64/InstSizes.cpp vendor/llvm/dist/unittests/Transforms/Scalar/LoopPassManagerTest.cpp vendor/llvm/dist/utils/TableGen/CodeGenDAGPatterns.cpp vendor/llvm/dist/utils/opt-viewer/opt-diff.py vendor/llvm/dist/utils/opt-viewer/opt-stats.py vendor/llvm/dist/utils/opt-viewer/opt-viewer.py vendor/llvm/dist/utils/release/test-release.sh vendor/llvm/dist/utils/update_test_checks.py Modified: vendor/llvm/dist/cmake/modules/TableGen.cmake ============================================================================== --- vendor/llvm/dist/cmake/modules/TableGen.cmake Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/cmake/modules/TableGen.cmake Fri Jun 16 21:03:24 2017 (r320013) @@ -35,38 +35,24 @@ function(tablegen project ofn) # a tablegen change, as cmake does not propagate file-level dependencies # of custom targets. See the following ticket for more information: # https://cmake.org/Bug/view.php?id=15858 - # We could always have just one dependency on both the target and - # the file, but these 2 cases would produce cleaner cmake files. - if (${${project}_TABLEGEN_TARGET} STREQUAL ${${project}_TABLEGEN_EXE}) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp - # Generate tablegen output in a temporary file. - COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} - ${LLVM_TABLEGEN_FLAGS} - ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} - -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp - # The file in LLVM_TARGET_DEFINITIONS may be not in the current - # directory and local_tds may not contain it, so we must - # explicitly list it here: - DEPENDS ${${project}_TABLEGEN_TARGET} ${local_tds} ${global_tds} - ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} - COMMENT "Building ${ofn}..." - ) - else() - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp - # Generate tablegen output in a temporary file. - COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} - ${LLVM_TABLEGEN_FLAGS} - ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} - -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp - # The file in LLVM_TARGET_DEFINITIONS may be not in the current - # directory and local_tds may not contain it, so we must - # explicitly list it here: - DEPENDS ${${project}_TABLEGEN_TARGET} ${${project}_TABLEGEN_EXE} - ${local_tds} ${global_tds} - ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} - COMMENT "Building ${ofn}..." - ) - endif() + # The dependency on both, the target and the file, produces the same + # dependency twice in the result file when + # ("${${project}_TABLEGEN_TARGET}" STREQUAL "${${project}_TABLEGEN_EXE}") + # but lets us having smaller and cleaner code here. + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp + # Generate tablegen output in a temporary file. + COMMAND ${${project}_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} + ${LLVM_TABLEGEN_FLAGS} + ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} + -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp + # The file in LLVM_TARGET_DEFINITIONS may be not in the current + # directory and local_tds may not contain it, so we must + # explicitly list it here: + DEPENDS ${${project}_TABLEGEN_TARGET} ${${project}_TABLEGEN_EXE} + ${local_tds} ${global_tds} + ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} + COMMENT "Building ${ofn}..." + ) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} # Only update the real output file if there are any differences. # This prevents recompilation of all the files depending on it if there Modified: vendor/llvm/dist/docs/BranchWeightMetadata.rst ============================================================================== --- vendor/llvm/dist/docs/BranchWeightMetadata.rst Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/docs/BranchWeightMetadata.rst Fri Jun 16 21:03:24 2017 (r320013) @@ -64,6 +64,20 @@ Branch weights are assigned to every destination. [ , i32 ... ] } +``CallInst`` +^^^^^^^^^^^^^^^^^^ + +Calls may have branch weight metadata, containing the execution count of +the call. It is currently used in SamplePGO mode only, to augment the +block and entry counts which may not be accurate with sampling. + +.. code-block:: none + + !0 = metadata !{ + metadata !"branch_weights", + i32 + } + Other ^^^^^ Modified: vendor/llvm/dist/docs/LangRef.rst ============================================================================== --- vendor/llvm/dist/docs/LangRef.rst Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/docs/LangRef.rst Fri Jun 16 21:03:24 2017 (r320013) @@ -4033,26 +4033,26 @@ DICompileUnit """"""""""""" ``DICompileUnit`` nodes represent a compile unit. The ``enums:``, -``retainedTypes:``, ``subprograms:``, ``globals:``, ``imports:`` and ``macros:`` -fields are tuples containing the debug info to be emitted along with the compile -unit, regardless of code optimizations (some nodes are only emitted if there are -references to them from instructions). The ``debugInfoForProfiling:`` field is a -boolean indicating whether or not line-table discriminators are updated to -provide more-accurate debug info for profiling results. +``retainedTypes:``, ``globals:``, ``imports:`` and ``macros:`` fields are tuples +containing the debug info to be emitted along with the compile unit, regardless +of code optimizations (some nodes are only emitted if there are references to +them from instructions). The ``debugInfoForProfiling:`` field is a boolean +indicating whether or not line-table discriminators are updated to provide +more-accurate debug info for profiling results. .. code-block:: text !0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, flags: "-O2", runtimeVersion: 2, splitDebugFilename: "abc.debug", emissionKind: FullDebug, - enums: !2, retainedTypes: !3, subprograms: !4, - globals: !5, imports: !6, macros: !7, dwoId: 0x0abcd) + enums: !2, retainedTypes: !3, globals: !4, imports: !5, + macros: !6, dwoId: 0x0abcd) Compile unit descriptors provide the root scope for objects declared in a -specific compilation unit. File descriptors are defined using this scope. -These descriptors are collected by a named metadata ``!llvm.dbg.cu``. They -keep track of subprograms, global variables, type information, and imported -entities (declarations and namespaces). +specific compilation unit. File descriptors are defined using this scope. These +descriptors are collected by a named metadata node ``!llvm.dbg.cu``. They keep +track of global variables, type information, and imported entities (declarations +and namespaces). .. _DIFile: @@ -4326,8 +4326,8 @@ and ``scope:``. containingType: !4, virtuality: DW_VIRTUALITY_pure_virtual, virtualIndex: 10, flags: DIFlagPrototyped, - isOptimized: true, templateParams: !5, - declaration: !6, variables: !7) + isOptimized: true, unit: !5, templateParams: !6, + declaration: !7, variables: !8, thrownTypes: !9) .. _DILexicalBlock: @@ -4404,7 +4404,12 @@ referenced LLVM variable relates to the source languag The current supported vocabulary is limited: - ``DW_OP_deref`` dereferences the top of the expression stack. -- ``DW_OP_plus, 93`` adds ``93`` to the working expression. +- ``DW_OP_plus`` pops the last two entries from the expression stack, adds + them together and appends the result to the expression stack. +- ``DW_OP_minus`` pops the last two entries from the expression stack, subtracts + the last entry from the second last entry and appends the result to the + expression stack. +- ``DW_OP_plus_uconst, 93`` adds ``93`` to the working expression. - ``DW_OP_LLVM_fragment, 16, 8`` specifies the offset and size (``16`` and ``8`` here, respectively) of the variable fragment from the working expression. Note that contrary to DW_OP_bit_piece, the offset is describing the the location @@ -4426,9 +4431,10 @@ combined with a concrete location. .. code-block:: llvm !0 = !DIExpression(DW_OP_deref) - !1 = !DIExpression(DW_OP_plus, 3) + !1 = !DIExpression(DW_OP_plus_uconst, 3) + !1 = !DIExpression(DW_OP_constu, 3, DW_OP_plus) !2 = !DIExpression(DW_OP_bit_piece, 3, 7) - !3 = !DIExpression(DW_OP_deref, DW_OP_plus, 3, DW_OP_LLVM_fragment, 3, 7) + !3 = !DIExpression(DW_OP_deref, DW_OP_constu, 3, DW_OP_plus, DW_OP_LLVM_fragment, 3, 7) !4 = !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef) !5 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value) @@ -5186,6 +5192,72 @@ Example: !0 = !{i32* @a} +'``prof``' Metadata +^^^^^^^^^^^^^^^^^^^ + +The ``prof`` metadata is used to record profile data in the IR. +The first operand of the metadata node indicates the profile metadata +type. There are currently 3 types: +:ref:`branch_weights`, +:ref:`function_entry_count`, and +:ref:`VP`. + +.. _prof_node_branch_weights: + +branch_weights +"""""""""""""" + +Branch weight metadata attached to a branch, select, switch or call instruction +represents the likeliness of the associated branch being taken. +For more information, see :doc:`BranchWeightMetadata`. + +.. _prof_node_function_entry_count: + +function_entry_count +"""""""""""""""""""" + +Function entry count metadata can be attached to function definitions +to record the number of times the function is called. Used with BFI +information, it is also used to derive the basic block profile count. +For more information, see :doc:`BranchWeightMetadata`. + +.. _prof_node_VP: + +VP +"" + +VP (value profile) metadata can be attached to instructions that have +value profile information. Currently this is indirect calls (where it +records the hottest callees) and calls to memory intrinsics such as memcpy, +memmove, and memset (where it records the hottest byte lengths). + +Each VP metadata node contains "VP" string, then a uint32_t value for the value +profiling kind, a uint64_t value for the total number of times the instruction +is executed, followed by uint64_t value and execution count pairs. +The value profiling kind is 0 for indirect call targets and 1 for memory +operations. For indirect call targets, each profile value is a hash +of the callee function name, and for memory operations each value is the +byte length. + +Note that the value counts do not need to add up to the total count +listed in the third operand (in practice only the top hottest values +are tracked and reported). + +Indirect call example: + +.. code-block:: llvm + + call void %f(), !prof !1 + !1 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410} + +Note that the VP type is 0 (the second operand), which indicates this is +an indirect call value profile data. The third operand indicates that the +indirect call executed 1600 times. The 4th and 6th operands give the +hashes of the 2 hottest target functions' names (this is the same hash used +to represent function names in the profile database), and the 5th and 7th +operands give the execution count that each of the respective prior target +functions was called. + Module Flags Metadata ===================== @@ -5352,40 +5424,6 @@ Some important flag interactions: - A module with ``Objective-C Garbage Collection`` set to 0 cannot be merged with a module with ``Objective-C GC Only`` set to 6. -Automatic Linker Flags Module Flags Metadata --------------------------------------------- - -Some targets support embedding flags to the linker inside individual object -files. Typically this is used in conjunction with language extensions which -allow source files to explicitly declare the libraries they depend on, and have -these automatically be transmitted to the linker via object files. - -These flags are encoded in the IR using metadata in the module flags section, -using the ``Linker Options`` key. The merge behavior for this flag is required -to be ``AppendUnique``, and the value for the key is expected to be a metadata -node which should be a list of other metadata nodes, each of which should be a -list of metadata strings defining linker options. - -For example, the following metadata section specifies two separate sets of -linker options, presumably to link against ``libz`` and the ``Cocoa`` -framework:: - - !0 = !{ i32 6, !"Linker Options", - !{ - !{ !"-lz" }, - !{ !"-framework", !"Cocoa" } } } - !llvm.module.flags = !{ !0 } - -The metadata encoding as lists of lists of options, as opposed to a collapsed -list of options, is chosen so that the IR encoding can use multiple option -strings to specify e.g., a single library, while still having that specifier be -preserved as an atomic element that can be recognized by a target specific -assembly writer or object file emitter. - -Each individual option is required to be either a valid option for the target's -linker, or an option that is reserved by the target specific assembly writer or -object file emitter. No other aspect of these options is defined by the IR. - C type width Module Flags Metadata ---------------------------------- @@ -5422,6 +5460,37 @@ enum is the smallest type which can represent all of i !0 = !{i32 1, !"short_wchar", i32 1} !1 = !{i32 1, !"short_enum", i32 0} +Automatic Linker Flags Named Metadata +===================================== + +Some targets support embedding flags to the linker inside individual object +files. Typically this is used in conjunction with language extensions which +allow source files to explicitly declare the libraries they depend on, and have +these automatically be transmitted to the linker via object files. + +These flags are encoded in the IR using named metadata with the name +``!llvm.linker.options``. Each operand is expected to be a metadata node +which should be a list of other metadata nodes, each of which should be a +list of metadata strings defining linker options. + +For example, the following metadata section specifies two separate sets of +linker options, presumably to link against ``libz`` and the ``Cocoa`` +framework:: + + !0 = !{ !"-lz" }, + !1 = !{ !"-framework", !"Cocoa" } } } + !llvm.linker.options = !{ !0, !1 } + +The metadata encoding as lists of lists of options, as opposed to a collapsed +list of options, is chosen so that the IR encoding can use multiple option +strings to specify e.g., a single library, while still having that specifier be +preserved as an atomic element that can be recognized by a target specific +assembly writer or object file emitter. + +Each individual option is required to be either a valid option for the target's +linker, or an option that is reserved by the target specific assembly writer or +object file emitter. No other aspect of these options is defined by the IR. + .. _intrinsicglobalvariables: Intrinsic Global Variables @@ -13999,62 +14068,66 @@ Element Wise Atomic Memory Intrinsics These intrinsics are similar to the standard library memory intrinsics except that they perform memory transfer as a sequence of atomic memory accesses. -.. _int_memcpy_element_atomic: +.. _int_memcpy_element_unordered_atomic: -'``llvm.memcpy.element.atomic``' Intrinsic -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +'``llvm.memcpy.element.unordered.atomic``' Intrinsic +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Syntax: """"""" -This is an overloaded intrinsic. You can use ``llvm.memcpy.element.atomic`` on +This is an overloaded intrinsic. You can use ``llvm.memcpy.element.unordered.atomic`` on any integer bit width and for different address spaces. Not all targets support all bit widths however. :: - declare void @llvm.memcpy.element.atomic.p0i8.p0i8(i8* , i8* , - i64 , i32 ) + declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i32(i8* , + i8* , + i32 , + i32 ) + declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* , + i8* , + i64 , + i32 ) Overview: """"""""" -The '``llvm.memcpy.element.atomic.*``' intrinsic performs copy of a block of -memory from the source location to the destination location as a sequence of -unordered atomic memory accesses where each access is a multiple of -``element_size`` bytes wide and aligned at an element size boundary. For example -each element is accessed atomically in source and destination buffers. +The '``llvm.memcpy.element.unordered.atomic.*``' intrinsic is a specialization of the +'``llvm.memcpy.*``' intrinsic. It differs in that the ``dest`` and ``src`` are treated +as arrays with elements that are exactly ``element_size`` bytes, and the copy between +buffers uses a sequence of :ref:`unordered atomic ` load/store operations +that are a positive integer multiple of the ``element_size`` in size. Arguments: """""""""" -The first argument is a pointer to the destination, the second is a -pointer to the source. The third argument is an integer argument -specifying the number of elements to copy, the fourth argument is size of -the single element in bytes. +The first three arguments are the same as they are in the :ref:`@llvm.memcpy ` +intrinsic, with the added constraint that ``len`` is required to be a positive integer +multiple of the ``element_size``. If ``len`` is not a positive integer multiple of +``element_size``, then the behaviour of the intrinsic is undefined. -``element_size`` should be a power of two, greater than zero and less than -a target-specific atomic access size limit. +``element_size`` must be a compile-time constant positive power of two no greater than +target-specific atomic access size limit. -For each of the input pointers ``align`` parameter attribute must be specified. -It must be a power of two and greater than or equal to the ``element_size``. -Caller guarantees that both the source and destination pointers are aligned to -that boundary. +For each of the input pointers ``align`` parameter attribute must be specified. It +must be a power of two no less than the ``element_size``. Caller guarantees that +both the source and destination pointers are aligned to that boundary. Semantics: """""""""" -The '``llvm.memcpy.element.atomic.*``' intrinsic copies -'``num_elements`` * ``element_size``' bytes of memory from the source location to -the destination location. These locations are not allowed to overlap. Memory copy -is performed as a sequence of unordered atomic memory accesses where each access -is guaranteed to be a multiple of ``element_size`` bytes wide and aligned at an -element size boundary. +The '``llvm.memcpy.element.unordered.atomic.*``' intrinsic copies ``len`` bytes of +memory from the source location to the destination location. These locations are not +allowed to overlap. The memory copy is performed as a sequence of load/store operations +where each access is guaranteed to be a multiple of ``element_size`` bytes wide and +aligned at an ``element_size`` boundary. The order of the copy is unspecified. The same value may be read from the source buffer many times, but only one write is issued to the destination buffer per -element. It is well defined to have concurrent reads and writes to both source -and destination provided those reads and writes are at least unordered atomic. +element. It is well defined to have concurrent reads and writes to both source and +destination provided those reads and writes are unordered atomic when specified. This intrinsic does not provide any additional ordering guarantees over those provided by a set of unordered loads from the source location and stores to the @@ -14063,8 +14136,8 @@ destination. Lowering: """"""""" -In the most general case call to the '``llvm.memcpy.element.atomic.*``' is lowered -to a call to the symbol ``__llvm_memcpy_element_atomic_*``. Where '*' is replaced -with an actual element size. +In the most general case call to the '``llvm.memcpy.element.unordered.atomic.*``' is +lowered to a call to the symbol ``__llvm_memcpy_element_unordered_atomic_*``. Where '*' +is replaced with an actual element size. -Optimizer is allowed to inline memory copy when it's profitable to do so. +The optimizer is allowed to inline the memory copy when it's profitable to do so. Modified: vendor/llvm/dist/docs/Lexicon.rst ============================================================================== --- vendor/llvm/dist/docs/Lexicon.rst Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/docs/Lexicon.rst Fri Jun 16 21:03:24 2017 (r320013) @@ -109,6 +109,13 @@ G Garbage Collection. The practice of using reachability analysis instead of explicit memory management to reclaim unused memory. +**GVN** + Global Value Numbering. GVN is a pass that partitions values computed by a + function into congruence classes. Values ending up in the same congruence + class are guaranteed to be the same for every execution of the program. + In that respect, congruency is a compile-time approximation of equivalence + of values at runtime. + H - Modified: vendor/llvm/dist/docs/Phabricator.rst ============================================================================== --- vendor/llvm/dist/docs/Phabricator.rst Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/docs/Phabricator.rst Fri Jun 16 21:03:24 2017 (r320013) @@ -54,7 +54,8 @@ reviewer understand your code. To get a full diff, use one of the following commands (or just use Arcanist to upload your patch): -* ``git diff -U999999 other-branch`` +* ``git show HEAD -U999999 > mypatch.patch`` +* ``git format-patch -U999999 @{u}`` * ``svn diff --diff-cmd=diff -x -U999999`` To upload a new patch: Modified: vendor/llvm/dist/include/llvm/ADT/AllocatorList.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/AllocatorList.h Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/include/llvm/ADT/AllocatorList.h Fri Jun 16 21:03:24 2017 (r320013) @@ -10,10 +10,16 @@ #ifndef LLVM_ADT_ALLOCATORLIST_H #define LLVM_ADT_ALLOCATORLIST_H +#include "llvm/ADT/ilist_node.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/simple_ilist.h" #include "llvm/Support/Allocator.h" +#include +#include +#include +#include #include +#include namespace llvm { @@ -39,7 +45,8 @@ template class AllocatorLi T V; }; - typedef simple_ilist list_type; + using list_type = simple_ilist; + list_type List; AllocatorT &getAlloc() { return *this; } @@ -51,13 +58,17 @@ template class AllocatorLi struct Cloner { AllocatorList &AL; + Cloner(AllocatorList &AL) : AL(AL) {} + Node *operator()(const Node &N) const { return AL.create(N.V); } }; struct Disposer { AllocatorList &AL; + Disposer(AllocatorList &AL) : AL(AL) {} + void operator()(Node *N) const { N->~Node(); AL.getAlloc().Deallocate(N); @@ -65,13 +76,13 @@ template class AllocatorLi }; public: - typedef T value_type; - typedef T *pointer; - typedef T &reference; - typedef const T *const_pointer; - typedef const T &const_reference; - typedef typename list_type::size_type size_type; - typedef typename list_type::difference_type difference_type; + using value_type = T; + using pointer = T *; + using reference = T &; + using const_pointer = const T *; + using const_reference = const T &; + using size_type = typename list_type::size_type; + using difference_type = typename list_type::difference_type; private: template @@ -83,20 +94,18 @@ template class AllocatorLi friend class IteratorImpl; friend AllocatorList; - typedef iterator_adaptor_base, - IteratorBase, std::bidirectional_iterator_tag, - ValueT> - base_type; + using base_type = + iterator_adaptor_base, IteratorBase, + std::bidirectional_iterator_tag, ValueT>; public: - typedef ValueT value_type; - typedef ValueT *pointer; - typedef ValueT &reference; + using value_type = ValueT; + using pointer = ValueT *; + using reference = ValueT &; IteratorImpl() = default; IteratorImpl(const IteratorImpl &) = default; IteratorImpl &operator=(const IteratorImpl &) = default; - ~IteratorImpl() = default; explicit IteratorImpl(const IteratorBase &I) : base_type(I) {} @@ -106,6 +115,8 @@ template class AllocatorLi OtherIteratorBase, IteratorBase>::value>::type * = nullptr) : base_type(X.wrapped()) {} + ~IteratorImpl() = default; + reference operator*() const { return base_type::wrapped()->V; } pointer operator->() const { return &operator*(); } @@ -118,30 +129,34 @@ template class AllocatorLi }; public: - typedef IteratorImpl iterator; - typedef IteratorImpl - reverse_iterator; - typedef IteratorImpl - const_iterator; - typedef IteratorImpl - const_reverse_iterator; + using iterator = IteratorImpl; + using reverse_iterator = + IteratorImpl; + using const_iterator = + IteratorImpl; + using const_reverse_iterator = + IteratorImpl; AllocatorList() = default; AllocatorList(AllocatorList &&X) : AllocatorT(std::move(X.getAlloc())), List(std::move(X.List)) {} + AllocatorList(const AllocatorList &X) { List.cloneFrom(X.List, Cloner(*this), Disposer(*this)); } + AllocatorList &operator=(AllocatorList &&X) { clear(); // Dispose of current nodes explicitly. List = std::move(X.List); getAlloc() = std::move(X.getAlloc()); return *this; } + AllocatorList &operator=(const AllocatorList &X) { List.cloneFrom(X.List, Cloner(*this), Disposer(*this)); return *this; } + ~AllocatorList() { clear(); } void swap(AllocatorList &RHS) { Modified: vendor/llvm/dist/include/llvm/ADT/ArrayRef.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/ArrayRef.h Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/include/llvm/ADT/ArrayRef.h Fri Jun 16 21:03:24 2017 (r320013) @@ -1,4 +1,4 @@ -//===--- ArrayRef.h - Array Reference Wrapper -------------------*- C++ -*-===// +//===- ArrayRef.h - Array Reference Wrapper ---------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,12 +12,21 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/None.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Compiler.h" +#include #include +#include +#include +#include +#include +#include +#include #include namespace llvm { + /// ArrayRef - Represent a constant reference to an array (0 or more elements /// consecutively in memory), i.e. a start pointer and a length. It allows /// various APIs to take consecutive elements easily and conveniently. @@ -32,28 +41,27 @@ namespace llvm { template class LLVM_NODISCARD ArrayRef { public: - typedef const T *iterator; - typedef const T *const_iterator; - typedef size_t size_type; + using iterator = const T *; + using const_iterator = const T *; + using size_type = size_t; + using reverse_iterator = std::reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - private: /// The start of the array, in an external buffer. - const T *Data; + const T *Data = nullptr; /// The number of elements. - size_type Length; + size_type Length = 0; public: /// @name Constructors /// @{ /// Construct an empty ArrayRef. - /*implicit*/ ArrayRef() : Data(nullptr), Length(0) {} + /*implicit*/ ArrayRef() = default; /// Construct an empty ArrayRef from None. - /*implicit*/ ArrayRef(NoneType) : Data(nullptr), Length(0) {} + /*implicit*/ ArrayRef(NoneType) {} /// Construct an ArrayRef from a single element. /*implicit*/ ArrayRef(const T &OneElt) @@ -282,10 +290,9 @@ namespace llvm { template class LLVM_NODISCARD MutableArrayRef : public ArrayRef { public: - typedef T *iterator; + using iterator = T *; + using reverse_iterator = std::reverse_iterator; - typedef std::reverse_iterator reverse_iterator; - /// Construct an empty MutableArrayRef. /*implicit*/ MutableArrayRef() : ArrayRef() {} @@ -416,19 +423,23 @@ namespace llvm { /// This is a MutableArrayRef that owns its array. template class OwningArrayRef : public MutableArrayRef { public: - OwningArrayRef() {} + OwningArrayRef() = default; OwningArrayRef(size_t Size) : MutableArrayRef(new T[Size], Size) {} + OwningArrayRef(ArrayRef Data) : MutableArrayRef(new T[Data.size()], Data.size()) { std::copy(Data.begin(), Data.end(), this->begin()); } + OwningArrayRef(OwningArrayRef &&Other) { *this = Other; } + OwningArrayRef &operator=(OwningArrayRef &&Other) { delete[] this->data(); this->MutableArrayRef::operator=(Other); Other.MutableArrayRef::operator=(MutableArrayRef()); return *this; } + ~OwningArrayRef() { delete[] this->data(); } }; @@ -517,13 +528,14 @@ namespace llvm { // ArrayRefs can be treated like a POD type. template struct isPodLike; - template struct isPodLike > { + template struct isPodLike> { static const bool value = true; }; template hash_code hash_value(ArrayRef S) { return hash_combine_range(S.begin(), S.end()); } + } // end namespace llvm #endif // LLVM_ADT_ARRAYREF_H Modified: vendor/llvm/dist/include/llvm/ADT/BreadthFirstIterator.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/BreadthFirstIterator.h Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/include/llvm/ADT/BreadthFirstIterator.h Fri Jun 16 21:03:24 2017 (r320013) @@ -25,7 +25,6 @@ #include "llvm/ADT/iterator_range.h" #include #include -#include #include namespace llvm { @@ -49,13 +48,13 @@ template , public bf_iterator_storage { - typedef std::iterator super; + using super = std::iterator; - typedef typename GT::NodeRef NodeRef; - typedef typename GT::ChildIteratorType ChildItTy; + using NodeRef = typename GT::NodeRef; + using ChildItTy = typename GT::ChildIteratorType; // First element is the node reference, second is the next child to visit. - typedef std::pair> QueueElement; + using QueueElement = std::pair>; // Visit queue - used to maintain BFS ordering. // Optional<> because we need markers for levels. @@ -109,7 +108,7 @@ class bf_iterator (private) } public: - typedef typename super::pointer pointer; + using pointer = typename super::pointer; // Provide static begin and end methods as our public "constructors" static bf_iterator begin(const GraphT &G) { Modified: vendor/llvm/dist/include/llvm/ADT/DAGDeltaAlgorithm.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/DAGDeltaAlgorithm.h Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/include/llvm/ADT/DAGDeltaAlgorithm.h Fri Jun 16 21:03:24 2017 (r320013) @@ -1,4 +1,4 @@ -//===--- DAGDeltaAlgorithm.h - A DAG Minimization Algorithm ----*- C++ -*--===// +//===- DAGDeltaAlgorithm.h - A DAG Minimization Algorithm ------*- C++ -*--===// // // The LLVM Compiler Infrastructure // @@ -40,12 +40,12 @@ class DAGDeltaAlgorithm { virtual void anchor(); public: - typedef unsigned change_ty; - typedef std::pair edge_ty; + using change_ty = unsigned; + using edge_ty = std::pair; // FIXME: Use a decent data structure. - typedef std::set changeset_ty; - typedef std::vector changesetlist_ty; + using changeset_ty = std::set; + using changesetlist_ty = std::vector; public: virtual ~DAGDeltaAlgorithm() = default; Modified: vendor/llvm/dist/include/llvm/ADT/DeltaAlgorithm.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/DeltaAlgorithm.h Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/include/llvm/ADT/DeltaAlgorithm.h Fri Jun 16 21:03:24 2017 (r320013) @@ -1,4 +1,4 @@ -//===--- DeltaAlgorithm.h - A Set Minimization Algorithm -------*- C++ -*--===// +//===- DeltaAlgorithm.h - A Set Minimization Algorithm ---------*- C++ -*--===// // // The LLVM Compiler Infrastructure // @@ -35,10 +35,10 @@ namespace llvm { /// predicate. class DeltaAlgorithm { public: - typedef unsigned change_ty; + using change_ty = unsigned; // FIXME: Use a decent data structure. - typedef std::set changeset_ty; - typedef std::vector changesetlist_ty; + using changeset_ty = std::set; + using changesetlist_ty = std::vector; private: /// Cache of failed test results. Successful test results are never cached @@ -90,4 +90,4 @@ class DeltaAlgorithm { (public) } // end namespace llvm -#endif +#endif // LLVM_ADT_DELTAALGORITHM_H Modified: vendor/llvm/dist/include/llvm/ADT/DenseMap.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/DenseMap.h Fri Jun 16 20:47:12 2017 (r320012) +++ vendor/llvm/dist/include/llvm/ADT/DenseMap.h Fri Jun 16 21:03:24 2017 (r320013) @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include namespace llvm { @@ -57,14 +57,15 @@ class DenseMapBase : public DebugEpochBase { using const_arg_type_t = typename const_pointer_or_const_ref::type; public: - typedef unsigned size_type; - typedef KeyT key_type; - typedef ValueT mapped_type; - typedef BucketT value_type; + using size_type = unsigned; + using key_type = KeyT; + using mapped_type = ValueT; + using value_type = BucketT; - typedef DenseMapIterator iterator; - typedef DenseMapIterator - const_iterator; + using iterator = DenseMapIterator; + using const_iterator = + DenseMapIterator; + inline iterator begin() { // When the map is empty, avoid the overhead of AdvancePastEmptyBuckets(). return empty() ? end() : iterator(getBuckets(), getBucketsEnd(), *this); @@ -387,15 +388,18 @@ class DenseMapBase : public DebugEpochBase { static unsigned getHashValue(const KeyT &Val) { return KeyInfoT::getHashValue(Val); } + template static unsigned getHashValue(const LookupKeyT &Val) { return KeyInfoT::getHashValue(Val); } + static const KeyT getEmptyKey() { static_assert(std::is_base_of::value, "Must pass the derived type to this template!"); return KeyInfoT::getEmptyKey(); } + static const KeyT getTombstoneKey() { return KeyInfoT::getTombstoneKey(); } @@ -404,39 +408,51 @@ class DenseMapBase : public DebugEpochBase { unsigned getNumEntries() const { return static_cast(this)->getNumEntries(); } + void setNumEntries(unsigned Num) { static_cast(this)->setNumEntries(Num); } + void incrementNumEntries() { setNumEntries(getNumEntries() + 1); } + void decrementNumEntries() { setNumEntries(getNumEntries() - 1); } + unsigned getNumTombstones() const { return static_cast(this)->getNumTombstones(); } + void setNumTombstones(unsigned Num) { static_cast(this)->setNumTombstones(Num); } + void incrementNumTombstones() { setNumTombstones(getNumTombstones() + 1); } + void decrementNumTombstones() { setNumTombstones(getNumTombstones() - 1); } + const BucketT *getBuckets() const { return static_cast(this)->getBuckets(); } + BucketT *getBuckets() { return static_cast(this)->getBuckets(); } + unsigned getNumBuckets() const { return static_cast(this)->getNumBuckets(); } + BucketT *getBucketsEnd() { return getBuckets() + getNumBuckets(); } + const BucketT *getBucketsEnd() const { return getBuckets() + getNumBuckets(); } @@ -587,10 +603,11 @@ template > class DenseMap : public DenseMapBase, KeyT, ValueT, KeyInfoT, BucketT> { + friend class DenseMapBase; + // Lift some types from the dependent base class into this class for // simplicity of referring to them. - typedef DenseMapBase BaseT; - friend class DenseMapBase; + using BaseT = DenseMapBase; BucketT *Buckets; unsigned NumEntries; @@ -705,6 +722,7 @@ class DenseMap : public DenseMapBase, KeyT, ValueT, KeyInfoT, BucketT> { + friend class DenseMapBase; + // Lift some types from the dependent base class into this class for // simplicity of referring to them. - typedef DenseMapBase BaseT; - friend class DenseMapBase; + using BaseT = DenseMapBase; + static_assert(isPowerOf2_64(InlineBuckets), "InlineBuckets must be a power of 2."); @@ -972,6 +993,7 @@ class SmallDenseMap unsigned getNumEntries() const { return NumEntries; } + void setNumEntries(unsigned Num) { // NumEntries is hardcoded to be 31 bits wide. assert(Num < (1U << 31) && "Cannot support more than 1<<31 entries"); @@ -981,6 +1003,7 @@ class SmallDenseMap unsigned getNumTombstones() const { return NumTombstones; } + void setNumTombstones(unsigned Num) { NumTombstones = Num; } @@ -992,15 +1015,18 @@ class SmallDenseMap // 'storage.buffer' static type is 'char *'. return reinterpret_cast(storage.buffer); } + BucketT *getInlineBuckets() { return const_cast( const_cast(this)->getInlineBuckets()); } + const LargeRep *getLargeRep() const { assert(!Small); // Note, same rule about aliasing as with getInlineBuckets. return reinterpret_cast(storage.buffer); } + LargeRep *getLargeRep() { return const_cast( const_cast(this)->getLargeRep()); @@ -1009,10 +1035,12 @@ class SmallDenseMap const BucketT *getBuckets() const { return Small ? getInlineBuckets() : getLargeRep()->Buckets; } + BucketT *getBuckets() { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:03:48 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87B71D891B3; Fri, 16 Jun 2017 21:03:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D3E86F5C4; Fri, 16 Jun 2017 21:03:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL3kiF063466; Fri, 16 Jun 2017 21:03:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL3iT6063442; Fri, 16 Jun 2017 21:03:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162103.v5GL3iT6063442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320015 - in vendor/clang/dist: docs include/clang/Basic include/clang/Format include/clang/Frontend include/clang/Lex include/clang/Sema lib/AST lib/CodeGen lib/Driver/ToolChains lib/F... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:03:48 -0000 Author: dim Date: Fri Jun 16 21:03:44 2017 New Revision: 320015 URL: https://svnweb.freebsd.org/changeset/base/320015 Log: Vendor import of clang trunk r305575: https://llvm.org/svn/llvm-project/cfe/trunk@305575 Added: vendor/clang/dist/test/CodeGen/Inputs/thinlto-multi-module.ll vendor/clang/dist/test/CodeGen/mips-debug-info-bitfield.c (contents, props changed) vendor/clang/dist/test/CodeGen/ubsan-volatile.c (contents, props changed) vendor/clang/dist/test/Misc/pr32207.c (contents, props changed) vendor/clang/dist/test/Sema/xray-log-args-class.cpp (contents, props changed) vendor/clang/dist/test/SemaCXX/co_await-range-for.cpp (contents, props changed) Modified: vendor/clang/dist/docs/ClangFormatStyleOptions.rst vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/docs/UndefinedBehaviorSanitizer.rst vendor/clang/dist/include/clang/Basic/AllDiagnostics.h vendor/clang/dist/include/clang/Basic/BuiltinsPPC.def vendor/clang/dist/include/clang/Basic/DiagnosticSerializationKinds.td vendor/clang/dist/include/clang/Format/Format.h vendor/clang/dist/include/clang/Frontend/FrontendOptions.h vendor/clang/dist/include/clang/Lex/MacroArgs.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/ExprClassification.cpp vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/AST/ItaniumMangle.cpp vendor/clang/dist/lib/AST/ODRHash.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist/lib/CodeGen/CGCall.cpp vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.h vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Format/Format.cpp vendor/clang/dist/lib/Format/NamespaceEndCommentsFixer.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.cpp vendor/clang/dist/lib/Format/UnwrappedLineParser.cpp vendor/clang/dist/lib/Format/WhitespaceManager.h vendor/clang/dist/lib/Frontend/ASTConsumers.cpp vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Index/IndexDecl.cpp vendor/clang/dist/lib/Index/IndexSymbol.cpp vendor/clang/dist/lib/Lex/MacroArgs.cpp vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp vendor/clang/dist/lib/Sema/SemaCoroutine.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaExprCXX.cpp vendor/clang/dist/lib/Sema/SemaLambda.cpp vendor/clang/dist/lib/Sema/SemaStmt.cpp vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTReaderDecl.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/CallEvent.cpp vendor/clang/dist/test/Analysis/DynamicTypePropagation.m vendor/clang/dist/test/Analysis/analyzer_test.py vendor/clang/dist/test/CodeCompletion/member-access.cpp vendor/clang/dist/test/CodeGen/attributes.c vendor/clang/dist/test/CodeGen/avx-builtins.c vendor/clang/dist/test/CodeGen/builtins-ppc-error.c vendor/clang/dist/test/CodeGen/dependent-lib.c vendor/clang/dist/test/CodeGen/linker-option.c vendor/clang/dist/test/CodeGen/pragma-comment.c vendor/clang/dist/test/CodeGen/pragma-detect_mismatch.c vendor/clang/dist/test/CodeGen/thinlto-backend-option.ll vendor/clang/dist/test/CodeGen/thinlto-multi-module.ll vendor/clang/dist/test/CodeGen/ubsan-pointer-overflow.m vendor/clang/dist/test/CodeGenCXX/ms-thread_local.cpp vendor/clang/dist/test/CodeGenCoroutines/coro-await.cpp vendor/clang/dist/test/CodeGenObjC/availability-cf-link-guard.m vendor/clang/dist/test/Coverage/ast-printing.c vendor/clang/dist/test/Coverage/ast-printing.cpp vendor/clang/dist/test/Driver/m_and_mm.c vendor/clang/dist/test/Index/Core/index-source.cpp vendor/clang/dist/test/Index/availability.c vendor/clang/dist/test/Modules/autolink.m vendor/clang/dist/test/Modules/autolinkTBD.m vendor/clang/dist/test/Modules/module-impl-with-link.c vendor/clang/dist/test/Modules/odr_hash.cpp vendor/clang/dist/test/Sema/integer-overflow.c vendor/clang/dist/test/SemaCXX/cxx1z-decomposition.cpp vendor/clang/dist/test/SemaCXX/nested-name-spec.cpp vendor/clang/dist/test/SemaCXX/warn-unused-lambda-capture.cpp vendor/clang/dist/tools/clang-format/git-clang-format vendor/clang/dist/tools/libclang/CIndex.cpp vendor/clang/dist/unittests/AST/CommentLexer.cpp vendor/clang/dist/unittests/ASTMatchers/ASTMatchersTest.h vendor/clang/dist/unittests/Basic/VirtualFileSystemTest.cpp vendor/clang/dist/unittests/Format/FormatTest.cpp vendor/clang/dist/unittests/Format/NamespaceEndCommentsFixerTest.cpp vendor/clang/dist/unittests/Lex/LexerTest.cpp vendor/clang/dist/unittests/Tooling/LookupTest.cpp Modified: vendor/clang/dist/docs/ClangFormatStyleOptions.rst ============================================================================== --- vendor/clang/dist/docs/ClangFormatStyleOptions.rst Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/docs/ClangFormatStyleOptions.rst Fri Jun 16 21:03:44 2017 (r320015) @@ -521,12 +521,12 @@ the configuration (without a prefix: ``Auto``). .. code-block:: c++ true: - class foo {}; - - false: class foo {}; + false: + class foo {}; + * ``bool AfterControlStatement`` Wrap control statements (``if``/``for``/``while``/``switch``/..). .. code-block:: c++ @@ -603,12 +603,12 @@ the configuration (without a prefix: ``Auto``). struct foo { int x; - } + }; false: struct foo { int x; - } + }; * ``bool AfterUnion`` Wrap union definitions. Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/docs/ReleaseNotes.rst Fri Jun 16 21:03:44 2017 (r320015) @@ -187,6 +187,31 @@ Static Analyzer ... +Undefined Behavior Sanitizer (UBSan) +------------------------------------ + +- The Undefined Behavior Sanitizer has a new check for pointer overflow. This + check is on by default. The flag to control this functionality is + -fsanitize=pointer-overflow. + + Pointer overflow is an indicator of undefined behavior: when a pointer + indexing expression wraps around the address space, or produces other + unexpected results, its result may not point to a valid object. + +- UBSan has several new checks which detect violations of nullability + annotations. These checks are off by default. The flag to control this group + of checks is -fsanitize=nullability. The checks can be individially enabled + by -fsanitize=nullability-arg (which checks calls), + -fsanitize=nullability-assign (which checks assignments), and + -fsanitize=nullability-return (which checks return statements). + +- UBSan can now detect invalid loads from bitfields and from ObjC BOOLs. + +- UBSan can now avoid emitting unnecessary type checks in C++ class methods and + in several other cases where the result is known at compile-time. UBSan can + also avoid emitting unnecessary overflow checks in arithmetic expressions + with promoted integer operands. + Core Analysis Improvements ========================== Modified: vendor/clang/dist/docs/UndefinedBehaviorSanitizer.rst ============================================================================== --- vendor/clang/dist/docs/UndefinedBehaviorSanitizer.rst Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/docs/UndefinedBehaviorSanitizer.rst Fri Jun 16 21:03:44 2017 (r320015) @@ -148,6 +148,12 @@ You can also use the following check groups: nullability does not have undefined behavior, it is often unintentional, so UBSan offers to catch it. +Volatile +-------- + +The ``null``, ``alignment``, ``object-size``, and ``vptr`` checks do not apply +to pointers to types with the ``volatile`` qualifier. + Stack traces and report symbolization ===================================== If you want UBSan to print symbolized stack trace for each error report, you Modified: vendor/clang/dist/include/clang/Basic/AllDiagnostics.h ============================================================================== --- vendor/clang/dist/include/clang/Basic/AllDiagnostics.h Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Basic/AllDiagnostics.h Fri Jun 16 21:03:44 2017 (r320015) @@ -28,7 +28,7 @@ namespace clang { template class StringSizerHelper { - char FIELD_TOO_SMALL[SizeOfStr <= FieldType(~0U) ? 1 : -1]; + static_assert(SizeOfStr <= FieldType(~0U), "Field too small!"); public: enum { Size = SizeOfStr }; }; Modified: vendor/clang/dist/include/clang/Basic/BuiltinsPPC.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/BuiltinsPPC.def Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Basic/BuiltinsPPC.def Fri Jun 16 21:03:44 2017 (r320015) @@ -51,10 +51,10 @@ BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "") BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "") -BUILTIN(__builtin_altivec_vcfsx, "V4fV4ii", "") -BUILTIN(__builtin_altivec_vcfux, "V4fV4ii", "") -BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fi", "") -BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "") +BUILTIN(__builtin_altivec_vcfsx, "V4fV4iIi", "") +BUILTIN(__builtin_altivec_vcfux, "V4fV4iIi", "") +BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fIi", "") +BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fIi", "") BUILTIN(__builtin_altivec_dss, "vUi", "") BUILTIN(__builtin_altivec_dssall, "v", "") Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSerializationKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSerializationKinds.td Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSerializationKinds.td Fri Jun 16 21:03:44 2017 (r320015) @@ -121,10 +121,12 @@ def err_module_odr_violation_mismatch_decl : Error< "%q0 has different definitions in different modules; first difference is " "%select{definition in module '%2'|defined here}1 found " "%select{end of class|public access specifier|private access specifier|" - "protected access specifier|static assert|field|method}3">; + "protected access specifier|static assert|field|method|type alias|typedef|" + "data member}3">; def note_module_odr_violation_mismatch_decl : Note<"but in '%0' found " "%select{end of class|public access specifier|private access specifier|" - "protected access specifier|static assert|field|method}1">; + "protected access specifier|static assert|field|method|type alias|typedef|" + "data member}1">; def err_module_odr_violation_mismatch_decl_diff : Error< "%q0 has different definitions in different modules; first difference is " @@ -149,7 +151,17 @@ def err_module_odr_violation_mismatch_decl_diff : Erro "method %4 is %select{not inline|inline}5|" "method %4 that has %5 parameter%s5|" "method %4 with %ordinal5 parameter of type %6%select{| decayed from %8}7|" - "method %4 with %ordinal5 parameter named %6}3">; + "method %4 with %ordinal5 parameter named %6|" + "method %4 with %ordinal5 parameter with%select{out|}6 a default argument|" + "method %4 with %ordinal5 parameter with a default argument|" + "%select{typedef|type alias}4 name %5|" + "%select{typedef|type alias}4 %5 with underlying type %6|" + "data member with name %4|" + "data member %4 with type %5|" + "data member %4 with%select{out|}5 an initializer|" + "data member %4 with an initializer|" + "data member %4 %select{is constexpr|is not constexpr}5|" + "}3">; def note_module_odr_violation_mismatch_decl_diff : Note<"but in '%0' found " "%select{" @@ -172,15 +184,27 @@ def note_module_odr_violation_mismatch_decl_diff : Not "method %2 is %select{not inline|inline}3|" "method %2 that has %3 parameter%s3|" "method %2 with %ordinal3 parameter of type %4%select{| decayed from %6}5|" - "method %2 with %ordinal3 parameter named %4}1">; + "method %2 with %ordinal3 parameter named %4|" + "method %2 with %ordinal3 parameter with%select{out|}4 a default argument|" + "method %2 with %ordinal3 parameter with a different default argument|" + "%select{typedef|type alias}2 name %3|" + "%select{typedef|type alias}2 %3 with different underlying type %4|" + "data member with name %2|" + "data member %2 with different type %3|" + "data member %2 with%select{out|}3 an initializer|" + "data member %2 with a different initializer|" + "data member %2 %select{is constexpr|is not constexpr}3|" + "}1">; def err_module_odr_violation_mismatch_decl_unknown : Error< "%q0 %select{with definition in module '%2'|defined here}1 has different " "definitions in different modules; first difference is this " - "%select{||||static assert|field|method|unexpected decl}3">; + "%select{||||static assert|field|method|type alias|typedef|data member|" + "unexpected decl}3">; def note_module_odr_violation_mismatch_decl_unknown : Note< "but in '%0' found " "%select{||||different static assert|different field|different method|" + "different type alias|different typedef|different data member|" "another unexpected decl}1">; def warn_duplicate_module_file_extension : Warning< Modified: vendor/clang/dist/include/clang/Format/Format.h ============================================================================== --- vendor/clang/dist/include/clang/Format/Format.h Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Format/Format.h Fri Jun 16 21:03:44 2017 (r320015) @@ -688,6 +688,18 @@ struct FormatStyle { bool BeforeElse; /// \brief Indent the wrapped braces themselves. bool IndentBraces; + /// \brief If ``false``, empty function body can be put on a single line. + /// This option is used only if the opening brace of the function has + /// already been wrapped, i.e. the `AfterFunction` brace wrapping mode is + /// set, and the function could/should not be put on a single line (as per + /// `AllowShortFunctionsOnASingleLine` and constructor formatting options). + /// \code + /// int f() vs. inf f() + /// {} { + /// } + /// \endcode + /// + bool SplitEmptyFunctionBody; }; /// \brief Control of individual brace wrapping cases. @@ -779,6 +791,29 @@ struct FormatStyle { /// \endcode bool BreakBeforeInheritanceComma; + /// \brief If ``true``, consecutive namespace declarations will be on the same + /// line. If ``false``, each namespace is declared on a new line. + /// \code + /// true: + /// namespace Foo { namespace Bar { + /// }} + /// + /// false: + /// namespace Foo { + /// namespace Bar { + /// } + /// } + /// \endcode + /// + /// If it does not fit on a single line, the overflowing namespaces get + /// wrapped: + /// \code + /// namespace Foo { namespace Bar { + /// namespace Extra { + /// }}} + /// \endcode + bool CompactNamespaces; + /// \brief If the constructor initializers don't fit on a line, put each /// initializer on its own line. /// \code @@ -1410,6 +1445,7 @@ struct FormatStyle { BreakBeforeBraces == R.BreakBeforeBraces && BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators && BreakConstructorInitializers == R.BreakConstructorInitializers && + CompactNamespaces == R.CompactNamespaces && BreakAfterJavaFieldAnnotations == R.BreakAfterJavaFieldAnnotations && BreakStringLiterals == R.BreakStringLiterals && ColumnLimit == R.ColumnLimit && CommentPragmas == R.CommentPragmas && Modified: vendor/clang/dist/include/clang/Frontend/FrontendOptions.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/FrontendOptions.h Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Frontend/FrontendOptions.h Fri Jun 16 21:03:44 2017 (r320015) @@ -317,8 +317,8 @@ class FrontendOptions { (public) /// \brief Auxiliary triple for CUDA compilation. std::string AuxTriple; - /// \brief If non-empty, search the pch input file as it was a header - // included by this file. + /// \brief If non-empty, search the pch input file as if it was a header + /// included by this file. std::string FindPchSource; /// Filename to write statistics to. Modified: vendor/clang/dist/include/clang/Lex/MacroArgs.h ============================================================================== --- vendor/clang/dist/include/clang/Lex/MacroArgs.h Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Lex/MacroArgs.h Fri Jun 16 21:03:44 2017 (r320015) @@ -53,9 +53,12 @@ class MacroArgs { /// Preprocessor owns which we use to avoid thrashing malloc/free. MacroArgs *ArgCache; - MacroArgs(unsigned NumToks, bool varargsElided) - : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided), - ArgCache(nullptr) {} + /// MacroArgs - The number of arguments the invoked macro expects. + unsigned NumMacroArgs; + + MacroArgs(unsigned NumToks, bool varargsElided, unsigned MacroArgs) + : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided), + ArgCache(nullptr), NumMacroArgs(MacroArgs) {} ~MacroArgs() = default; public: @@ -94,10 +97,9 @@ class MacroArgs { SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd); - /// getNumArguments - Return the number of arguments passed into this macro - /// invocation. - unsigned getNumArguments() const { return NumUnexpArgTokens; } - + /// getNumMacroArguments - Return the number of arguments the invoked macro + /// expects. + unsigned getNumMacroArguments() const { return NumMacroArgs; } /// isVarargsElidedUse - Return true if this is a C99 style varargs macro /// invocation and there was no argument specified for the "..." argument. If Modified: vendor/clang/dist/include/clang/Sema/Sema.h ============================================================================== --- vendor/clang/dist/include/clang/Sema/Sema.h Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/include/clang/Sema/Sema.h Fri Jun 16 21:03:44 2017 (r320015) @@ -8364,6 +8364,8 @@ class Sema { (public) //===--------------------------------------------------------------------===// // C++ Coroutines TS // + bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, + StringRef Keyword); ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E); ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E); StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E); Modified: vendor/clang/dist/lib/AST/ASTContext.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ASTContext.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/AST/ASTContext.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -3565,7 +3565,7 @@ QualType ASTContext::getSubstTemplateTypeParmPackType( = new (*this, TypeAlignment) SubstTemplateTypeParmPackType(Parm, Canon, ArgPack); Types.push_back(SubstParm); - SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos); + SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos); return QualType(SubstParm, 0); } @@ -8547,6 +8547,7 @@ static QualType DecodeTypeFromStr(const char *&Str, co HowLong = 2; break; } + break; } } Modified: vendor/clang/dist/lib/AST/ExprClassification.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ExprClassification.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/AST/ExprClassification.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -190,7 +190,6 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, con case Expr::ArrayInitIndexExprClass: case Expr::NoInitExprClass: case Expr::DesignatedInitUpdateExprClass: - case Expr::CoyieldExprClass: return Cl::CL_PRValue; // Next come the complicated cases. @@ -414,7 +413,8 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, con return ClassifyInternal(Ctx, cast(E)->getInit(0)); case Expr::CoawaitExprClass: - return ClassifyInternal(Ctx, cast(E)->getResumeExpr()); + case Expr::CoyieldExprClass: + return ClassifyInternal(Ctx, cast(E)->getResumeExpr()); } llvm_unreachable("unhandled expression kind in classification"); Modified: vendor/clang/dist/lib/AST/ExprConstant.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ExprConstant.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/AST/ExprConstant.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -4588,7 +4588,7 @@ class ExprEvaluatorBase (public) } bool handleCallExpr(const CallExpr *E, APValue &Result, - const LValue *ResultSlot) { + const LValue *ResultSlot) { const Expr *Callee = E->getCallee()->IgnoreParens(); QualType CalleeType = Callee->getType(); @@ -4597,23 +4597,6 @@ class ExprEvaluatorBase (public) auto Args = llvm::makeArrayRef(E->getArgs(), E->getNumArgs()); bool HasQualifier = false; - struct EvaluateIgnoredRAII { - public: - EvaluateIgnoredRAII(EvalInfo &Info, llvm::ArrayRef ToEval) - : Info(Info), ToEval(ToEval) {} - ~EvaluateIgnoredRAII() { - if (Info.noteFailure()) { - for (auto E : ToEval) - EvaluateIgnoredValue(Info, E); - } - } - void cancel() { ToEval = {}; } - void drop_front() { ToEval = ToEval.drop_front(); } - private: - EvalInfo &Info; - llvm::ArrayRef ToEval; - } EvalArguments(Info, Args); - // Extract function decl and 'this' pointer from the callee. if (CalleeType->isSpecificBuiltinType(BuiltinType::BoundMember)) { const ValueDecl *Member = nullptr; @@ -4663,12 +4646,10 @@ class ExprEvaluatorBase (public) if (Args.empty()) return Error(E); - const Expr *FirstArg = Args[0]; - Args = Args.drop_front(); - EvalArguments.drop_front(); - if (!EvaluateObjectArgument(Info, FirstArg, ThisVal)) + if (!EvaluateObjectArgument(Info, Args[0], ThisVal)) return false; This = &ThisVal; + Args = Args.slice(1); } else if (MD && MD->isLambdaStaticInvoker()) { // Map the static invoker for the lambda back to the call operator. // Conveniently, we don't have to slice out the 'this' argument (as is @@ -4720,12 +4701,8 @@ class ExprEvaluatorBase (public) const FunctionDecl *Definition = nullptr; Stmt *Body = FD->getBody(Definition); - if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body)) - return false; - - EvalArguments.cancel(); - - if (!HandleFunctionCall(E->getExprLoc(), Definition, This, Args, Body, Info, + if (!CheckConstexprFunction(Info, E->getExprLoc(), FD, Definition, Body) || + !HandleFunctionCall(E->getExprLoc(), Definition, This, Args, Body, Info, Result, ResultSlot)) return false; Modified: vendor/clang/dist/lib/AST/ItaniumMangle.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ItaniumMangle.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/AST/ItaniumMangle.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -4550,9 +4550,11 @@ CXXNameMangler::makeFunctionReturnTypeTags(const Funct const FunctionProtoType *Proto = cast(FD->getType()->getAs()); + FunctionTypeDepthState saved = TrackReturnTypeTags.FunctionTypeDepth.push(); TrackReturnTypeTags.FunctionTypeDepth.enterResultType(); TrackReturnTypeTags.mangleType(Proto->getReturnType()); TrackReturnTypeTags.FunctionTypeDepth.leaveResultType(); + TrackReturnTypeTags.FunctionTypeDepth.pop(saved); return TrackReturnTypeTags.AbiTagsRoot.getSortedUniqueUsedAbiTags(); } Modified: vendor/clang/dist/lib/AST/ODRHash.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ODRHash.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/AST/ODRHash.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -140,7 +140,33 @@ void ODRHash::AddTemplateName(TemplateName Name) { } } -void ODRHash::AddTemplateArgument(TemplateArgument TA) {} +void ODRHash::AddTemplateArgument(TemplateArgument TA) { + const auto Kind = TA.getKind(); + ID.AddInteger(Kind); + + switch (Kind) { + case TemplateArgument::Null: + case TemplateArgument::Type: + case TemplateArgument::Declaration: + case TemplateArgument::NullPtr: + case TemplateArgument::Integral: + break; + case TemplateArgument::Template: + case TemplateArgument::TemplateExpansion: + AddTemplateName(TA.getAsTemplateOrTemplatePattern()); + break; + case TemplateArgument::Expression: + AddStmt(TA.getAsExpr()); + break; + case TemplateArgument::Pack: + ID.AddInteger(TA.pack_size()); + for (auto SubTA : TA.pack_elements()) { + AddTemplateArgument(SubTA); + } + break; + } +} + void ODRHash::AddTemplateParameterList(const TemplateParameterList *TPL) {} void ODRHash::clear() { @@ -226,6 +252,17 @@ class ODRDeclVisitor : public ConstDeclVisitorisStaticLocal()); + Hash.AddBoolean(D->isConstexpr()); + const bool HasInit = D->hasInit(); + Hash.AddBoolean(HasInit); + if (HasInit) { + AddStmt(D->getInit()); + } + Inherited::VisitVarDecl(D); + } + void VisitParmVarDecl(const ParmVarDecl *D) { // TODO: Handle default arguments. Inherited::VisitParmVarDecl(D); @@ -310,6 +347,7 @@ bool ODRHash::isWhitelistedDecl(const Decl *D, const C case Decl::StaticAssert: case Decl::TypeAlias: case Decl::Typedef: + case Decl::Var: return true; } } @@ -526,6 +564,13 @@ class ODRTypeVisitor : public TypeVisitorgetTemplateName()); VisitType(T); + } + + void VisitTemplateTypeParmType(const TemplateTypeParmType *T) { + ID.AddInteger(T->getDepth()); + ID.AddInteger(T->getIndex()); + Hash.AddBoolean(T->isParameterPack()); + AddDecl(T->getDecl()); } }; Modified: vendor/clang/dist/lib/CodeGen/BackendUtil.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -964,11 +964,11 @@ Expected clang::FindThinLTOModule(Memor if (!BMsOrErr) return BMsOrErr.takeError(); - // The bitcode file may contain multiple modules, we want the one with a - // summary. + // The bitcode file may contain multiple modules, we want the one that is + // marked as being the ThinLTO module. for (BitcodeModule &BM : *BMsOrErr) { - Expected HasSummary = BM.hasSummary(); - if (HasSummary && *HasSummary) + Expected LTOInfo = BM.getLTOInfo(); + if (LTOInfo && LTOInfo->IsThinLTO) return BM; } Modified: vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -7923,6 +7923,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned Bu } // We can't handle 8-31 immediates with native IR, use the intrinsic. + // Except for predicates that create constants. Intrinsic::ID ID; switch (BuiltinID) { default: llvm_unreachable("Unsupported intrinsic!"); @@ -7930,12 +7931,32 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned Bu ID = Intrinsic::x86_sse_cmp_ps; break; case X86::BI__builtin_ia32_cmpps256: + // _CMP_TRUE_UQ, _CMP_TRUE_US produce -1,-1... vector + // on any input and _CMP_FALSE_OQ, _CMP_FALSE_OS produce 0, 0... + if (CC == 0xf || CC == 0xb || CC == 0x1b || CC == 0x1f) { + Value *Constant = (CC == 0xf || CC == 0x1f) ? + llvm::Constant::getAllOnesValue(Builder.getInt32Ty()) : + llvm::Constant::getNullValue(Builder.getInt32Ty()); + Value *Vec = Builder.CreateVectorSplat( + Ops[0]->getType()->getVectorNumElements(), Constant); + return Builder.CreateBitCast(Vec, Ops[0]->getType()); + } ID = Intrinsic::x86_avx_cmp_ps_256; break; case X86::BI__builtin_ia32_cmppd: ID = Intrinsic::x86_sse2_cmp_pd; break; case X86::BI__builtin_ia32_cmppd256: + // _CMP_TRUE_UQ, _CMP_TRUE_US produce -1,-1... vector + // on any input and _CMP_FALSE_OQ, _CMP_FALSE_OS produce 0, 0... + if (CC == 0xf || CC == 0xb || CC == 0x1b || CC == 0x1f) { + Value *Constant = (CC == 0xf || CC == 0x1f) ? + llvm::Constant::getAllOnesValue(Builder.getInt64Ty()) : + llvm::Constant::getNullValue(Builder.getInt64Ty()); + Value *Vec = Builder.CreateVectorSplat( + Ops[0]->getType()->getVectorNumElements(), Constant); + return Builder.CreateBitCast(Vec, Ops[0]->getType()); + } ID = Intrinsic::x86_avx_cmp_pd_256; break; } Modified: vendor/clang/dist/lib/CodeGen/CGCall.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGCall.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/CGCall.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -1795,6 +1795,8 @@ void CodeGenModule::ConstructAttributeList( FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); if (TargetDecl->hasAttr()) FuncAttrs.addAttribute(llvm::Attribute::NoReturn); + if (TargetDecl->hasAttr()) + FuncAttrs.addAttribute(llvm::Attribute::Cold); if (TargetDecl->hasAttr()) FuncAttrs.addAttribute(llvm::Attribute::NoDuplicate); if (TargetDecl->hasAttr()) Modified: vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -148,25 +148,18 @@ static SmallString<32> buildSuspendPrefixStr(CGCoroDat // // See llvm's docs/Coroutines.rst for more details. // -static RValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Coro, +namespace { + struct LValueOrRValue { + LValue LV; + RValue RV; + }; +} +static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Coro, CoroutineSuspendExpr const &S, AwaitKind Kind, AggValueSlot aggSlot, - bool ignoreResult) { + bool ignoreResult, bool forLValue) { auto *E = S.getCommonExpr(); - // FIXME: rsmith 5/22/2017. Does it still make sense for us to have a - // UO_Coawait at all? As I recall, the only purpose it ever had was to - // represent a dependent co_await expression that couldn't yet be resolved to - // a CoawaitExpr. But now we have (and need!) a separate DependentCoawaitExpr - // node to store unqualified lookup results, it seems that the UnaryOperator - // portion of the representation serves no purpose (and as seen in this patch, - // it's getting in the way). Can we remove it? - - // Skip passthrough operator co_await (present when awaiting on an LValue). - if (auto *UO = dyn_cast(E)) - if (UO->getOpcode() == UO_Coawait) - E = UO->getSubExpr(); - auto Binder = CodeGenFunction::OpaqueValueMappingData::bind(CGF, S.getOpaqueValue(), E); auto UnbindOnExit = llvm::make_scope_exit([&] { Binder.unbind(CGF); }); @@ -217,7 +210,12 @@ static RValue emitSuspendExpression(CodeGenFunction &C // Emit await_resume expression. CGF.EmitBlock(ReadyBlock); - return CGF.EmitAnyExpr(S.getResumeExpr(), aggSlot, ignoreResult); + LValueOrRValue Res; + if (forLValue) + Res.LV = CGF.EmitLValue(S.getResumeExpr()); + else + Res.RV = CGF.EmitAnyExpr(S.getResumeExpr(), aggSlot, ignoreResult); + return Res; } RValue CodeGenFunction::EmitCoawaitExpr(const CoawaitExpr &E, @@ -225,19 +223,51 @@ RValue CodeGenFunction::EmitCoawaitExpr(const CoawaitE bool ignoreResult) { return emitSuspendExpression(*this, *CurCoro.Data, E, CurCoro.Data->CurrentAwaitKind, aggSlot, - ignoreResult); + ignoreResult, /*forLValue*/false).RV; } RValue CodeGenFunction::EmitCoyieldExpr(const CoyieldExpr &E, AggValueSlot aggSlot, bool ignoreResult) { return emitSuspendExpression(*this, *CurCoro.Data, E, AwaitKind::Yield, - aggSlot, ignoreResult); + aggSlot, ignoreResult, /*forLValue*/false).RV; } void CodeGenFunction::EmitCoreturnStmt(CoreturnStmt const &S) { ++CurCoro.Data->CoreturnCount; EmitStmt(S.getPromiseCall()); EmitBranchThroughCleanup(CurCoro.Data->FinalJD); +} + + +#ifndef NDEBUG +static QualType getCoroutineSuspendExprReturnType(const ASTContext &Ctx, + const CoroutineSuspendExpr *E) { + const auto *RE = E->getResumeExpr(); + // Is it possible for RE to be a CXXBindTemporaryExpr wrapping + // a MemberCallExpr? + assert(isa(RE) && "unexpected suspend expression type"); + return cast(RE)->getCallReturnType(Ctx); +} +#endif + +LValue +CodeGenFunction::EmitCoawaitLValue(const CoawaitExpr *E) { + assert(getCoroutineSuspendExprReturnType(getContext(), E)->isReferenceType() && + "Can't have a scalar return unless the return type is a " + "reference type!"); + return emitSuspendExpression(*this, *CurCoro.Data, *E, + CurCoro.Data->CurrentAwaitKind, AggValueSlot::ignored(), + /*ignoreResult*/false, /*forLValue*/true).LV; +} + +LValue +CodeGenFunction::EmitCoyieldLValue(const CoyieldExpr *E) { + assert(getCoroutineSuspendExprReturnType(getContext(), E)->isReferenceType() && + "Can't have a scalar return unless the return type is a " + "reference type!"); + return emitSuspendExpression(*this, *CurCoro.Data, *E, + AwaitKind::Yield, AggValueSlot::ignored(), + /*ignoreResult*/false, /*forLValue*/true).LV; } // Hunts for the parameter reference in the parameter copy/move declaration. Modified: vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -1041,7 +1041,13 @@ llvm::DIType *CGDebugInfo::createBitFieldType(const Fi assert(SizeInBits > 0 && "found named 0-width bitfield"); uint64_t StorageOffsetInBits = CGM.getContext().toBits(BitFieldInfo.StorageOffset); - uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset; + uint64_t Offset = BitFieldInfo.Offset; + // The bit offsets for big endian machines are reversed for big + // endian target, compensate for that as the DIDerivedType requires + // un-reversed offsets. + if (CGM.getDataLayout().isBigEndian()) + Offset = BitFieldInfo.StorageSize - BitFieldInfo.Size - Offset; + uint64_t OffsetInBits = StorageOffsetInBits + Offset; llvm::DINode::DIFlags Flags = getAccessFlag(BitFieldDecl->getAccess(), RD); return DBuilder.createBitFieldMemberType( RecordTy, Name, File, Line, SizeInBits, OffsetInBits, StorageOffsetInBits, @@ -3484,13 +3490,13 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm: if (VD->hasAttr()) { // Here, we need an offset *into* the alloca. CharUnits offset = CharUnits::fromQuantity(32); - Expr.push_back(llvm::dwarf::DW_OP_plus); + Expr.push_back(llvm::dwarf::DW_OP_plus_uconst); // offset of __forwarding field offset = CGM.getContext().toCharUnitsFromBits( CGM.getTarget().getPointerWidth(0)); Expr.push_back(offset.getQuantity()); Expr.push_back(llvm::dwarf::DW_OP_deref); - Expr.push_back(llvm::dwarf::DW_OP_plus); + Expr.push_back(llvm::dwarf::DW_OP_plus_uconst); // offset of x field offset = CGM.getContext().toCharUnitsFromBits(XOffset); Expr.push_back(offset.getQuantity()); @@ -3599,17 +3605,17 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable( SmallVector addr; addr.push_back(llvm::dwarf::DW_OP_deref); - addr.push_back(llvm::dwarf::DW_OP_plus); + addr.push_back(llvm::dwarf::DW_OP_plus_uconst); addr.push_back(offset.getQuantity()); if (isByRef) { addr.push_back(llvm::dwarf::DW_OP_deref); - addr.push_back(llvm::dwarf::DW_OP_plus); + addr.push_back(llvm::dwarf::DW_OP_plus_uconst); // offset of __forwarding field offset = CGM.getContext().toCharUnitsFromBits(target.getPointerSizeInBits(0)); addr.push_back(offset.getQuantity()); addr.push_back(llvm::dwarf::DW_OP_deref); - addr.push_back(llvm::dwarf::DW_OP_plus); + addr.push_back(llvm::dwarf::DW_OP_plus_uconst); // offset of x field offset = CGM.getContext().toCharUnitsFromBits(XOffset); addr.push_back(offset.getQuantity()); Modified: vendor/clang/dist/lib/CodeGen/CGExpr.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGExpr.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/CGExpr.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -549,6 +549,11 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, if (Ptr->getType()->getPointerAddressSpace()) return; + // Don't check pointers to volatile data. The behavior here is implementation- + // defined. + if (Ty.isVolatileQualified()) + return; + SanitizerScope SanScope(this); SmallVector, 3> Checks; @@ -1158,6 +1163,11 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) { case Expr::MaterializeTemporaryExprClass: return EmitMaterializeTemporaryExpr(cast(E)); + + case Expr::CoawaitExprClass: + return EmitCoawaitLValue(cast(E)); + case Expr::CoyieldExprClass: + return EmitCoyieldLValue(cast(E)); } } @@ -3002,10 +3012,11 @@ static llvm::Value *emitArraySubscriptGEP(CodeGenFunct llvm::Value *ptr, ArrayRef indices, bool inbounds, + bool signedIndices, SourceLocation loc, const llvm::Twine &name = "arrayidx") { if (inbounds) { - return CGF.EmitCheckedInBoundsGEP(ptr, indices, loc, name); + return CGF.EmitCheckedInBoundsGEP(ptr, indices, signedIndices, loc, name); } else { return CGF.Builder.CreateGEP(ptr, indices, name); } @@ -3038,7 +3049,7 @@ static QualType getFixedSizeElementType(const ASTConte static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr, ArrayRef indices, QualType eltType, bool inbounds, - SourceLocation loc, + bool signedIndices, SourceLocation loc, const llvm::Twine &name = "arrayidx") { // All the indices except that last must be zero. #ifndef NDEBUG @@ -3058,8 +3069,8 @@ static Address emitArraySubscriptGEP(CodeGenFunction & CharUnits eltAlign = getArrayElementAlign(addr.getAlignment(), indices.back(), eltSize); - llvm::Value *eltPtr = - emitArraySubscriptGEP(CGF, addr.getPointer(), indices, inbounds, loc, name); + llvm::Value *eltPtr = emitArraySubscriptGEP( + CGF, addr.getPointer(), indices, inbounds, signedIndices, loc, name); return Address(eltPtr, eltAlign); } @@ -3069,6 +3080,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A // in lexical order (this complexity is, sadly, required by C++17). llvm::Value *IdxPre = (E->getLHS() == E->getIdx()) ? EmitScalarExpr(E->getIdx()) : nullptr; + bool SignedIndices = false; auto EmitIdxAfterBase = [&, IdxPre](bool Promote) -> llvm::Value * { auto *Idx = IdxPre; if (E->getLHS() != E->getIdx()) { @@ -3078,6 +3090,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A QualType IdxTy = E->getIdx()->getType(); bool IdxSigned = IdxTy->isSignedIntegerOrEnumerationType(); + SignedIndices |= IdxSigned; if (SanOpts.has(SanitizerKind::ArrayBounds)) EmitBoundsCheck(E, E->getBase(), Idx, IdxTy, Accessed); @@ -3113,7 +3126,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A QualType EltType = LV.getType()->castAs()->getElementType(); Addr = emitArraySubscriptGEP(*this, Addr, Idx, EltType, /*inbounds*/ true, - E->getExprLoc()); + SignedIndices, E->getExprLoc()); return MakeAddrLValue(Addr, EltType, LV.getBaseInfo()); } @@ -3142,7 +3155,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A Addr = emitArraySubscriptGEP(*this, Addr, Idx, vla->getElementType(), !getLangOpts().isSignedOverflowDefined(), - E->getExprLoc()); + SignedIndices, E->getExprLoc()); } else if (const ObjCObjectType *OIT = E->getType()->getAs()){ // Indexing over an interface, as in "NSString *P; P[4];" @@ -3167,8 +3180,9 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A // Do the GEP. CharUnits EltAlign = getArrayElementAlign(Addr.getAlignment(), Idx, InterfaceSize); - llvm::Value *EltPtr = emitArraySubscriptGEP( - *this, Addr.getPointer(), ScaledIdx, false, E->getExprLoc()); + llvm::Value *EltPtr = + emitArraySubscriptGEP(*this, Addr.getPointer(), ScaledIdx, false, + SignedIndices, E->getExprLoc()); Addr = Address(EltPtr, EltAlign); // Cast back. @@ -3190,11 +3204,10 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A auto *Idx = EmitIdxAfterBase(/*Promote*/true); // Propagate the alignment from the array itself to the result. - Addr = emitArraySubscriptGEP(*this, ArrayLV.getAddress(), - {CGM.getSize(CharUnits::Zero()), Idx}, - E->getType(), - !getLangOpts().isSignedOverflowDefined(), - E->getExprLoc()); + Addr = emitArraySubscriptGEP( + *this, ArrayLV.getAddress(), {CGM.getSize(CharUnits::Zero()), Idx}, + E->getType(), !getLangOpts().isSignedOverflowDefined(), SignedIndices, + E->getExprLoc()); BaseInfo = ArrayLV.getBaseInfo(); } else { // The base must be a pointer; emit it with an estimate of its alignment. @@ -3202,7 +3215,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const A auto *Idx = EmitIdxAfterBase(/*Promote*/true); Addr = emitArraySubscriptGEP(*this, Addr, Idx, E->getType(), !getLangOpts().isSignedOverflowDefined(), - E->getExprLoc()); + SignedIndices, E->getExprLoc()); } LValue LV = MakeAddrLValue(Addr, E->getType(), BaseInfo); @@ -3375,7 +3388,7 @@ LValue CodeGenFunction::EmitOMPArraySectionExpr(const Idx = Builder.CreateNSWMul(Idx, NumElements); EltPtr = emitArraySubscriptGEP(*this, Base, Idx, VLA->getElementType(), !getLangOpts().isSignedOverflowDefined(), - E->getExprLoc()); + /*SignedIndices=*/false, E->getExprLoc()); } else if (const Expr *Array = isSimpleArrayDecayOperand(E->getBase())) { // If this is A[i] where A is an array, the frontend will have decayed the // base to be a ArrayToPointerDecay implicit cast. While correct, it is @@ -3395,14 +3408,14 @@ LValue CodeGenFunction::EmitOMPArraySectionExpr(const EltPtr = emitArraySubscriptGEP( *this, ArrayLV.getAddress(), {CGM.getSize(CharUnits::Zero()), Idx}, ResultExprTy, !getLangOpts().isSignedOverflowDefined(), - E->getExprLoc()); + /*SignedIndices=*/false, E->getExprLoc()); BaseInfo = ArrayLV.getBaseInfo(); } else { Address Base = emitOMPArraySectionBase(*this, E->getBase(), BaseInfo, BaseTy, ResultExprTy, IsLowerBound); EltPtr = emitArraySubscriptGEP(*this, Base, Idx, ResultExprTy, !getLangOpts().isSignedOverflowDefined(), - E->getExprLoc()); + /*SignedIndices=*/false, E->getExprLoc()); } return MakeAddrLValue(EltPtr, ResultExprTy, BaseInfo); Modified: vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp Fri Jun 16 21:03:31 2017 (r320014) +++ vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp Fri Jun 16 21:03:44 2017 (r320015) @@ -1851,6 +1851,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const Unary llvm::Value *input; int amount = (isInc ? 1 : -1); + bool signedIndex = !isInc; if (const AtomicType *atomicTy = type->getAs()) { type = atomicTy->getValueType(); @@ -1940,8 +1941,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const Unary if (CGF.getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, numElts, "vla.inc"); else - value = CGF.EmitCheckedInBoundsGEP(value, numElts, E->getExprLoc(), - "vla.inc"); + value = CGF.EmitCheckedInBoundsGEP(value, numElts, signedIndex, + E->getExprLoc(), "vla.inc"); // Arithmetic on function pointers (!) is just +-1. } else if (type->isFunctionType()) { @@ -1951,8 +1952,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const Unary if (CGF.getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, amt, "incdec.funcptr"); else - value = CGF.EmitCheckedInBoundsGEP(value, amt, E->getExprLoc(), - "incdec.funcptr"); + value = CGF.EmitCheckedInBoundsGEP(value, amt, signedIndex, + E->getExprLoc(), "incdec.funcptr"); value = Builder.CreateBitCast(value, input->getType()); // For everything else, we can just do a simple increment. @@ -1961,8 +1962,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const Unary if (CGF.getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, amt, "incdec.ptr"); else - value = CGF.EmitCheckedInBoundsGEP(value, amt, E->getExprLoc(), - "incdec.ptr"); + value = CGF.EmitCheckedInBoundsGEP(value, amt, signedIndex, + E->getExprLoc(), "incdec.ptr"); } // Vector increment/decrement. @@ -2043,8 +2044,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const Unary if (CGF.getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, sizeValue, "incdec.objptr"); else - value = CGF.EmitCheckedInBoundsGEP(value, sizeValue, E->getExprLoc(), - "incdec.objptr"); + value = CGF.EmitCheckedInBoundsGEP(value, sizeValue, signedIndex, + E->getExprLoc(), "incdec.objptr"); value = Builder.CreateBitCast(value, input->getType()); } @@ -2661,13 +2662,15 @@ static Value *emitPointerArithmetic(CodeGenFunction &C std::swap(pointerOperand, indexOperand); } + bool isSigned = indexOperand->getType()->isSignedIntegerOrEnumerationType(); + bool mayHaveNegativeGEPIndex = isSigned || isSubtraction; + unsigned width = cast(index->getType())->getBitWidth(); auto &DL = CGF.CGM.getDataLayout(); auto PtrTy = cast(pointer->getType()); if (width != DL.getTypeSizeInBits(PtrTy)) { // Zero-extend or sign-extend the pointer value according to // whether the index is signed or not. - bool isSigned = indexOperand->getType()->isSignedIntegerOrEnumerationType(); index = CGF.Builder.CreateIntCast(index, DL.getIntPtrType(PtrTy), isSigned, "idx.ext"); } @@ -2711,8 +2714,9 @@ static Value *emitPointerArithmetic(CodeGenFunction &C pointer = CGF.Builder.CreateGEP(pointer, index, "add.ptr"); } else { index = CGF.Builder.CreateNSWMul(index, numElements, "vla.index"); - pointer = CGF.EmitCheckedInBoundsGEP(pointer, index, op.E->getExprLoc(), - "add.ptr"); + pointer = + CGF.EmitCheckedInBoundsGEP(pointer, index, mayHaveNegativeGEPIndex, + op.E->getExprLoc(), "add.ptr"); } return pointer; } @@ -2729,8 +2733,8 @@ static Value *emitPointerArithmetic(CodeGenFunction &C if (CGF.getLangOpts().isSignedOverflowDefined()) return CGF.Builder.CreateGEP(pointer, index, "add.ptr"); - return CGF.EmitCheckedInBoundsGEP(pointer, index, op.E->getExprLoc(), - "add.ptr"); + return CGF.EmitCheckedInBoundsGEP(pointer, index, mayHaveNegativeGEPIndex, + op.E->getExprLoc(), "add.ptr"); } // Construct an fmuladd intrinsic to represent a fused mul-add of MulOp and @@ -3848,6 +3852,7 @@ LValue CodeGenFunction::EmitCompoundAssignmentLValue( Value *CodeGenFunction::EmitCheckedInBoundsGEP(Value *Ptr, ArrayRef IdxList, + bool SignedIndices, SourceLocation Loc, const Twine &Name) { Value *GEPVal = Builder.CreateInBoundsGEP(Ptr, IdxList, Name); @@ -3905,7 +3910,7 @@ Value *CodeGenFunction::EmitCheckedInBoundsGEP(Value * auto *ResultAndOverflow = Builder.CreateCall( (Opcode == BO_Add) ? SAddIntrinsic : SMulIntrinsic, {LHS, RHS}); OffsetOverflows = Builder.CreateOr( - OffsetOverflows, Builder.CreateExtractValue(ResultAndOverflow, 1)); + Builder.CreateExtractValue(ResultAndOverflow, 1), OffsetOverflows); return Builder.CreateExtractValue(ResultAndOverflow, 0); }; @@ -3951,12 +3956,18 @@ Value *CodeGenFunction::EmitCheckedInBoundsGEP(Value * // 1) The total offset doesn't overflow, and // 2) The sign of the difference between the computed address and the base // pointer matches the sign of the total offset. - llvm::Value *PosOrZeroValid = Builder.CreateICmpUGE(ComputedGEP, IntPtr); - llvm::Value *NegValid = Builder.CreateICmpULT(ComputedGEP, IntPtr); - auto *PosOrZeroOffset = Builder.CreateICmpSGE(TotalOffset, Zero); - llvm::Value *ValidGEP = Builder.CreateAnd( - Builder.CreateNot(OffsetOverflows), - Builder.CreateSelect(PosOrZeroOffset, PosOrZeroValid, NegValid)); + llvm::Value *ValidGEP; + auto *NoOffsetOverflow = Builder.CreateNot(OffsetOverflows); + auto *PosOrZeroValid = Builder.CreateICmpUGE(ComputedGEP, IntPtr); + if (SignedIndices) { + auto *PosOrZeroOffset = Builder.CreateICmpSGE(TotalOffset, Zero); + llvm::Value *NegValid = Builder.CreateICmpULT(ComputedGEP, IntPtr); + ValidGEP = Builder.CreateAnd( *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:03:57 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5870D891FC; Fri, 16 Jun 2017 21:03:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 967F36F696; Fri, 16 Jun 2017 21:03:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL3uki063592; Fri, 16 Jun 2017 21:03:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL3rvO063560; Fri, 16 Jun 2017 21:03:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162103.v5GL3rvO063560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:03:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320017 - in vendor/compiler-rt/dist: lib/asan lib/sanitizer_common lib/tsan/rtl lib/ubsan test/asan/TestCases/Linux test/asan/TestCases/Posix test/cfi/cross-dso test/cfi/cross-dso/ical... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:03:58 -0000 Author: dim Date: Fri Jun 16 21:03:53 2017 New Revision: 320017 URL: https://svnweb.freebsd.org/changeset/base/320017 Log: Vendor import of compiler-rt trunk r305575: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305575 Added: vendor/compiler-rt/dist/test/asan/TestCases/Linux/allocator_oom_test.cc (contents, props changed) vendor/compiler-rt/dist/test/cfi/icall/wrong-signature-mixed-lto.c (contents, props changed) vendor/compiler-rt/dist/test/tsan/custom_mutex3.cc (contents, props changed) vendor/compiler-rt/dist/test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp (contents, props changed) vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/ vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp (contents, props changed) vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg vendor/compiler-rt/dist/test/xray/TestCases/Linux/arg1-logging-implicit-this.cc (contents, props changed) Modified: vendor/compiler-rt/dist/lib/asan/asan_allocator.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_combined.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_secondary.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_sync.h vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_itanium.cc vendor/compiler-rt/dist/test/asan/TestCases/Posix/allow_user_segv.cc vendor/compiler-rt/dist/test/cfi/cross-dso/icall/lit.local.cfg vendor/compiler-rt/dist/test/cfi/cross-dso/stats.cpp vendor/compiler-rt/dist/test/cfi/icall/lit.local.cfg vendor/compiler-rt/dist/test/tsan/custom_mutex.h vendor/compiler-rt/dist/test/tsan/custom_mutex0.cc vendor/compiler-rt/dist/test/tsan/custom_mutex1.cc vendor/compiler-rt/dist/test/tsan/custom_mutex2.cc vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/PR33221.cpp Modified: vendor/compiler-rt/dist/lib/asan/asan_allocator.cc ============================================================================== --- vendor/compiler-rt/dist/lib/asan/asan_allocator.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/asan/asan_allocator.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -235,6 +235,8 @@ struct Allocator { AllocatorCache fallback_allocator_cache; QuarantineCache fallback_quarantine_cache; + atomic_uint8_t rss_limit_exceeded; + // ------------------- Options -------------------------- atomic_uint16_t min_redzone; atomic_uint16_t max_redzone; @@ -268,6 +270,14 @@ struct Allocator { SharedInitCode(options); } + bool RssLimitExceeded() { + return atomic_load(&rss_limit_exceeded, memory_order_relaxed); + } + + void SetRssLimitExceeded(bool limit_exceeded) { + atomic_store(&rss_limit_exceeded, limit_exceeded, memory_order_relaxed); + } + void RePoisonChunk(uptr chunk) { // This could be a user-facing chunk (with redzones), or some internal // housekeeping chunk, like TransferBatch. Start by assuming the former. @@ -363,6 +373,8 @@ struct Allocator { AllocType alloc_type, bool can_fill) { if (UNLIKELY(!asan_inited)) AsanInitFromRtl(); + if (RssLimitExceeded()) + return allocator.ReturnNullOrDieOnOOM(); Flags &fl = *flags(); CHECK(stack); const uptr min_alignment = SHADOW_GRANULARITY; @@ -400,16 +412,15 @@ struct Allocator { AsanThread *t = GetCurrentThread(); void *allocated; - bool check_rss_limit = true; if (t) { AllocatorCache *cache = GetAllocatorCache(&t->malloc_storage()); allocated = - allocator.Allocate(cache, needed_size, 8, false, check_rss_limit); + allocator.Allocate(cache, needed_size, 8, false); } else { SpinMutexLock l(&fallback_mutex); AllocatorCache *cache = &fallback_allocator_cache; allocated = - allocator.Allocate(cache, needed_size, 8, false, check_rss_limit); + allocator.Allocate(cache, needed_size, 8, false); } if (!allocated) return allocator.ReturnNullOrDieOnOOM(); @@ -866,8 +877,8 @@ void asan_mz_force_unlock() { instance.ForceUnlock(); } -void AsanSoftRssLimitExceededCallback(bool exceeded) { - instance.allocator.SetRssLimitIsExceeded(exceeded); +void AsanSoftRssLimitExceededCallback(bool limit_exceeded) { + instance.SetRssLimitExceeded(limit_exceeded); } } // namespace __asan Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_combined.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_combined.h Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_combined.h Fri Jun 16 21:03:53 2017 (r320017) @@ -43,12 +43,12 @@ class CombinedAllocator { } void *Allocate(AllocatorCache *cache, uptr size, uptr alignment, - bool cleared = false, bool check_rss_limit = false) { + bool cleared = false) { // Returning 0 on malloc(0) may break a lot of code. if (size == 0) size = 1; - if (size + alignment < size) return ReturnNullOrDieOnBadRequest(); - if (check_rss_limit && RssLimitIsExceeded()) return ReturnNullOrDieOnOOM(); + if (size + alignment < size) + return ReturnNullOrDieOnBadRequest(); uptr original_size = size; // If alignment requirements are to be fulfilled by the frontend allocator // rather than by the primary or secondary, passing an alignment lower than @@ -89,7 +89,8 @@ class CombinedAllocator { } void *ReturnNullOrDieOnOOM() { - if (MayReturnNull()) return nullptr; + if (MayReturnNull()) + return nullptr; ReportAllocatorCannotReturnNull(true); } @@ -106,15 +107,6 @@ class CombinedAllocator { primary_.SetReleaseToOSIntervalMs(release_to_os_interval_ms); } - bool RssLimitIsExceeded() { - return atomic_load(&rss_limit_is_exceeded_, memory_order_acquire); - } - - void SetRssLimitIsExceeded(bool rss_limit_is_exceeded) { - atomic_store(&rss_limit_is_exceeded_, rss_limit_is_exceeded, - memory_order_release); - } - void Deallocate(AllocatorCache *cache, void *p) { if (!p) return; if (primary_.PointerIsMine(p)) @@ -228,6 +220,5 @@ class CombinedAllocator { SecondaryAllocator secondary_; AllocatorGlobalStats stats_; atomic_uint8_t may_return_null_; - atomic_uint8_t rss_limit_is_exceeded_; }; Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_secondary.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_secondary.h Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_secondary.h Fri Jun 16 21:03:53 2017 (r320017) @@ -36,9 +36,12 @@ class LargeMmapAllocator { if (alignment > page_size_) map_size += alignment; // Overflow. - if (map_size < size) return ReturnNullOrDieOnBadRequest(); + if (map_size < size) + return ReturnNullOrDieOnBadRequest(); uptr map_beg = reinterpret_cast( - MmapOrDie(map_size, "LargeMmapAllocator")); + MmapOrDieOnFatalError(map_size, "LargeMmapAllocator")); + if (!map_beg) + return ReturnNullOrDieOnOOM(); CHECK(IsAligned(map_beg, page_size_)); MapUnmapCallback().OnMap(map_beg, map_size); uptr map_end = map_beg + map_size; Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h Fri Jun 16 21:03:53 2017 (r320017) @@ -85,6 +85,9 @@ INLINE void *MmapOrDieQuietly(uptr size, const char *m return MmapOrDie(size, mem_type, /*raw_report*/ true); } void UnmapOrDie(void *addr, uptr size); +// Behaves just like MmapOrDie, but tolerates out of memory condition, in that +// case returns nullptr. +void *MmapOrDieOnFatalError(uptr size, const char *mem_type); void *MmapFixedNoReserve(uptr fixed_addr, uptr size, const char *name = nullptr); void *MmapNoReserveOrDie(uptr size, const char *mem_type); Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc Fri Jun 16 21:03:53 2017 (r320017) @@ -93,6 +93,9 @@ COMMON_FLAG(HandleSignalMode, handle_sigill, kHandleSi COMMON_FLAG(HandleSignalMode, handle_sigfpe, kHandleSignalYes, COMMON_FLAG_HANDLE_SIGNAL_HELP(SIGFPE)) #undef COMMON_FLAG_HANDLE_SIGNAL_HELP +COMMON_FLAG(bool, allow_user_segv_handler, true, + "Deprecated. True has no effect, use handle_sigbus=1. If false, " + "handle_*=1 will be upgraded to handle_*=2.") COMMON_FLAG(bool, use_sigaltstack, true, "If set, uses alternate stack for signal handling.") COMMON_FLAG(bool, detect_deadlocks, false, Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -1396,7 +1396,7 @@ AndroidApiLevel AndroidGetApiLevel() { #endif -HandleSignalMode GetHandleSignalMode(int signum) { +static HandleSignalMode GetHandleSignalModeImpl(int signum) { switch (signum) { case SIGABRT: return common_flags()->handle_abort; @@ -1410,6 +1410,13 @@ HandleSignalMode GetHandleSignalMode(int signum) { return common_flags()->handle_sigbus; } return kHandleSignalNo; +} + +HandleSignalMode GetHandleSignalMode(int signum) { + HandleSignalMode result = GetHandleSignalModeImpl(signum); + if (result == kHandleSignalYes && !common_flags()->allow_user_segv_handler) + return kHandleSignalExclusive; + return result; } #if !SANITIZER_GO Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -113,7 +113,6 @@ void GetThreadStackTopAndBottom(bool at_initialization my_pthread_attr_getstack(&attr, &stackaddr, &stacksize); pthread_attr_destroy(&attr); - CHECK_LE(stacksize, kMaxThreadStackSize); // Sanity check. *stack_top = (uptr)stackaddr + stacksize; *stack_bottom = (uptr)stackaddr; } Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -414,10 +414,7 @@ void ListOfModules::init() { memory_mapping.DumpListOfModules(&modules_); } -HandleSignalMode GetHandleSignalMode(int signum) { - // Handling fatal signals on watchOS and tvOS devices is disallowed. - if ((SANITIZER_WATCHOS || SANITIZER_TVOS) && !(SANITIZER_IOSSIM)) - return kHandleSignalNo; +static HandleSignalMode GetHandleSignalModeImpl(int signum) { switch (signum) { case SIGABRT: return common_flags()->handle_abort; @@ -431,6 +428,16 @@ HandleSignalMode GetHandleSignalMode(int signum) { return common_flags()->handle_sigbus; } return kHandleSignalNo; +} + +HandleSignalMode GetHandleSignalMode(int signum) { + // Handling fatal signals on watchOS and tvOS devices is disallowed. + if ((SANITIZER_WATCHOS || SANITIZER_TVOS) && !(SANITIZER_IOSSIM)) + return kHandleSignalNo; + HandleSignalMode result = GetHandleSignalModeImpl(signum); + if (result == kHandleSignalYes && !common_flags()->allow_user_segv_handler) + return kHandleSignalExclusive; + return result; } MacosVersion cached_macos_version = MACOS_VERSION_UNINITIALIZED; Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -22,6 +22,7 @@ #include "sanitizer_procmaps.h" #include "sanitizer_stacktrace.h" +#include #include #include #include @@ -143,6 +144,21 @@ void UnmapOrDie(void *addr, uptr size) { CHECK("unable to unmap" && 0); } DecreaseTotalMmap(size); +} + +void *MmapOrDieOnFatalError(uptr size, const char *mem_type) { + size = RoundUpTo(size, GetPageSizeCached()); + uptr res = internal_mmap(nullptr, size, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANON, -1, 0); + int reserrno; + if (internal_iserror(res, &reserrno)) { + if (reserrno == ENOMEM) + return nullptr; + ReportMmapFailureAndDie(size, mem_type, "allocate", reserrno); + } + IncreaseTotalMmap(size); + return (void *)res; } // We want to map a chunk of address space aligned to 'alignment'. Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -131,6 +131,16 @@ void UnmapOrDie(void *addr, uptr size) { } } +void *MmapOrDieOnFatalError(uptr size, const char *mem_type) { + void *rv = VirtualAlloc(0, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + if (rv == 0) { + error_t last_error = GetLastError(); + if (last_error != ERROR_NOT_ENOUGH_MEMORY) + ReportMmapFailureAndDie(size, mem_type, "allocate", last_error); + } + return rv; +} + // We want to map a chunk of address space aligned to 'alignment'. void *MmapAlignedOrDie(uptr size, uptr alignment, const char *mem_type) { CHECK(IsPowerOfTwo(size)); Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -92,7 +92,8 @@ static const char *ReportTypeString(ReportType typ, up if (typ == ReportTypeVptrUseAfterFree) return "heap-use-after-free (virtual call vs free)"; if (typ == ReportTypeExternalRace) { - return GetReportHeaderFromTag(tag) ?: "race on external object"; + const char *str = GetReportHeaderFromTag(tag); + return str ? str : "race on external object"; } if (typ == ReportTypeThreadLeak) return "thread leak"; @@ -170,8 +171,9 @@ static void PrintMop(const ReportMop *mop, bool first) MopDesc(first, mop->write, mop->atomic), mop->size, (void *)mop->addr, thread_name(thrbuf, mop->tid)); } else { - const char *object_type = - GetObjectTypeFromTag(mop->external_tag) ?: "external object"; + const char *object_type = GetObjectTypeFromTag(mop->external_tag); + if (object_type == nullptr) + object_type = "external object"; Printf(" %s access of %s at %p by %s", ExternalMopDesc(first, mop->write), object_type, (void *)mop->addr, thread_name(thrbuf, mop->tid)); Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_sync.h ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_sync.h Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_sync.h Fri Jun 16 21:03:53 2017 (r320017) @@ -83,7 +83,7 @@ struct SyncVar { } bool IsFlagSet(u32 f) const { - return atomic_load_relaxed(&flags); + return atomic_load_relaxed(&flags) & f; } void SetFlags(u32 f) { Modified: vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc ============================================================================== --- vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -566,8 +566,14 @@ static void handlePointerOverflowImpl(PointerOverflowD ScopedReport R(Opts, Loc, ET); - Diag(Loc, DL_Error, "pointer index expression with base %0 overflowed to %1") - << (void *)Base << (void*)Result; + if ((sptr(Base) >= 0) == (sptr(Result) >= 0)) + Diag(Loc, DL_Error, "unsigned pointer index expression result is %0, " + "preceding its base %1") + << (void *)Result << (void *)Base; + else + Diag(Loc, DL_Error, + "pointer index expression with base %0 overflowed to %1") + << (void *)Base << (void *)Result; } void __ubsan::__ubsan_handle_pointer_overflow(PointerOverflowData *Data, Modified: vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_itanium.cc ============================================================================== --- vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_itanium.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_itanium.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -197,9 +197,9 @@ struct VtablePrefix { }; VtablePrefix *getVtablePrefix(void *Vtable) { VtablePrefix *Vptr = reinterpret_cast(Vtable); - if (!IsAccessibleMemoryRange((uptr)Vptr, sizeof(VtablePrefix))) - return nullptr; VtablePrefix *Prefix = Vptr - 1; + if (!IsAccessibleMemoryRange((uptr)Prefix, sizeof(VtablePrefix))) + return nullptr; if (!Prefix->TypeInfo) // This can't possibly be a valid vtable. return nullptr; Added: vendor/compiler-rt/dist/test/asan/TestCases/Linux/allocator_oom_test.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/asan/TestCases/Linux/allocator_oom_test.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,82 @@ +// Test the behavior of malloc/calloc/realloc when the allocation causes OOM +// in the secondary allocator. +// By default (allocator_may_return_null=0) the process should crash. +// With allocator_may_return_null=1 the allocator should return 0. +// Set the limit to 20.5T on 64 bits to account for ASan shadow memory, +// allocator buffers etc. so that the test allocation of ~1T will trigger OOM. +// Limit this test to Linux since we're relying on allocator internal +// limits (shadow memory size, allocation limits etc.) + +// RUN: %clangxx_asan -O0 %s -o %t +// RUN: ulimit -v 22024290304 +// RUN: not %run %t malloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-MALLOC,CHECK-CRASH +// RUN: %env_asan_opts=allocator_may_return_null=0 not %run %t malloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-MALLOC,CHECK-CRASH +// RUN: %env_asan_opts=allocator_may_return_null=1 %run %t malloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-MALLOC,CHECK-NULL +// RUN: %env_asan_opts=allocator_may_return_null=0 not %run %t calloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-CALLOC,CHECK-CRASH +// RUN: %env_asan_opts=allocator_may_return_null=1 %run %t calloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-CALLOC,CHECK-NULL +// RUN: %env_asan_opts=allocator_may_return_null=0 not %run %t realloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-REALLOC,CHECK-CRASH +// RUN: %env_asan_opts=allocator_may_return_null=1 %run %t realloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-REALLOC,CHECK-NULL +// RUN: %env_asan_opts=allocator_may_return_null=0 not %run %t realloc-after-malloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-MALLOC-REALLOC,CHECK-CRASH +// RUN: %env_asan_opts=allocator_may_return_null=1 %run %t realloc-after-malloc 2>&1 \ +// RUN: | FileCheck %s --check-prefixes=CHECK-MALLOC-REALLOC,CHECK-NULL + +#include +#include +#include +#include + +int main(int argc, char **argv) { + assert(argc == 2); + const char *action = argv[1]; + fprintf(stderr, "%s:\n", action); + + // Allocate just a bit less than max allocation size enforced by ASan's + // allocator (currently 1T and 3G). + const size_t size = +#if __LP64__ + (1ULL << 40) - (1ULL << 30); +#else + (3ULL << 30) - (1ULL << 20); +#endif + + void *x = 0; + + if (!strcmp(action, "malloc")) { + x = malloc(size); + } else if (!strcmp(action, "calloc")) { + x = calloc(size / 4, 4); + } else if (!strcmp(action, "realloc")) { + x = realloc(0, size); + } else if (!strcmp(action, "realloc-after-malloc")) { + char *t = (char*)malloc(100); + *t = 42; + x = realloc(t, size); + assert(*t == 42); + free(t); + } else { + assert(0); + } + + // The NULL pointer is printed differently on different systems, while (long)0 + // is always the same. + fprintf(stderr, "x: %lx\n", (long)x); + free(x); + + return x != 0; +} + +// CHECK-MALLOC: malloc: +// CHECK-CALLOC: calloc: +// CHECK-REALLOC: realloc: +// CHECK-MALLOC-REALLOC: realloc-after-malloc: + +// CHECK-CRASH: AddressSanitizer's allocator is terminating the process +// CHECK-NULL: x: 0 Modified: vendor/compiler-rt/dist/test/asan/TestCases/Posix/allow_user_segv.cc ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Posix/allow_user_segv.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/asan/TestCases/Posix/allow_user_segv.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -10,6 +10,14 @@ // RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=2 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 // RUN: %clangxx_asan -O2 %s -o %t && %env_asan_opts=handle_segv=2 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 +// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=0:allow_user_segv_handler=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0 +// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=1:allow_user_segv_handler=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 +// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=2:allow_user_segv_handler=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 + +// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=0:allow_user_segv_handler=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0 +// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=1:allow_user_segv_handler=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 +// RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_segv=2:allow_user_segv_handler=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 + #include #include #include Modified: vendor/compiler-rt/dist/test/cfi/cross-dso/icall/lit.local.cfg ============================================================================== --- vendor/compiler-rt/dist/test/cfi/cross-dso/icall/lit.local.cfg Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/cfi/cross-dso/icall/lit.local.cfg Fri Jun 16 21:03:53 2017 (r320017) @@ -1,6 +1,3 @@ # The cfi-icall checker is only supported on x86 and x86_64 for now. if config.root.host_arch not in ['x86', 'x86_64']: config.unsupported = True - -if config.root.use_thinlto: - config.unsupported = True Modified: vendor/compiler-rt/dist/test/cfi/cross-dso/stats.cpp ============================================================================== --- vendor/compiler-rt/dist/test/cfi/cross-dso/stats.cpp Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/cfi/cross-dso/stats.cpp Fri Jun 16 21:03:53 2017 (r320017) @@ -5,7 +5,6 @@ // CFI-icall is not implemented in thinlto mode => ".cfi" suffixes are missing // in sanstats output. -// XFAIL: thinlto struct ABase {}; Modified: vendor/compiler-rt/dist/test/cfi/icall/lit.local.cfg ============================================================================== --- vendor/compiler-rt/dist/test/cfi/icall/lit.local.cfg Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/cfi/icall/lit.local.cfg Fri Jun 16 21:03:53 2017 (r320017) @@ -1,6 +1,3 @@ # The cfi-icall checker is only supported on x86 and x86_64 for now. if config.root.host_arch not in ['x86', 'x86_64']: config.unsupported = True - -if config.use_thinlto: - config.unsupported = True Added: vendor/compiler-rt/dist/test/cfi/icall/wrong-signature-mixed-lto.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/cfi/icall/wrong-signature-mixed-lto.c Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,41 @@ +// Test that the checking is done with the actual type of f() even when the +// calling module has an incorrect declaration. Test a mix of lto types. +// +// -flto below overrides -flto=thin in %clang_cfi +// RUN: %clang_cfi %s -DMODULE_A -c -o %t1_a.o +// RUN: %clang_cfi %s -DMODULE_B -c -o %t1_b.o -flto +// RUN: %clang_cfi %t1_a.o %t1_b.o -o %t1 +// RUN: %expect_crash %t1 2>&1 | FileCheck --check-prefix=CFI %s +// +// RUN: %clang_cfi %s -DMODULE_A -c -o %t2_a.o -flto +// RUN: %clang_cfi %s -DMODULE_B -c -o %t2_b.o +// RUN: %clang_cfi %t2_a.o %t2_b.o -o %t2 +// RUN: %expect_crash %t2 2>&1 | FileCheck --check-prefix=CFI %s +// +// RUN: %clang_cfi %s -DMODULE_A -c -o %t3_a.o +// RUN: %clang_cfi %s -DMODULE_B -c -o %t3_b.o +// RUN: %clang_cfi %t3_a.o %t3_b.o -o %t3 +// RUN: %expect_crash %t3 2>&1 | FileCheck --check-prefix=CFI %s +// +// REQUIRES: thinlto + +#include + +#if defined(MODULE_B) +int f() { + return 42; +} +#elif defined(MODULE_A) +void f(); + +int main() { + // CFI: 1 + fprintf(stderr, "1\n"); + + void (*volatile p)() = &f; + p(); + + // CFI-NOT: 2 + fprintf(stderr, "2\n"); +} +#endif Modified: vendor/compiler-rt/dist/test/tsan/custom_mutex.h ============================================================================== --- vendor/compiler-rt/dist/test/tsan/custom_mutex.h Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/tsan/custom_mutex.h Fri Jun 16 21:03:53 2017 (r320017) @@ -6,11 +6,11 @@ // A very primitive mutex annotated with tsan annotations. class Mutex { public: - Mutex(bool prof = true) + Mutex(bool prof, unsigned flags) : prof_(prof) , locked_(false) , seq_(0) { - __tsan_mutex_create(this, 0); + __tsan_mutex_create(this, flags); } ~Mutex() { @@ -87,5 +87,5 @@ class Mutex { } }; -Mutex Mutex::prof_mu_(false); +Mutex Mutex::prof_mu_(false, __tsan_mutex_linker_init); int Mutex::prof_data_; Modified: vendor/compiler-rt/dist/test/tsan/custom_mutex0.cc ============================================================================== --- vendor/compiler-rt/dist/test/tsan/custom_mutex0.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/tsan/custom_mutex0.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -4,7 +4,7 @@ // Test that custom annoations provide normal mutex synchronization // (no race reports for properly protected critical sections). -Mutex mu; +Mutex mu(true, 0); long data; void *thr(void *arg) { Modified: vendor/compiler-rt/dist/test/tsan/custom_mutex1.cc ============================================================================== --- vendor/compiler-rt/dist/test/tsan/custom_mutex1.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/tsan/custom_mutex1.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -3,7 +3,7 @@ // Test that failed TryLock does not induce parasitic synchronization. -Mutex mu; +Mutex mu(true, 0); long data; void *thr(void *arg) { Modified: vendor/compiler-rt/dist/test/tsan/custom_mutex2.cc ============================================================================== --- vendor/compiler-rt/dist/test/tsan/custom_mutex2.cc Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/tsan/custom_mutex2.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -3,7 +3,7 @@ // Test that Broadcast does not induce parasitic synchronization. -Mutex mu; +Mutex mu(true, 0); long data; void *thr(void *arg) { Added: vendor/compiler-rt/dist/test/tsan/custom_mutex3.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/tsan/custom_mutex3.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,46 @@ +// RUN: %clangxx_tsan -O1 --std=c++11 %s -o %t +// RUN: %env_tsan_opts=report_destroy_locked=0 %run %t 2>&1 | FileCheck %s +#include "custom_mutex.h" + +// Regression test for a bug. +// Thr1 destroys a locked mutex, previously such mutex was not removed from +// sync map and as the result subsequent uses of a mutex located at the same +// address caused false race reports. + +Mutex mu(false, __tsan_mutex_write_reentrant); +long data; + +void *thr1(void *arg) { + mu.Lock(); + mu.~Mutex(); + new(&mu) Mutex(true, __tsan_mutex_write_reentrant); + return 0; +} + +void *thr2(void *arg) { + barrier_wait(&barrier); + mu.Lock(); + data++; + mu.Unlock(); + return 0; +} + +int main() { + barrier_init(&barrier, 2); + pthread_t th; + pthread_create(&th, 0, thr1, 0); + pthread_join(th, 0); + + barrier_init(&barrier, 2); + pthread_create(&th, 0, thr2, 0); + mu.Lock(); + data++; + mu.Unlock(); + barrier_wait(&barrier); + pthread_join(th, 0); + fprintf(stderr, "DONE\n"); + return 0; +} + +// CHECK-NOT: WARNING: ThreadSanitizer: data race +// CHECK: DONE Added: vendor/compiler-rt/dist/test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,13 @@ +// RUN: %clangxx -fsanitize=pointer-overflow %s -o %t +// RUN: %t 2>&1 | FileCheck %s + +int main(int argc, char *argv[]) { + char c; + char *p = &c; + unsigned long long offset = -1; + + // CHECK: unsigned-index-expression.cpp:[[@LINE+1]]:15: runtime error: unsigned pointer index expression result is 0x{{.*}}, preceding its base 0x{{.*}} + char *q = p + offset; + + return 0; +} Added: vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,50 @@ +// RUN: %clangxx -std=c++11 -frtti -fsanitize=vptr -g %s -O3 -o %t +// RUN: %run %t &> %t.log +// RUN: cat %t.log | not count 0 && FileCheck --input-file %t.log %s || cat %t.log | count 0 + +// REQUIRES: cxxabi + +#include +#include + +class Base { +public: + int i; + virtual void print() {} +}; + +class Derived : public Base { +public: + void print() {} +}; + + +int main() { + int page_size = getpagesize(); + + void *non_accessible = mmap(nullptr, page_size, PROT_NONE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + if (non_accessible == MAP_FAILED) + return 0; + + void *accessible = mmap((char*)non_accessible + page_size, page_size, + PROT_READ | PROT_WRITE, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (accessible == MAP_FAILED) + return 0; + + char *c = new char[sizeof(Derived)]; + + // The goal is to trigger a condition when Vptr points to accessible memory, + // but VptrPrefix does not. That has been triggering SIGSEGV in UBSan code. + void **vtable_ptr = reinterpret_cast(c); + *vtable_ptr = (void*)accessible; + + Derived *list = (Derived *)c; + +// CHECK: PR33221.cpp:[[@LINE+2]]:19: runtime error: member access within address {{.*}} which does not point to an object of type 'Base' +// CHECK-NEXT: invalid vptr + int foo = list->i; + return 0; +} Added: vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,9 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +root = getRoot(config) + +if root.host_os not in ['Linux']: + config.unsupported = True Modified: vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/PR33221.cpp ============================================================================== --- vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/PR33221.cpp Fri Jun 16 21:03:50 2017 (r320016) +++ vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/PR33221.cpp Fri Jun 16 21:03:53 2017 (r320017) @@ -18,7 +18,7 @@ class Derived : public Base { (public) int main() { char *c = new char[sizeof(Derived)]; - memset((void *)c, 0, sizeof(Derived)); + memset((void *)c, 0xFF, sizeof(Derived)); Derived *list = (Derived *)c; // CHECK: PR33221.cpp:[[@LINE+2]]:19: runtime error: member access within address {{.*}} which does not point to an object of type 'Base' Added: vendor/compiler-rt/dist/test/xray/TestCases/Linux/arg1-logging-implicit-this.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/xray/TestCases/Linux/arg1-logging-implicit-this.cc Fri Jun 16 21:03:53 2017 (r320017) @@ -0,0 +1,31 @@ +// Intercept the implicit 'this' argument of class member functions. +// +// RUN: %clangxx_xray -g -std=c++11 %s -o %t +// RUN: rm log-args-this-* || true +// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=log-args-this-" %run %t +// +// XFAIL: arm || aarch64 || mips +// UNSUPPORTED: powerpc64le +#include "xray/xray_interface.h" +#include + +class A { + public: + [[clang::xray_always_instrument, clang::xray_log_args(1)]] void f() { + // does nothing. + } +}; + +volatile uint64_t captured = 0; + +void handler(int32_t, XRayEntryType, uint64_t arg1) { + captured = arg1; +} + +int main() { + __xray_set_handler_arg1(handler); + A instance; + instance.f(); + __xray_remove_handler_arg1(); + assert(captured == (uint64_t)&instance); +} From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:03:51 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE4BCD891C9; Fri, 16 Jun 2017 21:03:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84F1A6F605; Fri, 16 Jun 2017 21:03:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL3o6J063514; Fri, 16 Jun 2017 21:03:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL3odq063513; Fri, 16 Jun 2017 21:03:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162103.v5GL3odq063513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320016 - vendor/clang/clang-trunk-r305575 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:03:51 -0000 Author: dim Date: Fri Jun 16 21:03:50 2017 New Revision: 320016 URL: https://svnweb.freebsd.org/changeset/base/320016 Log: Tag clang trunk r305575. Added: vendor/clang/clang-trunk-r305575/ - copied from r320015, vendor/clang/dist/ From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:01 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 626ECD89235; Fri, 16 Jun 2017 21:04:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AED86F6F0; Fri, 16 Jun 2017 21:04:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL40rM063643; Fri, 16 Jun 2017 21:04:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL40Wh063642; Fri, 16 Jun 2017 21:04:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL40Wh063642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320018 - vendor/compiler-rt/compiler-rt-trunk-r305575 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:01 -0000 Author: dim Date: Fri Jun 16 21:04:00 2017 New Revision: 320018 URL: https://svnweb.freebsd.org/changeset/base/320018 Log: Tag compiler-rt trunk r305575. Added: vendor/compiler-rt/compiler-rt-trunk-r305575/ - copied from r320017, vendor/compiler-rt/dist/ From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:08 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89D0ED89294; Fri, 16 Jun 2017 21:04:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BF006F7B6; Fri, 16 Jun 2017 21:04:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL47Rj063716; Fri, 16 Jun 2017 21:04:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL44xh063692; Fri, 16 Jun 2017 21:04:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL44xh063692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320019 - in vendor/libc++/dist: benchmarks include include/experimental include/support/newlib lib src src/experimental/filesystem test/libcxx test/libcxx/algorithms/alg.modifying.oper... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:08 -0000 Author: dim Date: Fri Jun 16 21:04:04 2017 New Revision: 320019 URL: https://svnweb.freebsd.org/changeset/base/320019 Log: Vendor import of libc++ trunk r305575: https://llvm.org/svn/llvm-project/libcxx/trunk@305575 Added: vendor/libc++/dist/benchmarks/stringstream.bench.cpp (contents, props changed) vendor/libc++/dist/src/vector.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/include_as_c.sh.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_type.pass.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp (contents, props changed) vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.helper/ vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/ vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/reduce.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/reduce_init.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/ vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp (contents, props changed) vendor/libc++/dist/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp (contents, props changed) Deleted: vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp Modified: vendor/libc++/dist/include/__bsd_locale_fallbacks.h vendor/libc++/dist/include/__config vendor/libc++/dist/include/__functional_03 vendor/libc++/dist/include/__functional_base vendor/libc++/dist/include/array vendor/libc++/dist/include/experimental/coroutine vendor/libc++/dist/include/fstream vendor/libc++/dist/include/functional vendor/libc++/dist/include/locale vendor/libc++/dist/include/memory vendor/libc++/dist/include/numeric vendor/libc++/dist/include/support/newlib/xlocale.h vendor/libc++/dist/include/utility vendor/libc++/dist/include/variant vendor/libc++/dist/lib/CMakeLists.txt vendor/libc++/dist/src/experimental/filesystem/operations.cpp vendor/libc++/dist/src/locale.cpp vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/count0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/find0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp vendor/libc++/dist/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp vendor/libc++/dist/test/support/allocators.h vendor/libc++/dist/test/support/is_transparent.h vendor/libc++/dist/utils/libcxx/test/config.py Added: vendor/libc++/dist/benchmarks/stringstream.bench.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/benchmarks/stringstream.bench.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,38 @@ +#include "benchmark/benchmark_api.h" + +#include +double __attribute__((noinline)) istream_numbers(); + +double istream_numbers() { + const char *a[] = { + "-6 69 -71 2.4882e-02 -100 101 -2.00005 5000000 -50000000", + "-25 71 7 -9.3262e+01 -100 101 -2.00005 5000000 -50000000", + "-14 53 46 -6.7026e-02 -100 101 -2.00005 5000000 -50000000" + }; + + int a1, a2, a3, a4, a5, a6, a7; + double f1 = 0.0, f2 = 0.0, q = 0.0; + for (int i=0; i < 3; i++) { + std::istringstream s(a[i]); + s >> a1 + >> a2 + >> a3 + >> f1 + >> a4 + >> a5 + >> f2 + >> a6 + >> a7; + q += (a1 + a2 + a3 + a4 + a5 + a6 + a7 + f1 + f2)/1000000; + } + return q; +} + +static void BM_Istream_numbers(benchmark::State &state) { + double i = 0; + while (state.KeepRunning()) + benchmark::DoNotOptimize(i += istream_numbers()); +} + +BENCHMARK(BM_Istream_numbers)->RangeMultiplier(2)->Range(1024, 4096); +BENCHMARK_MAIN() Modified: vendor/libc++/dist/include/__bsd_locale_fallbacks.h ============================================================================== --- vendor/libc++/dist/include/__bsd_locale_fallbacks.h Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__bsd_locale_fallbacks.h Fri Jun 16 21:04:04 2017 (r320019) @@ -15,6 +15,7 @@ #define _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H #include +#include #include _LIBCPP_BEGIN_NAMESPACE_STD Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__config Fri Jun 16 21:04:04 2017 (r320019) @@ -76,6 +76,9 @@ // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. #define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION + +// Enable optimized version of __do_get_(un)signed which avoids redundant copies. +#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET #elif _LIBCPP_ABI_VERSION == 1 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support @@ -289,7 +292,7 @@ # endif #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) -#if __has_attribute(__no_sanitize__) +#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) #else #define _LIBCPP_NO_CFI @@ -1132,8 +1135,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ # define _LIBCPP_HAS_NO_COROUTINES #endif -#endif // __cplusplus - // Decide whether to use availability macros. #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ @@ -1236,5 +1237,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ _Pragma("pop_macro(\"max\")") # endif #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) + + +#endif // __cplusplus #endif // _LIBCPP_CONFIG Modified: vendor/libc++/dist/include/__functional_03 ============================================================================== --- vendor/libc++/dist/include/__functional_03 Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__functional_03 Fri Jun 16 21:04:04 2017 (r320019) @@ -704,7 +704,7 @@ function<_Rp()>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -980,7 +980,7 @@ function<_Rp(_A0)>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -1256,7 +1256,7 @@ function<_Rp(_A0, _A1)>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -1532,7 +1532,7 @@ function<_Rp(_A0, _A1, _A2)>::target() { if (__f_ == 0) return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template Modified: vendor/libc++/dist/include/__functional_base ============================================================================== --- vendor/libc++/dist/include/__functional_base Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/__functional_base Fri Jun 16 21:04:04 2017 (r320019) @@ -548,16 +548,13 @@ template void cref(const _Tp&&) = delete; #endif #if _LIBCPP_STD_VER > 11 -template -struct __is_transparent -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_transparent* = 0); -public: - static const bool value = sizeof(__test<_Tp1>(0)) == 1; -}; +template +struct __is_transparent : false_type {}; + +template +struct __is_transparent<_Tp, _Up, + typename __void_t::type> + : true_type {}; #endif // allocator_arg_t Modified: vendor/libc++/dist/include/array ============================================================================== --- vendor/libc++/dist/include/array Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/array Fri Jun 16 21:04:04 2017 (r320019) @@ -296,6 +296,7 @@ class _LIBCPP_TEMPLATE_VIS tuple_size class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> > { + static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)"); public: typedef _Tp type; }; Modified: vendor/libc++/dist/include/experimental/coroutine ============================================================================== --- vendor/libc++/dist/include/experimental/coroutine Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/experimental/coroutine Fri Jun 16 21:04:04 2017 (r320019) @@ -250,9 +250,11 @@ class _LIBCPP_TEMPLATE_VIS coroutine_handle : public c _LIBCPP_ALWAYS_INLINE static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { + typedef typename remove_cv<_Promise>::type _RawPromise; coroutine_handle __tmp; - __tmp.__handle_ = __builtin_coro_promise(_VSTD::addressof(__promise), - __alignof(_Promise), true); + __tmp.__handle_ = __builtin_coro_promise( + _VSTD::addressof(const_cast<_RawPromise&>(__promise)), + __alignof(_Promise), true); return __tmp; } }; Modified: vendor/libc++/dist/include/fstream ============================================================================== --- vendor/libc++/dist/include/fstream Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/fstream Fri Jun 16 21:04:04 2017 (r320019) @@ -617,7 +617,7 @@ basic_filebuf<_CharT, _Traits>::underflow() static_cast(__extbufend_ - __extbufnext_)); codecvt_base::result __r; __st_last_ = __st_; - size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); + size_t __nr = fread((void*) const_cast(__extbufnext_), 1, __nmemb, __file_); if (__nr != 0) { if (!__cv_) @@ -630,7 +630,8 @@ basic_filebuf<_CharT, _Traits>::underflow() this->eback() + __ibs_, __inext); if (__r == codecvt_base::noconv) { - this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + (char_type*)const_cast(__extbufend_)); __c = traits_type::to_int_type(*this->gptr()); } else if (__inext != this->eback() + __unget_sz) @@ -722,7 +723,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) return traits_type::eof(); if (__r == codecvt_base::partial) { - this->setp((char_type*)__e, this->pptr()); + this->setp(const_cast(__e), this->pptr()); this->pbump(this->epptr() - this->pbase()); } } Modified: vendor/libc++/dist/include/functional ============================================================================== --- vendor/libc++/dist/include/functional Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/functional Fri Jun 16 21:04:04 2017 (r320019) @@ -1941,8 +1941,8 @@ _Tp* function<_Rp(_ArgTypes...)>::target() _NOEXCEPT { if (__f_ == 0) - return (_Tp*)0; - return (_Tp*)__f_->target(typeid(_Tp)); + return nullptr; + return (_Tp*) const_cast(__f_->target(typeid(_Tp))); } template @@ -1951,7 +1951,7 @@ const _Tp* function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT { if (__f_ == 0) - return (const _Tp*)0; + return nullptr; return (const _Tp*)__f_->target(typeid(_Tp)); } Modified: vendor/libc++/dist/include/locale ============================================================================== --- vendor/libc++/dist/include/locale Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/locale Fri Jun 16 21:04:04 2017 (r320019) @@ -372,19 +372,57 @@ template struct __num_get : protected __num_get_base { - static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep); - static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, - unsigned& __dc, _CharT __thousands_sep, const string& __grouping, - unsigned* __g, unsigned*& __g_end, _CharT* __atoms); + static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end, _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms); +#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET + static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, _CharT* __atoms); + +#else + static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) + { + locale __loc = __iob.getloc(); + const numpunct<_CharT>& __np = use_facet >(__loc); + __thousands_sep = __np.thousands_sep(); + return __np.grouping(); + } + + const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const + { + return __do_widen_p(__iob, __atoms); + } + + + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms); +private: + template + const T* __do_widen_p(ios_base& __iob, T* __atoms) const + { + locale __loc = __iob.getloc(); + use_facet >(__loc).widen(__src, __src + 26, __atoms); + return __atoms; + } + + const char* __do_widen_p(ios_base& __iob, char* __atoms) const + { + (void)__iob; + (void)__atoms; + return __src; + } +#endif }; +#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET template string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) @@ -395,6 +433,7 @@ __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, __thousands_sep = __np.thousands_sep(); return __np.grouping(); } +#endif template string @@ -411,9 +450,16 @@ __num_get<_CharT>::__stage2_float_prep(ios_base& __iob template int +#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, _CharT* __atoms) +#else +__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, + unsigned& __dc, _CharT __thousands_sep, const string& __grouping, + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms) + +#endif { if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) { @@ -849,9 +895,16 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_ // Stage 1 int __base = this->__get_base(__iob); // Stage 2 - char_type __atoms[26]; char_type __thousands_sep; + const int __atoms_size = 26; +#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET + char_type __atoms1[__atoms_size]; + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); +#else + char_type __atoms[__atoms_size]; string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); +#endif string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -899,9 +952,16 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(ite // Stage 1 int __base = this->__get_base(__iob); // Stage 2 - char_type __atoms[26]; char_type __thousands_sep; + const int __atoms_size = 26; +#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET + char_type __atoms1[__atoms_size]; + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); +#else + char_type __atoms[__atoms_size]; string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); +#endif string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -3960,7 +4020,8 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() this->egptr(), __inext); if (__r == codecvt_base::noconv) { - this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + (char_type*) const_cast(__extbufend_)); __c = *this->gptr(); } else if (__inext != this->eback() + __unget_sz) @@ -4048,7 +4109,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_ty return traits_type::eof(); if (__r == codecvt_base::partial) { - this->setp((char_type*)__e, this->pptr()); + this->setp(const_cast(__e), this->pptr()); this->pbump(this->epptr() - this->pbase()); } } Modified: vendor/libc++/dist/include/memory ============================================================================== --- vendor/libc++/dist/include/memory Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/memory Fri Jun 16 21:04:04 2017 (r320019) @@ -720,16 +720,12 @@ class _LIBCPP_TEMPLATE_VIS allocator (publ // pointer_traits +template +struct __has_element_type : false_type {}; + template -struct __has_element_type -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::element_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_element_type<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __pointer_traits_element_type; @@ -808,16 +804,12 @@ struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1 #endif // _LIBCPP_HAS_NO_VARIADICS +template +struct __has_difference_type : false_type {}; + template -struct __has_difference_type -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::difference_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_difference_type<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __pointer_traits_difference_type @@ -998,17 +990,12 @@ struct __rebind_pointer { // allocator_traits -struct __has_pointer_type_imp -{ - template static __two __test(...); - template static char __test(typename _Up::pointer* = 0); -}; +template +struct __has_pointer_type : false_type {}; template -struct __has_pointer_type - : public integral_constant(0)) == 1> -{ -}; +struct __has_pointer_type<_Tp, + typename __void_t::type> : true_type {}; namespace __pointer_type_imp { @@ -1033,16 +1020,12 @@ struct __pointer_type typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type; }; +template +struct __has_const_pointer : false_type {}; + template -struct __has_const_pointer -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::const_pointer* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_const_pointer<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __const_pointer @@ -1060,16 +1043,12 @@ struct __const_pointer<_Tp, _Ptr, _Alloc, false> #endif }; +template +struct __has_void_pointer : false_type {}; + template -struct __has_void_pointer -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::void_pointer* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_void_pointer<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __void_pointer @@ -1087,16 +1066,12 @@ struct __void_pointer<_Ptr, _Alloc, false> #endif }; +template +struct __has_const_void_pointer : false_type {}; + template -struct __has_const_void_pointer -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::const_void_pointer* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_const_void_pointer<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __const_void_pointer @@ -1130,16 +1105,12 @@ __to_raw_pointer(_Pointer __p) _NOEXCEPT return _VSTD::__to_raw_pointer(__p.operator->()); } +template +struct __has_size_type : false_type {}; + template -struct __has_size_type -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::size_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_size_type<_Tp, + typename __void_t::type> : true_type {}; template ::value> struct __size_type @@ -1153,16 +1124,13 @@ struct __size_type<_Alloc, _DiffType, true> typedef typename _Alloc::size_type type; }; +template +struct __has_propagate_on_container_copy_assignment : false_type {}; + template -struct __has_propagate_on_container_copy_assignment -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::propagate_on_container_copy_assignment* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_propagate_on_container_copy_assignment<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __propagate_on_container_copy_assignment @@ -1176,16 +1144,13 @@ struct __propagate_on_container_copy_assignment<_Alloc typedef typename _Alloc::propagate_on_container_copy_assignment type; }; +template +struct __has_propagate_on_container_move_assignment : false_type {}; + template -struct __has_propagate_on_container_move_assignment -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::propagate_on_container_move_assignment* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_propagate_on_container_move_assignment<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __propagate_on_container_move_assignment @@ -1199,16 +1164,13 @@ struct __propagate_on_container_move_assignment<_Alloc typedef typename _Alloc::propagate_on_container_move_assignment type; }; +template +struct __has_propagate_on_container_swap : false_type {}; + template -struct __has_propagate_on_container_swap -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::propagate_on_container_swap* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_propagate_on_container_swap<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __propagate_on_container_swap @@ -1222,16 +1184,13 @@ struct __propagate_on_container_swap<_Alloc, true> typedef typename _Alloc::propagate_on_container_swap type; }; +template +struct __has_is_always_equal : false_type {}; + template -struct __has_is_always_equal -{ -private: - struct __two {char __lx; char __lxx;}; - template static __two __test(...); - template static char __test(typename _Up::is_always_equal* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; +struct __has_is_always_equal<_Tp, + typename __void_t::type> + : true_type {}; template ::value> struct __is_always_equal @@ -1884,7 +1843,7 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {_VSTD::__libcpp_deallocate((void*)__p);} + {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p));} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -1900,7 +1859,7 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi void construct(pointer __p) { - ::new((void*)__p) _Tp(); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(); } # if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) @@ -1909,14 +1868,14 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi void construct(pointer __p, _A0& __a0) { - ::new((void*)__p) _Tp(__a0); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0) { - ::new((void*)__p) _Tp(__a0); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); } # endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template @@ -1924,28 +1883,28 @@ class _LIBCPP_TEMPLATE_VIS allocator (publi void construct(pointer __p, _A0& __a0, _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0, const _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, const _A1& __a1) { - ::new((void*)__p) _Tp(__a0, __a1); + ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();} @@ -3890,7 +3849,9 @@ class _LIBCPP_TEMPLATE_VIS shared_ptr (public) template _LIBCPP_INLINE_VISIBILITY _Dp* __get_deleter() const _NOEXCEPT - {return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);} + {return static_cast<_Dp*>(__cntrl_ + ? const_cast(__cntrl_->__get_deleter(typeid(_Dp))) + : nullptr);} #endif // _LIBCPP_NO_RTTI #ifndef _LIBCPP_HAS_NO_VARIADICS Modified: vendor/libc++/dist/include/numeric ============================================================================== --- vendor/libc++/dist/include/numeric Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/numeric Fri Jun 16 21:04:04 2017 (r320019) @@ -25,6 +25,18 @@ template + typename iterator_traits::value_type + reduce(InputIterator first, InputIterator last); // C++17 + +template + T + reduce(InputIterator first, InputIterator last, T init); // C++17 + +template + T + reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); // C++17 + template T inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init); @@ -34,6 +46,23 @@ template + T + transform_reduce(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, T init); // C++17 + +template + T + transform_reduce(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, T init, + BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // C++17 + +template + T + transform_reduce(InputIterator first, InputIterator last, T init, + BinaryOperation binary_op, UnaryOperation unary_op); // C++17 + template OutputIterator partial_sum(InputIterator first, InputIterator last, OutputIterator result); @@ -114,6 +143,35 @@ accumulate(_InputIterator __first, _InputIterator __la return __init; } +#if _LIBCPP_STD_VER > 14 +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) +{ + for (; __first != __last; ++__first) + __init = __b(__init, *__first); + return __init; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +reduce(_InputIterator __first, _InputIterator __last, _Tp __init) +{ + return _VSTD::reduce(__first, __last, __init, _VSTD::plus<>()); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +typename iterator_traits<_InputIterator>::value_type +reduce(_InputIterator __first, _InputIterator __last) +{ + return _VSTD::reduce(__first, __last, + typename iterator_traits<_InputIterator>::value_type{}); +} +#endif + template inline _LIBCPP_INLINE_VISIBILITY _Tp @@ -134,6 +192,41 @@ inner_product(_InputIterator1 __first1, _InputIterator __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return __init; } + +#if _LIBCPP_STD_VER > 14 +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +transform_reduce(_InputIterator __first, _InputIterator __last, + _Tp __init, _BinaryOp __b, _UnaryOp __u) +{ + for (; __first != __last; ++__first) + __init = __b(__init, __u(*__first)); + return __init; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2) +{ + for (; __first1 != __last1; ++__first1, (void) ++__first2) + __init = __b1(__init, __b2(*__first1, *__first2)); + return __init; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_Tp +transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init) +{ + return _VSTD::transform_reduce(__first1, __last1, __first2, __init, + _VSTD::plus<>(), _VSTD::multiplies<>()); +} +#endif template inline _LIBCPP_INLINE_VISIBILITY Modified: vendor/libc++/dist/include/support/newlib/xlocale.h ============================================================================== --- vendor/libc++/dist/include/support/newlib/xlocale.h Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/support/newlib/xlocale.h Fri Jun 16 21:04:04 2017 (r320019) @@ -16,7 +16,10 @@ #include #include #include +#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \ + __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5 #include +#endif #include #include Modified: vendor/libc++/dist/include/utility ============================================================================== --- vendor/libc++/dist/include/utility Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/utility Fri Jun 16 21:04:04 2017 (r320019) @@ -653,6 +653,12 @@ template class _LIBCPP_TEMPLATE_VIS tuple_size > : public integral_constant {}; +template +class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> > +{ + static_assert(_Ip < 2, "Index out of bounds in std::tuple_element>"); +}; + template class _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > { @@ -923,6 +929,12 @@ template struct __is_inplace_type_imp using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>; + +template struct __is_inplace_index_imp : false_type {}; +template struct __is_inplace_index_imp> : true_type {}; + +template +using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>; #endif // _LIBCPP_STD_VER > 14 Modified: vendor/libc++/dist/include/variant ============================================================================== --- vendor/libc++/dist/include/variant Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/include/variant Fri Jun 16 21:04:04 2017 (r320019) @@ -278,7 +278,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, c template struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { - static_assert(_Ip < sizeof...(_Types)); + static_assert(_Ip < sizeof...(_Types), "Index out of bounds in std::variant_alternative<>"); using type = __type_pack_element<_Ip, _Types...>; }; Modified: vendor/libc++/dist/lib/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/lib/CMakeLists.txt Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/lib/CMakeLists.txt Fri Jun 16 21:04:04 2017 (r320019) @@ -1,6 +1,7 @@ set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" PARENT_SCOPE) # Get sources +# FIXME: Don't use glob here file(GLOB LIBCXX_SOURCES ../src/*.cpp) if(WIN32) file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) Modified: vendor/libc++/dist/src/experimental/filesystem/operations.cpp ============================================================================== --- vendor/libc++/dist/src/experimental/filesystem/operations.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/src/experimental/filesystem/operations.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -842,7 +842,7 @@ void __rename(const path& from, const path& to, std::e } void __resize_file(const path& p, std::uintmax_t size, std::error_code *ec) { - if (::truncate(p.c_str(), static_cast(size)) == -1) + if (::truncate(p.c_str(), static_cast<::off_t>(size)) == -1) set_or_throw(ec, "resize_file", p); else if (ec) ec->clear(); Modified: vendor/libc++/dist/src/locale.cpp ============================================================================== --- vendor/libc++/dist/src/locale.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/src/locale.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -6158,6 +6158,4 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VI template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname; -template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common; - _LIBCPP_END_NAMESPACE_STD Added: vendor/libc++/dist/src/vector.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/src/vector.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,16 @@ +//===------------------------- vector.cpp ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "vector" + +_LIBCPP_BEGIN_NAMESPACE_STD + +template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common; + +_LIBCPP_END_NAMESPACE_STD Modified: vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -23,6 +23,7 @@ // However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE // is defined before including , then random_shuffle will be restored. +// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #include Modified: vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp Fri Jun 16 21:04:00 2017 (r320018) +++ vendor/libc++/dist/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -14,6 +14,7 @@ // However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS // is defined before including , then they will be restored. +// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #include Added: vendor/libc++/dist/test/libcxx/include_as_c.sh.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/libcxx/include_as_c.sh.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,37 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// Test that the C wrapper headers can be included when compiling them as C. + +// NOTE: It's not common or recommended to have libc++ in the header search +// path when compiling C files, but it does happen often enough. + +// RUN: %cxx -c -xc %s -fsyntax-only %flags %compile_flags -std=c99 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main() {} Added: vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp Fri Jun 16 21:04:04 2017 (r320019) @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:16 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C5FAD8930D; Fri, 16 Jun 2017 21:04:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C0986F885; Fri, 16 Jun 2017 21:04:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL4FHH063819; Fri, 16 Jun 2017 21:04:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL4E3H063811; Fri, 16 Jun 2017 21:04:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL4E3H063811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320021 - in vendor/lld/dist: COFF ELF ELF/Arch docs test test/COFF test/COFF/Inputs test/ELF test/ELF/Inputs test/ELF/linkerscript X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:16 -0000 Author: dim Date: Fri Jun 16 21:04:14 2017 New Revision: 320021 URL: https://svnweb.freebsd.org/changeset/base/320021 Log: Vendor import of lld trunk r305575: https://llvm.org/svn/llvm-project/lld/trunk@305575 Added: vendor/lld/dist/ELF/Arch/ vendor/lld/dist/ELF/Arch/AArch64.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/AMDGPU.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/ARM.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/AVR.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/Mips.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/PPC.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/PPC64.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/X86.cpp (contents, props changed) vendor/lld/dist/ELF/Arch/X86_64.cpp (contents, props changed) vendor/lld/dist/test/COFF/Inputs/library.def vendor/lld/dist/test/COFF/lib.test vendor/lld/dist/test/COFF/pdb-lib.s (contents, props changed) vendor/lld/dist/test/ELF/Inputs/icf-merge-sec.s (contents, props changed) vendor/lld/dist/test/ELF/Inputs/icf-merge.s (contents, props changed) vendor/lld/dist/test/ELF/Inputs/icf-merge2.s (contents, props changed) vendor/lld/dist/test/ELF/Inputs/icf-merge3.s (contents, props changed) vendor/lld/dist/test/ELF/Inputs/sht-group-gold-r.elf (contents, props changed) vendor/lld/dist/test/ELF/Inputs/sht-group-gold-r.s (contents, props changed) vendor/lld/dist/test/ELF/basic-avr.s (contents, props changed) vendor/lld/dist/test/ELF/icf-merge-sec.s (contents, props changed) vendor/lld/dist/test/ELF/icf-merge.s (contents, props changed) vendor/lld/dist/test/ELF/linkerscript/data-commands-gc.s (contents, props changed) vendor/lld/dist/test/ELF/sht-group-gold-r.test Modified: vendor/lld/dist/COFF/Driver.cpp vendor/lld/dist/COFF/DriverUtils.cpp vendor/lld/dist/COFF/InputFiles.h vendor/lld/dist/COFF/PDB.cpp vendor/lld/dist/ELF/CMakeLists.txt vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/ICF.cpp vendor/lld/dist/ELF/InputFiles.cpp vendor/lld/dist/ELF/InputFiles.h vendor/lld/dist/ELF/InputSection.cpp vendor/lld/dist/ELF/LinkerScript.cpp vendor/lld/dist/ELF/LinkerScript.h vendor/lld/dist/ELF/MarkLive.cpp vendor/lld/dist/ELF/OutputSections.cpp vendor/lld/dist/ELF/OutputSections.h vendor/lld/dist/ELF/Relocations.cpp vendor/lld/dist/ELF/Relocations.h vendor/lld/dist/ELF/Strings.h vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/SyntheticSections.h vendor/lld/dist/ELF/Target.cpp vendor/lld/dist/ELF/Target.h vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/docs/windows_support.rst vendor/lld/dist/test/COFF/Inputs/constant-export.ll vendor/lld/dist/test/COFF/Inputs/pdb1.yaml vendor/lld/dist/test/COFF/Inputs/pdb2.yaml vendor/lld/dist/test/COFF/include-lto.ll vendor/lld/dist/test/COFF/lto-linker-opts.ll vendor/lld/dist/test/COFF/pdb-none.test vendor/lld/dist/test/COFF/pdb-options.test vendor/lld/dist/test/COFF/pdb.test vendor/lld/dist/test/COFF/sort-debug.test vendor/lld/dist/test/ELF/aarch64-undefined-weak.s vendor/lld/dist/test/ELF/arm-thumb-no-undefined-thunk.s vendor/lld/dist/test/ELF/arm-thumb-undefined-weak.s vendor/lld/dist/test/ELF/arm-undefined-weak.s vendor/lld/dist/test/ELF/linkerscript/locationcountererr2.s vendor/lld/dist/test/ELF/linkerscript/symbols-non-alloc.s vendor/lld/dist/test/lit.cfg Modified: vendor/lld/dist/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist/COFF/Driver.cpp Fri Jun 16 21:04:10 2017 (r320020) +++ vendor/lld/dist/COFF/Driver.cpp Fri Jun 16 21:04:14 2017 (r320021) @@ -429,7 +429,7 @@ static std::string getImplibPath() { return Out.str(); } -std::vector createCOFFShortExportFromConfig() { +static void createImportLibrary() { std::vector Exports; for (Export &E1 : Config->Exports) { COFFShortExport E2; @@ -443,11 +443,7 @@ std::vector createCOFFShortExportFrom E2.Constant = E1.Constant; Exports.push_back(E2); } - return Exports; -} -static void createImportLibrary() { - std::vector Exports = createCOFFShortExportFromConfig(); std::string DLLName = sys::path::filename(Config->OutputFile); std::string Path = getImplibPath(); writeImportLibrary(DLLName, Path, Exports, Config->Machine); @@ -707,8 +703,12 @@ void LinkerDriver::link(ArrayRef ArgsArr } } - if (!Args.hasArgNoClaim(OPT_INPUT)) - fatal("no input files"); + if (!Args.hasArgNoClaim(OPT_INPUT)) { + if (Args.hasArgNoClaim(OPT_deffile)) + Config->NoEntry = true; + else + fatal("no input files"); + } // Construct search path list. SearchPaths.push_back(""); @@ -988,6 +988,13 @@ void LinkerDriver::link(ArrayRef ArgsArr if (auto *Arg = Args.getLastArg(OPT_deffile)) { // parseModuleDefs mutates Config object. parseModuleDefs(Arg->getValue()); + } + + // Handle generation of import library from a def file. + if (!Args.hasArgNoClaim(OPT_INPUT)) { + fixupExports(); + createImportLibrary(); + exit(0); } // Handle /delayload Modified: vendor/lld/dist/COFF/DriverUtils.cpp ============================================================================== --- vendor/lld/dist/COFF/DriverUtils.cpp Fri Jun 16 21:04:10 2017 (r320020) +++ vendor/lld/dist/COFF/DriverUtils.cpp Fri Jun 16 21:04:14 2017 (r320021) @@ -522,7 +522,7 @@ void fixupExports() { for (Export &E : Config->Exports) { SymbolBody *Sym = E.Sym; - if (!E.ForwardTo.empty()) { + if (!E.ForwardTo.empty() || !Sym) { E.SymbolName = E.Name; } else { if (auto *U = dyn_cast(Sym)) Modified: vendor/lld/dist/COFF/InputFiles.h ============================================================================== --- vendor/lld/dist/COFF/InputFiles.h Fri Jun 16 21:04:10 2017 (r320020) +++ vendor/lld/dist/COFF/InputFiles.h Fri Jun 16 21:04:14 2017 (r320021) @@ -22,6 +22,12 @@ #include #include +namespace llvm { +namespace pdb { +class DbiModuleDescriptorBuilder; +} +} + namespace lld { namespace coff { @@ -121,6 +127,12 @@ class ObjectFile : public InputFile { (public) // The list of safe exception handlers listed in .sxdata section. // COFF-specific and x86-only. std::set SEHandlers; + + // Pointer to the PDB module descriptor builder. Various debug info records + // will reference object files by "module index", which is here. Things like + // source files and section contributions are also recorded here. Will be null + // if we are not producing a PDB. + llvm::pdb::DbiModuleDescriptorBuilder *ModuleDBI = nullptr; private: void initializeChunks(); Modified: vendor/lld/dist/COFF/PDB.cpp ============================================================================== --- vendor/lld/dist/COFF/PDB.cpp Fri Jun 16 21:04:10 2017 (r320020) +++ vendor/lld/dist/COFF/PDB.cpp Fri Jun 16 21:04:14 2017 (r320021) @@ -29,6 +29,7 @@ #include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h" #include "llvm/DebugInfo/PDB/Native/PDBFile.h" #include "llvm/DebugInfo/PDB/Native/PDBFileBuilder.h" +#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h" #include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h" #include "llvm/DebugInfo/PDB/Native/PDBTypeServerHandler.h" #include "llvm/DebugInfo/PDB/Native/TpiStream.h" @@ -53,12 +54,10 @@ using llvm::object::coff_section; static ExitOnError ExitOnErr; // Returns a list of all SectionChunks. -static std::vector getInputSections(SymbolTable *Symtab) { - std::vector V; +static void addSectionContribs(SymbolTable *Symtab, pdb::DbiStreamBuilder &DbiBuilder) { for (Chunk *C : Symtab->getChunks()) if (auto *SC = dyn_cast(C)) - V.push_back(*SC->Header); - return V; + DbiBuilder.addSectionContrib(SC->File->ModuleDBI, SC->Header); } static SectionChunk *findByName(std::vector &Sections, @@ -95,10 +94,11 @@ static void addTypeInfo(pdb::TpiStreamBuilder &TpiBuil }); } -// Merge .debug$T sections into IpiData and TpiData. -static void mergeDebugT(SymbolTable *Symtab, pdb::PDBFileBuilder &Builder, - codeview::TypeTableBuilder &TypeTable, - codeview::TypeTableBuilder &IDTable) { +// Add all object files to the PDB. Merge .debug$T sections into IpiData and +// TpiData. +static void addObjectsToPDB(SymbolTable *Symtab, pdb::PDBFileBuilder &Builder, + codeview::TypeTableBuilder &TypeTable, + codeview::TypeTableBuilder &IDTable) { // Follow type servers. If the same type server is encountered more than // once for this instance of `PDBTypeServerHandler` (for example if many // object files reference the same TypeServer), the types from the @@ -107,6 +107,20 @@ static void mergeDebugT(SymbolTable *Symtab, pdb::PDBF // Visit all .debug$T sections to add them to Builder. for (ObjectFile *File : Symtab->ObjectFiles) { + // Add a module descriptor for every object file. We need to put an absolute + // path to the object into the PDB. If this is a plain object, we make its + // path absolute. If it's an object in an archive, we make the archive path + // absolute. + bool InArchive = !File->ParentName.empty(); + SmallString<128> Path = InArchive ? File->ParentName : File->getName(); + sys::fs::make_absolute(Path); + StringRef Name = InArchive ? File->getName() : StringRef(Path); + File->ModuleDBI = &ExitOnErr(Builder.getDbiBuilder().addModuleInfo(Name)); + File->ModuleDBI->setObjFileName(Path); + + // FIXME: Walk the .debug$S sections and add them. Do things like recording + // source files. + ArrayRef Data = getDebugSection(File, ".debug$T"); if (Data.empty()) continue; @@ -202,17 +216,15 @@ void coff::createPDB(StringRef Path, SymbolTable *Symt InfoBuilder.setVersion(pdb::PdbRaw_ImplVer::PdbImplVC70); // Add an empty DPI stream. - auto &DbiBuilder = Builder.getDbiBuilder(); + pdb::DbiStreamBuilder &DbiBuilder = Builder.getDbiBuilder(); DbiBuilder.setVersionHeader(pdb::PdbDbiV110); codeview::TypeTableBuilder TypeTable(BAlloc); codeview::TypeTableBuilder IDTable(BAlloc); - mergeDebugT(Symtab, Builder, TypeTable, IDTable); + addObjectsToPDB(Symtab, Builder, TypeTable, IDTable); // Add Section Contributions. - std::vector Contribs = - pdb::DbiStreamBuilder::createSectionContribs(getInputSections(Symtab)); - DbiBuilder.setSectionContribs(Contribs); + addSectionContribs(Symtab, DbiBuilder); // Add Section Map stream. ArrayRef Sections = { Added: vendor/lld/dist/ELF/Arch/AArch64.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/ELF/Arch/AArch64.cpp Fri Jun 16 21:04:14 2017 (r320021) @@ -0,0 +1,374 @@ +//===- AArch64.cpp --------------------------------------------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "Error.h" +#include "Memory.h" +#include "Symbols.h" +#include "SyntheticSections.h" +#include "Target.h" +#include "Thunks.h" +#include "llvm/Object/ELF.h" +#include "llvm/Support/Endian.h" + +using namespace llvm; +using namespace llvm::support::endian; +using namespace llvm::ELF; +using namespace lld; +using namespace lld::elf; + +// Page(Expr) is the page address of the expression Expr, defined +// as (Expr & ~0xFFF). (This applies even if the machine page size +// supported by the platform has a different value.) +uint64_t elf::getAArch64Page(uint64_t Expr) { + return Expr & ~static_cast(0xFFF); +} + +namespace { +class AArch64 final : public TargetInfo { +public: + AArch64(); + RelExpr getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const override; + bool isPicRel(uint32_t Type) const override; + void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; + bool usesOnlyLowPageBits(uint32_t Type) const override; + void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; + RelExpr adjustRelaxExpr(uint32_t Type, const uint8_t *Data, + RelExpr Expr) const override; + void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; + void relaxTlsGdToIe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; + void relaxTlsIeToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; +}; +} // namespace + +AArch64::AArch64() { + CopyRel = R_AARCH64_COPY; + RelativeRel = R_AARCH64_RELATIVE; + IRelativeRel = R_AARCH64_IRELATIVE; + GotRel = R_AARCH64_GLOB_DAT; + PltRel = R_AARCH64_JUMP_SLOT; + TlsDescRel = R_AARCH64_TLSDESC; + TlsGotRel = R_AARCH64_TLS_TPREL64; + GotEntrySize = 8; + GotPltEntrySize = 8; + PltEntrySize = 16; + PltHeaderSize = 32; + DefaultMaxPageSize = 65536; + + // It doesn't seem to be documented anywhere, but tls on aarch64 uses variant + // 1 of the tls structures and the tcb size is 16. + TcbSize = 16; +} + +RelExpr AArch64::getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const { + switch (Type) { + default: + return R_ABS; + case R_AARCH64_TLSDESC_ADR_PAGE21: + return R_TLSDESC_PAGE; + case R_AARCH64_TLSDESC_LD64_LO12: + case R_AARCH64_TLSDESC_ADD_LO12: + return R_TLSDESC; + case R_AARCH64_TLSDESC_CALL: + return R_TLSDESC_CALL; + case R_AARCH64_TLSLE_ADD_TPREL_HI12: + case R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: + return R_TLS; + case R_AARCH64_CALL26: + case R_AARCH64_CONDBR19: + case R_AARCH64_JUMP26: + case R_AARCH64_TSTBR14: + return R_PLT_PC; + case R_AARCH64_PREL16: + case R_AARCH64_PREL32: + case R_AARCH64_PREL64: + case R_AARCH64_ADR_PREL_LO21: + return R_PC; + case R_AARCH64_ADR_PREL_PG_HI21: + return R_PAGE_PC; + case R_AARCH64_LD64_GOT_LO12_NC: + case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + return R_GOT; + case R_AARCH64_ADR_GOT_PAGE: + case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: + return R_GOT_PAGE_PC; + case R_AARCH64_NONE: + return R_NONE; + } +} + +RelExpr AArch64::adjustRelaxExpr(uint32_t Type, const uint8_t *Data, + RelExpr Expr) const { + if (Expr == R_RELAX_TLS_GD_TO_IE) { + if (Type == R_AARCH64_TLSDESC_ADR_PAGE21) + return R_RELAX_TLS_GD_TO_IE_PAGE_PC; + return R_RELAX_TLS_GD_TO_IE_ABS; + } + return Expr; +} + +bool AArch64::usesOnlyLowPageBits(uint32_t Type) const { + switch (Type) { + default: + return false; + case R_AARCH64_ADD_ABS_LO12_NC: + case R_AARCH64_LD64_GOT_LO12_NC: + case R_AARCH64_LDST128_ABS_LO12_NC: + case R_AARCH64_LDST16_ABS_LO12_NC: + case R_AARCH64_LDST32_ABS_LO12_NC: + case R_AARCH64_LDST64_ABS_LO12_NC: + case R_AARCH64_LDST8_ABS_LO12_NC: + case R_AARCH64_TLSDESC_ADD_LO12: + case R_AARCH64_TLSDESC_LD64_LO12: + case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + return true; + } +} + +bool AArch64::isPicRel(uint32_t Type) const { + return Type == R_AARCH64_ABS32 || Type == R_AARCH64_ABS64; +} + +void AArch64::writeGotPlt(uint8_t *Buf, const SymbolBody &) const { + write64le(Buf, InX::Plt->getVA()); +} + +void AArch64::writePltHeader(uint8_t *Buf) const { + const uint8_t PltData[] = { + 0xf0, 0x7b, 0xbf, 0xa9, // stp x16, x30, [sp,#-16]! + 0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[2])) + 0x11, 0x02, 0x40, 0xf9, // ldr x17, [x16, Offset(&(.plt.got[2]))] + 0x10, 0x02, 0x00, 0x91, // add x16, x16, Offset(&(.plt.got[2])) + 0x20, 0x02, 0x1f, 0xd6, // br x17 + 0x1f, 0x20, 0x03, 0xd5, // nop + 0x1f, 0x20, 0x03, 0xd5, // nop + 0x1f, 0x20, 0x03, 0xd5 // nop + }; + memcpy(Buf, PltData, sizeof(PltData)); + + uint64_t Got = InX::GotPlt->getVA(); + uint64_t Plt = InX::Plt->getVA(); + relocateOne(Buf + 4, R_AARCH64_ADR_PREL_PG_HI21, + getAArch64Page(Got + 16) - getAArch64Page(Plt + 4)); + relocateOne(Buf + 8, R_AARCH64_LDST64_ABS_LO12_NC, Got + 16); + relocateOne(Buf + 12, R_AARCH64_ADD_ABS_LO12_NC, Got + 16); +} + +void AArch64::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { + const uint8_t Inst[] = { + 0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[n])) + 0x11, 0x02, 0x40, 0xf9, // ldr x17, [x16, Offset(&(.plt.got[n]))] + 0x10, 0x02, 0x00, 0x91, // add x16, x16, Offset(&(.plt.got[n])) + 0x20, 0x02, 0x1f, 0xd6 // br x17 + }; + memcpy(Buf, Inst, sizeof(Inst)); + + relocateOne(Buf, R_AARCH64_ADR_PREL_PG_HI21, + getAArch64Page(GotPltEntryAddr) - getAArch64Page(PltEntryAddr)); + relocateOne(Buf + 4, R_AARCH64_LDST64_ABS_LO12_NC, GotPltEntryAddr); + relocateOne(Buf + 8, R_AARCH64_ADD_ABS_LO12_NC, GotPltEntryAddr); +} + +static void write32AArch64Addr(uint8_t *L, uint64_t Imm) { + uint32_t ImmLo = (Imm & 0x3) << 29; + uint32_t ImmHi = (Imm & 0x1FFFFC) << 3; + uint64_t Mask = (0x3 << 29) | (0x1FFFFC << 3); + write32le(L, (read32le(L) & ~Mask) | ImmLo | ImmHi); +} + +// Return the bits [Start, End] from Val shifted Start bits. +// For instance, getBits(0xF0, 4, 8) returns 0xF. +static uint64_t getBits(uint64_t Val, int Start, int End) { + uint64_t Mask = ((uint64_t)1 << (End + 1 - Start)) - 1; + return (Val >> Start) & Mask; +} + +static void or32le(uint8_t *P, int32_t V) { write32le(P, read32le(P) | V); } + +// Update the immediate field in a AARCH64 ldr, str, and add instruction. +static void or32AArch64Imm(uint8_t *L, uint64_t Imm) { + or32le(L, (Imm & 0xFFF) << 10); +} + +void AArch64::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { + switch (Type) { + case R_AARCH64_ABS16: + case R_AARCH64_PREL16: + checkIntUInt<16>(Loc, Val, Type); + write16le(Loc, Val); + break; + case R_AARCH64_ABS32: + case R_AARCH64_PREL32: + checkIntUInt<32>(Loc, Val, Type); + write32le(Loc, Val); + break; + case R_AARCH64_ABS64: + case R_AARCH64_GLOB_DAT: + case R_AARCH64_PREL64: + write64le(Loc, Val); + break; + case R_AARCH64_ADD_ABS_LO12_NC: + or32AArch64Imm(Loc, Val); + break; + case R_AARCH64_ADR_GOT_PAGE: + case R_AARCH64_ADR_PREL_PG_HI21: + case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: + case R_AARCH64_TLSDESC_ADR_PAGE21: + checkInt<33>(Loc, Val, Type); + write32AArch64Addr(Loc, Val >> 12); + break; + case R_AARCH64_ADR_PREL_LO21: + checkInt<21>(Loc, Val, Type); + write32AArch64Addr(Loc, Val); + break; + case R_AARCH64_CALL26: + case R_AARCH64_JUMP26: + checkInt<28>(Loc, Val, Type); + or32le(Loc, (Val & 0x0FFFFFFC) >> 2); + break; + case R_AARCH64_CONDBR19: + checkInt<21>(Loc, Val, Type); + or32le(Loc, (Val & 0x1FFFFC) << 3); + break; + case R_AARCH64_LD64_GOT_LO12_NC: + case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + case R_AARCH64_TLSDESC_LD64_LO12: + checkAlignment<8>(Loc, Val, Type); + or32le(Loc, (Val & 0xFF8) << 7); + break; + case R_AARCH64_LDST8_ABS_LO12_NC: + or32AArch64Imm(Loc, getBits(Val, 0, 11)); + break; + case R_AARCH64_LDST16_ABS_LO12_NC: + or32AArch64Imm(Loc, getBits(Val, 1, 11)); + break; + case R_AARCH64_LDST32_ABS_LO12_NC: + or32AArch64Imm(Loc, getBits(Val, 2, 11)); + break; + case R_AARCH64_LDST64_ABS_LO12_NC: + or32AArch64Imm(Loc, getBits(Val, 3, 11)); + break; + case R_AARCH64_LDST128_ABS_LO12_NC: + or32AArch64Imm(Loc, getBits(Val, 4, 11)); + break; + case R_AARCH64_MOVW_UABS_G0_NC: + or32le(Loc, (Val & 0xFFFF) << 5); + break; + case R_AARCH64_MOVW_UABS_G1_NC: + or32le(Loc, (Val & 0xFFFF0000) >> 11); + break; + case R_AARCH64_MOVW_UABS_G2_NC: + or32le(Loc, (Val & 0xFFFF00000000) >> 27); + break; + case R_AARCH64_MOVW_UABS_G3: + or32le(Loc, (Val & 0xFFFF000000000000) >> 43); + break; + case R_AARCH64_TSTBR14: + checkInt<16>(Loc, Val, Type); + or32le(Loc, (Val & 0xFFFC) << 3); + break; + case R_AARCH64_TLSLE_ADD_TPREL_HI12: + checkInt<24>(Loc, Val, Type); + or32AArch64Imm(Loc, Val >> 12); + break; + case R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: + case R_AARCH64_TLSDESC_ADD_LO12: + or32AArch64Imm(Loc, Val); + break; + default: + error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type)); + } +} + +void AArch64::relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const { + // TLSDESC Global-Dynamic relocation are in the form: + // adrp x0, :tlsdesc:v [R_AARCH64_TLSDESC_ADR_PAGE21] + // ldr x1, [x0, #:tlsdesc_lo12:v [R_AARCH64_TLSDESC_LD64_LO12] + // add x0, x0, :tlsdesc_los:v [R_AARCH64_TLSDESC_ADD_LO12] + // .tlsdesccall [R_AARCH64_TLSDESC_CALL] + // blr x1 + // And it can optimized to: + // movz x0, #0x0, lsl #16 + // movk x0, #0x10 + // nop + // nop + checkUInt<32>(Loc, Val, Type); + + switch (Type) { + case R_AARCH64_TLSDESC_ADD_LO12: + case R_AARCH64_TLSDESC_CALL: + write32le(Loc, 0xd503201f); // nop + return; + case R_AARCH64_TLSDESC_ADR_PAGE21: + write32le(Loc, 0xd2a00000 | (((Val >> 16) & 0xffff) << 5)); // movz + return; + case R_AARCH64_TLSDESC_LD64_LO12: + write32le(Loc, 0xf2800000 | ((Val & 0xffff) << 5)); // movk + return; + default: + llvm_unreachable("unsupported relocation for TLS GD to LE relaxation"); + } +} + +void AArch64::relaxTlsGdToIe(uint8_t *Loc, uint32_t Type, uint64_t Val) const { + // TLSDESC Global-Dynamic relocation are in the form: + // adrp x0, :tlsdesc:v [R_AARCH64_TLSDESC_ADR_PAGE21] + // ldr x1, [x0, #:tlsdesc_lo12:v [R_AARCH64_TLSDESC_LD64_LO12] + // add x0, x0, :tlsdesc_los:v [R_AARCH64_TLSDESC_ADD_LO12] + // .tlsdesccall [R_AARCH64_TLSDESC_CALL] + // blr x1 + // And it can optimized to: + // adrp x0, :gottprel:v + // ldr x0, [x0, :gottprel_lo12:v] + // nop + // nop + + switch (Type) { + case R_AARCH64_TLSDESC_ADD_LO12: + case R_AARCH64_TLSDESC_CALL: + write32le(Loc, 0xd503201f); // nop + break; + case R_AARCH64_TLSDESC_ADR_PAGE21: + write32le(Loc, 0x90000000); // adrp + relocateOne(Loc, R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, Val); + break; + case R_AARCH64_TLSDESC_LD64_LO12: + write32le(Loc, 0xf9400000); // ldr + relocateOne(Loc, R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, Val); + break; + default: + llvm_unreachable("unsupported relocation for TLS GD to LE relaxation"); + } +} + +void AArch64::relaxTlsIeToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const { + checkUInt<32>(Loc, Val, Type); + + if (Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) { + // Generate MOVZ. + uint32_t RegNo = read32le(Loc) & 0x1f; + write32le(Loc, (0xd2a00000 | RegNo) | (((Val >> 16) & 0xffff) << 5)); + return; + } + if (Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) { + // Generate MOVK. + uint32_t RegNo = read32le(Loc) & 0x1f; + write32le(Loc, (0xf2800000 | RegNo) | ((Val & 0xffff) << 5)); + return; + } + llvm_unreachable("invalid relocation for TLS IE to LE relaxation"); +} + +TargetInfo *elf::createAArch64TargetInfo() { return make(); } Added: vendor/lld/dist/ELF/Arch/AMDGPU.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/ELF/Arch/AMDGPU.cpp Fri Jun 16 21:04:14 2017 (r320021) @@ -0,0 +1,82 @@ +//===- AMDGPU.cpp ---------------------------------------------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "Error.h" +#include "InputFiles.h" +#include "Memory.h" +#include "Symbols.h" +#include "Target.h" +#include "llvm/Object/ELF.h" +#include "llvm/Support/Endian.h" + +using namespace llvm; +using namespace llvm::object; +using namespace llvm::support::endian; +using namespace llvm::ELF; +using namespace lld; +using namespace lld::elf; + +namespace { +class AMDGPU final : public TargetInfo { +public: + AMDGPU(); + void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; + RelExpr getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const override; +}; +} // namespace + +AMDGPU::AMDGPU() { + RelativeRel = R_AMDGPU_REL64; + GotRel = R_AMDGPU_ABS64; + GotEntrySize = 8; +} + +void AMDGPU::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { + switch (Type) { + case R_AMDGPU_ABS32: + case R_AMDGPU_GOTPCREL: + case R_AMDGPU_GOTPCREL32_LO: + case R_AMDGPU_REL32: + case R_AMDGPU_REL32_LO: + write32le(Loc, Val); + break; + case R_AMDGPU_ABS64: + write64le(Loc, Val); + break; + case R_AMDGPU_GOTPCREL32_HI: + case R_AMDGPU_REL32_HI: + write32le(Loc, Val >> 32); + break; + default: + error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type)); + } +} + +RelExpr AMDGPU::getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const { + switch (Type) { + case R_AMDGPU_ABS32: + case R_AMDGPU_ABS64: + return R_ABS; + case R_AMDGPU_REL32: + case R_AMDGPU_REL32_LO: + case R_AMDGPU_REL32_HI: + return R_PC; + case R_AMDGPU_GOTPCREL: + case R_AMDGPU_GOTPCREL32_LO: + case R_AMDGPU_GOTPCREL32_HI: + return R_GOT_PC; + default: + error(toString(S.File) + ": unknown relocation type: " + toString(Type)); + return R_HINT; + } +} + +TargetInfo *elf::createAMDGPUTargetInfo() { return make(); } Added: vendor/lld/dist/ELF/Arch/ARM.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/ELF/Arch/ARM.cpp Fri Jun 16 21:04:14 2017 (r320021) @@ -0,0 +1,432 @@ +//===- ARM.cpp ------------------------------------------------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "Error.h" +#include "InputFiles.h" +#include "Memory.h" +#include "Symbols.h" +#include "SyntheticSections.h" +#include "Target.h" +#include "Thunks.h" +#include "llvm/Object/ELF.h" +#include "llvm/Support/Endian.h" + +using namespace llvm; +using namespace llvm::support::endian; +using namespace llvm::ELF; +using namespace lld; +using namespace lld::elf; + +namespace { +class ARM final : public TargetInfo { +public: + ARM(); + RelExpr getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const override; + bool isPicRel(uint32_t Type) const override; + uint32_t getDynRel(uint32_t Type) const override; + int64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const override; + void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; + void writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const override; + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; + void addPltSymbols(InputSectionBase *IS, uint64_t Off) const override; + void addPltHeaderSymbols(InputSectionBase *ISD) const override; + bool needsThunk(RelExpr Expr, uint32_t RelocType, const InputFile *File, + const SymbolBody &S) const override; + void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; +}; +} // namespace + +ARM::ARM() { + CopyRel = R_ARM_COPY; + RelativeRel = R_ARM_RELATIVE; + IRelativeRel = R_ARM_IRELATIVE; + GotRel = R_ARM_GLOB_DAT; + PltRel = R_ARM_JUMP_SLOT; + TlsGotRel = R_ARM_TLS_TPOFF32; + TlsModuleIndexRel = R_ARM_TLS_DTPMOD32; + TlsOffsetRel = R_ARM_TLS_DTPOFF32; + GotEntrySize = 4; + GotPltEntrySize = 4; + PltEntrySize = 16; + PltHeaderSize = 20; + // ARM uses Variant 1 TLS + TcbSize = 8; + NeedsThunks = true; +} + +RelExpr ARM::getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const { + switch (Type) { + default: + return R_ABS; + case R_ARM_THM_JUMP11: + return R_PC; + case R_ARM_CALL: + case R_ARM_JUMP24: + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_PREL31: + case R_ARM_THM_JUMP19: + case R_ARM_THM_JUMP24: + case R_ARM_THM_CALL: + return R_PLT_PC; + case R_ARM_GOTOFF32: + // (S + A) - GOT_ORG + return R_GOTREL; + case R_ARM_GOT_BREL: + // GOT(S) + A - GOT_ORG + return R_GOT_OFF; + case R_ARM_GOT_PREL: + case R_ARM_TLS_IE32: + // GOT(S) + A - P + return R_GOT_PC; + case R_ARM_SBREL32: + return R_ARM_SBREL; + case R_ARM_TARGET1: + return Config->Target1Rel ? R_PC : R_ABS; + case R_ARM_TARGET2: + if (Config->Target2 == Target2Policy::Rel) + return R_PC; + if (Config->Target2 == Target2Policy::Abs) + return R_ABS; + return R_GOT_PC; + case R_ARM_TLS_GD32: + return R_TLSGD_PC; + case R_ARM_TLS_LDM32: + return R_TLSLD_PC; + case R_ARM_BASE_PREL: + // B(S) + A - P + // FIXME: currently B(S) assumed to be .got, this may not hold for all + // platforms. + return R_GOTONLY_PC; + case R_ARM_MOVW_PREL_NC: + case R_ARM_MOVT_PREL: + case R_ARM_REL32: + case R_ARM_THM_MOVW_PREL_NC: + case R_ARM_THM_MOVT_PREL: + return R_PC; + case R_ARM_NONE: + return R_NONE; + case R_ARM_TLS_LE32: + return R_TLS; + } +} + +bool ARM::isPicRel(uint32_t Type) const { + return (Type == R_ARM_TARGET1 && !Config->Target1Rel) || + (Type == R_ARM_ABS32); +} + +uint32_t ARM::getDynRel(uint32_t Type) const { + if (Type == R_ARM_TARGET1 && !Config->Target1Rel) + return R_ARM_ABS32; + if (Type == R_ARM_ABS32) + return Type; + // Keep it going with a dummy value so that we can find more reloc errors. + return R_ARM_ABS32; +} + +void ARM::writeGotPlt(uint8_t *Buf, const SymbolBody &) const { + write32le(Buf, InX::Plt->getVA()); +} + +void ARM::writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const { + // An ARM entry is the address of the ifunc resolver function. + write32le(Buf, S.getVA()); +} + +void ARM::writePltHeader(uint8_t *Buf) const { + const uint8_t PltData[] = { + 0x04, 0xe0, 0x2d, 0xe5, // str lr, [sp,#-4]! + 0x04, 0xe0, 0x9f, 0xe5, // ldr lr, L2 + 0x0e, 0xe0, 0x8f, 0xe0, // L1: add lr, pc, lr + 0x08, 0xf0, 0xbe, 0xe5, // ldr pc, [lr, #8] + 0x00, 0x00, 0x00, 0x00, // L2: .word &(.got.plt) - L1 - 8 + }; + memcpy(Buf, PltData, sizeof(PltData)); + uint64_t GotPlt = InX::GotPlt->getVA(); + uint64_t L1 = InX::Plt->getVA() + 8; + write32le(Buf + 16, GotPlt - L1 - 8); +} + +void ARM::addPltHeaderSymbols(InputSectionBase *ISD) const { + auto *IS = cast(ISD); + addSyntheticLocal("$a", STT_NOTYPE, 0, 0, IS); + addSyntheticLocal("$d", STT_NOTYPE, 16, 0, IS); +} + +void ARM::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { + // FIXME: Using simple code sequence with simple relocations. + // There is a more optimal sequence but it requires support for the group + // relocations. See ELF for the ARM Architecture Appendix A.3 + const uint8_t PltData[] = { + 0x04, 0xc0, 0x9f, 0xe5, // ldr ip, L2 + 0x0f, 0xc0, 0x8c, 0xe0, // L1: add ip, ip, pc + 0x00, 0xf0, 0x9c, 0xe5, // ldr pc, [ip] + 0x00, 0x00, 0x00, 0x00, // L2: .word Offset(&(.plt.got) - L1 - 8 + }; + memcpy(Buf, PltData, sizeof(PltData)); + uint64_t L1 = PltEntryAddr + 4; + write32le(Buf + 12, GotPltEntryAddr - L1 - 8); +} + +void ARM::addPltSymbols(InputSectionBase *ISD, uint64_t Off) const { + auto *IS = cast(ISD); + addSyntheticLocal("$a", STT_NOTYPE, Off, 0, IS); + addSyntheticLocal("$d", STT_NOTYPE, Off + 12, 0, IS); +} + +bool ARM::needsThunk(RelExpr Expr, uint32_t RelocType, const InputFile *File, + const SymbolBody &S) const { + // If S is an undefined weak symbol in an executable we don't need a Thunk. + // In a DSO calls to undefined symbols, including weak ones get PLT entries + // which may need a thunk. + if (S.isUndefined() && !S.isLocal() && S.symbol()->isWeak() && + !Config->Shared) + return false; + // A state change from ARM to Thumb and vice versa must go through an + // interworking thunk if the relocation type is not R_ARM_CALL or + // R_ARM_THM_CALL. + switch (RelocType) { + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_JUMP24: + // Source is ARM, all PLT entries are ARM so no interworking required. + // Otherwise we need to interwork if Symbol has bit 0 set (Thumb). + if (Expr == R_PC && ((S.getVA() & 1) == 1)) + return true; + break; + case R_ARM_THM_JUMP19: + case R_ARM_THM_JUMP24: + // Source is Thumb, all PLT entries are ARM so interworking is required. + // Otherwise we need to interwork if Symbol has bit 0 clear (ARM). + if (Expr == R_PLT_PC || ((S.getVA() & 1) == 0)) + return true; + break; + } + return false; +} + +void ARM::relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const { + switch (Type) { + case R_ARM_ABS32: + case R_ARM_BASE_PREL: + case R_ARM_GLOB_DAT: + case R_ARM_GOTOFF32: + case R_ARM_GOT_BREL: + case R_ARM_GOT_PREL: + case R_ARM_REL32: + case R_ARM_RELATIVE: + case R_ARM_SBREL32: + case R_ARM_TARGET1: + case R_ARM_TARGET2: + case R_ARM_TLS_GD32: + case R_ARM_TLS_IE32: + case R_ARM_TLS_LDM32: + case R_ARM_TLS_LDO32: + case R_ARM_TLS_LE32: + case R_ARM_TLS_TPOFF32: + case R_ARM_TLS_DTPOFF32: + write32le(Loc, Val); + break; + case R_ARM_TLS_DTPMOD32: + write32le(Loc, 1); + break; + case R_ARM_PREL31: + checkInt<31>(Loc, Val, Type); + write32le(Loc, (read32le(Loc) & 0x80000000) | (Val & ~0x80000000)); + break; + case R_ARM_CALL: + // R_ARM_CALL is used for BL and BLX instructions, depending on the + // value of bit 0 of Val, we must select a BL or BLX instruction + if (Val & 1) { + // If bit 0 of Val is 1 the target is Thumb, we must select a BLX. + // The BLX encoding is 0xfa:H:imm24 where Val = imm24:H:'1' + checkInt<26>(Loc, Val, Type); + write32le(Loc, 0xfa000000 | // opcode + ((Val & 2) << 23) | // H + ((Val >> 2) & 0x00ffffff)); // imm24 + break; + } + if ((read32le(Loc) & 0xfe000000) == 0xfa000000) + // BLX (always unconditional) instruction to an ARM Target, select an + // unconditional BL. + write32le(Loc, 0xeb000000 | (read32le(Loc) & 0x00ffffff)); + // fall through as BL encoding is shared with B + LLVM_FALLTHROUGH; + case R_ARM_JUMP24: + case R_ARM_PC24: + case R_ARM_PLT32: + checkInt<26>(Loc, Val, Type); + write32le(Loc, (read32le(Loc) & ~0x00ffffff) | ((Val >> 2) & 0x00ffffff)); + break; + case R_ARM_THM_JUMP11: + checkInt<12>(Loc, Val, Type); + write16le(Loc, (read32le(Loc) & 0xf800) | ((Val >> 1) & 0x07ff)); + break; + case R_ARM_THM_JUMP19: + // Encoding T3: Val = S:J2:J1:imm6:imm11:0 + checkInt<21>(Loc, Val, Type); + write16le(Loc, + (read16le(Loc) & 0xfbc0) | // opcode cond + ((Val >> 10) & 0x0400) | // S + ((Val >> 12) & 0x003f)); // imm6 + write16le(Loc + 2, + 0x8000 | // opcode + ((Val >> 8) & 0x0800) | // J2 + ((Val >> 5) & 0x2000) | // J1 + ((Val >> 1) & 0x07ff)); // imm11 + break; + case R_ARM_THM_CALL: + // R_ARM_THM_CALL is used for BL and BLX instructions, depending on the + // value of bit 0 of Val, we must select a BL or BLX instruction + if ((Val & 1) == 0) { + // Ensure BLX destination is 4-byte aligned. As BLX instruction may + // only be two byte aligned. This must be done before overflow check + Val = alignTo(Val, 4); + } + // Bit 12 is 0 for BLX, 1 for BL + write16le(Loc + 2, (read16le(Loc + 2) & ~0x1000) | (Val & 1) << 12); + // Fall through as rest of encoding is the same as B.W + LLVM_FALLTHROUGH; + case R_ARM_THM_JUMP24: + // Encoding B T4, BL T1, BLX T2: Val = S:I1:I2:imm10:imm11:0 + // FIXME: Use of I1 and I2 require v6T2ops + checkInt<25>(Loc, Val, Type); + write16le(Loc, + 0xf000 | // opcode + ((Val >> 14) & 0x0400) | // S + ((Val >> 12) & 0x03ff)); // imm10 + write16le(Loc + 2, + (read16le(Loc + 2) & 0xd000) | // opcode + (((~(Val >> 10)) ^ (Val >> 11)) & 0x2000) | // J1 + (((~(Val >> 11)) ^ (Val >> 13)) & 0x0800) | // J2 + ((Val >> 1) & 0x07ff)); // imm11 + break; + case R_ARM_MOVW_ABS_NC: + case R_ARM_MOVW_PREL_NC: + write32le(Loc, (read32le(Loc) & ~0x000f0fff) | ((Val & 0xf000) << 4) | + (Val & 0x0fff)); + break; + case R_ARM_MOVT_ABS: + case R_ARM_MOVT_PREL: + checkInt<32>(Loc, Val, Type); + write32le(Loc, (read32le(Loc) & ~0x000f0fff) | + (((Val >> 16) & 0xf000) << 4) | ((Val >> 16) & 0xfff)); + break; + case R_ARM_THM_MOVT_ABS: + case R_ARM_THM_MOVT_PREL: + // Encoding T1: A = imm4:i:imm3:imm8 + checkInt<32>(Loc, Val, Type); + write16le(Loc, + 0xf2c0 | // opcode + ((Val >> 17) & 0x0400) | // i + ((Val >> 28) & 0x000f)); // imm4 + write16le(Loc + 2, + (read16le(Loc + 2) & 0x8f00) | // opcode + ((Val >> 12) & 0x7000) | // imm3 + ((Val >> 16) & 0x00ff)); // imm8 + break; + case R_ARM_THM_MOVW_ABS_NC: + case R_ARM_THM_MOVW_PREL_NC: + // Encoding T3: A = imm4:i:imm3:imm8 + write16le(Loc, + 0xf240 | // opcode + ((Val >> 1) & 0x0400) | // i + ((Val >> 12) & 0x000f)); // imm4 + write16le(Loc + 2, + (read16le(Loc + 2) & 0x8f00) | // opcode + ((Val << 4) & 0x7000) | // imm3 + (Val & 0x00ff)); // imm8 + break; + default: + error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type)); + } +} + +int64_t ARM::getImplicitAddend(const uint8_t *Buf, uint32_t Type) const { + switch (Type) { + default: + return 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:12 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FFF8D892C8; Fri, 16 Jun 2017 21:04:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1F696F812; Fri, 16 Jun 2017 21:04:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL4APg063763; Fri, 16 Jun 2017 21:04:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL4ACp063762; Fri, 16 Jun 2017 21:04:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL4ACp063762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320020 - vendor/libc++/libc++-trunk-r305575 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:12 -0000 Author: dim Date: Fri Jun 16 21:04:10 2017 New Revision: 320020 URL: https://svnweb.freebsd.org/changeset/base/320020 Log: Tag libc++ trunk r305575. Added: vendor/libc++/libc++-trunk-r305575/ - copied from r320019, vendor/libc++/dist/ From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:26 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88FFED893AE; Fri, 16 Jun 2017 21:04:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F1476F9AC; Fri, 16 Jun 2017 21:04:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL4PZQ063941; Fri, 16 Jun 2017 21:04:25 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL4MZT063914; Fri, 16 Jun 2017 21:04:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL4MZT063914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320023 - in vendor/lldb/dist: include/lldb/Core include/lldb/Target include/lldb/Utility packages/Python/lldbsuite/test/expression_command/call-restarts packages/Python/lldbsuite/test/... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:26 -0000 Author: dim Date: Fri Jun 16 21:04:22 2017 New Revision: 320023 URL: https://svnweb.freebsd.org/changeset/base/320023 Log: Vendor import of lldb trunk r305575: https://llvm.org/svn/llvm-project/lldb/trunk@305575 Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c (contents, props changed) Modified: vendor/lldb/dist/include/lldb/Core/Debugger.h vendor/lldb/dist/include/lldb/Target/StackFrame.h vendor/lldb/dist/include/lldb/Target/StackFrameList.h vendor/lldb/dist/include/lldb/Target/Thread.h vendor/lldb/dist/include/lldb/Utility/Status.h vendor/lldb/dist/packages/Python/lldbsuite/test/expression_command/call-restarts/TestCallThatRestarts.py vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/register_variables/test.c vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py vendor/lldb/dist/scripts/lldb.swig vendor/lldb/dist/source/Commands/CommandObjectThread.cpp vendor/lldb/dist/source/Core/Debugger.cpp vendor/lldb/dist/source/Host/common/Symbols.cpp vendor/lldb/dist/source/Target/StackFrame.cpp vendor/lldb/dist/source/Target/StackFrameList.cpp vendor/lldb/dist/source/Target/Thread.cpp vendor/lldb/dist/source/Utility/Status.cpp vendor/lldb/dist/unittests/Utility/StatusTest.cpp Modified: vendor/lldb/dist/include/lldb/Core/Debugger.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Debugger.h Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/include/lldb/Core/Debugger.h Fri Jun 16 21:04:22 2017 (r320023) @@ -249,6 +249,8 @@ class Debugger : public std::enable_shared_from_this= 4, + num_threads >= 13, 'Number of expected threads and actual threads do not match.') + + def test_unique_stacks(self): + """Test backtrace unique with multiple threads executing the same stack.""" + self.build() + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + # Set a break point on the thread3 notify all (should get hit on threads 4-13). + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.thread3_before_lock_line, num_expected_locations=1) + + # Run the program. + self.runCmd("run", RUN_SUCCEEDED) + + # Stopped once. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs=["stop reason = breakpoint 1."]) + + process = self.process() + + # Get the number of threads + num_threads = process.GetNumThreads() + + # Using std::thread may involve extra threads, so we assert that there are + # at least 10 thread3's rather than exactly 10. + self.assertTrue( + num_threads >= 10, + 'Number of expected threads and actual threads do not match.') + + # Attempt to walk each of the thread's executing the thread3 function to + # the same breakpoint. + def is_thread3(thread): + for frame in thread: + if "thread3" in frame.GetFunctionName(): return True + return False + + expect_threads = "" + for i in range(num_threads): + thread = process.GetThreadAtIndex(i) + self.assertTrue(thread.IsValid()) + if not is_thread3(thread): + continue + + # If we aren't stopped out the thread breakpoint try to resume. + if thread.GetStopReason() != lldb.eStopReasonBreakpoint: + self.runCmd("thread continue %d"%(i+1)) + self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint) + + expect_threads += " #%d"%(i+1) + + # Construct our expected back trace string + expect_string = "10 thread(s)%s" % (expect_threads) + + # Now that we are stopped, we should have 10 threads waiting in the + # thread3 function. All of these threads should show as one stack. + self.expect("thread backtrace unique", + "Backtrace with unique stack shown correctly", + substrs=[expect_string, + "main.cpp:%d"%self.thread3_before_lock_line]) Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp Fri Jun 16 21:04:22 2017 (r320023) @@ -1,15 +1,19 @@ +#include "pseudo_barrier.h" #include #include #include +#include std::mutex mutex; std::condition_variable cond; +pseudo_barrier_t thread3_barrier; void * thread3(void *input) { - std::unique_lock lock(mutex); - cond.notify_all(); // Set break point at this line. + pseudo_barrier_wait(thread3_barrier); + std::unique_lock lock(mutex); // Set thread3 break point on lock at this line. + cond.notify_all(); // Set thread3 break point on notify_all at this line. return NULL; } @@ -17,7 +21,7 @@ void * thread2(void *input) { std::unique_lock lock(mutex); - cond.notify_all(); + cond.notify_all(); // release main thread cond.wait(lock); return NULL; } @@ -36,15 +40,23 @@ int main() std::unique_lock lock(mutex); std::thread thread_1(thread1, nullptr); - cond.wait(lock); + cond.wait(lock); // wait for thread2 - std::thread thread_3(thread3, nullptr); - cond.wait(lock); + pseudo_barrier_init(thread3_barrier, 10); + std::vector thread_3s; + for (int i = 0; i < 10; i++) { + thread_3s.push_back(std::thread(thread3, nullptr)); + } + + cond.wait(lock); // wait for thread_3s + lock.unlock(); thread_1.join(); - thread_3.join(); + for (auto &t : thread_3s){ + t.join(); + } return 0; } Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Fri Jun 16 21:04:22 2017 (r320023) @@ -19,6 +19,7 @@ class NoreturnUnwind(TestBase): @skipIfWindows # clang-cl does not support gcc style attributes. # clang does not preserve LR in noreturn functions, making unwinding impossible @skipIf(compiler="clang", archs=['arm'], oslist=['linux']) + @expectedFailureAll(bugnumber="llvm.org/pr33452", triple='^mips') def test(self): """Test that we can backtrace correctly with 'noreturn' functions on the stack""" self.build() Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/register_variables/test.c ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/register_variables/test.c Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/register_variables/test.c Fri Jun 16 21:04:22 2017 (r320023) @@ -1,6 +1,6 @@ #include -#if defined(__arm__) || defined(__aarch64__) +#if defined(__arm__) || defined(__aarch64__) || defined (__mips__) // Clang does not accept regparm attribute on these platforms. // Fortunately, the default calling convention passes arguments in registers // anyway. Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py Fri Jun 16 21:04:22 2017 (r320023) @@ -121,6 +121,8 @@ class ObjCNewSyntaxTestCase(TestBase): '7.0.0']) @skipIf(macos_version=["<", "10.12"]) @expectedFailureAll(archs=["i[3-6]86"]) + @expectedFailureAll( + bugnumber="rdar://32777981") def test_update_dictionary(self): self.runToBreakpoint() @@ -163,6 +165,8 @@ class ObjCNewSyntaxTestCase(TestBase): '7.0.0']) @skipIf(macos_version=["<", "10.12"]) @expectedFailureAll(archs=["i[3-6]86"]) + @expectedFailureAll( + bugnumber="rdar://32777981") def test_dictionary_literal(self): self.runToBreakpoint() Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,21 @@ +CC ?= clang + +ifeq "$(ARCH)" "" + ARCH = x86_64 +endif + +CFLAGS ?= -g -O0 -arch $(ARCH) + +all: clean + $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd bundle.c + mkdir com.apple.sbd.xpc + mv com.apple.sbd com.apple.sbd.xpc/ + mkdir -p com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF + mv com.apple.sbd.dSYM/Contents/Resources/DWARF/com.apple.sbd com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF/ + rm -rf com.apple.sbd.dSYM + mkdir hide.app + tar cf - com.apple.sbd.xpc com.apple.sbd.xpc.dSYM | ( cd hide.app;tar xBpf -) + $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn main.c + +clean: + rm -rf a.out a.out.dSYM hide.app com.apple.sbd com.apple.sbd.dSYM com.apple.sbd.xpc com.apple.sbd.xpc.dSYM find-bundle-with-dots-in-fn find-bundle-with-dots-in-fn.dSYM Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,71 @@ +"""Test that a dSYM can be found when a binary is in a bundle hnd has dots in the filename.""" + +from __future__ import print_function + +#import unittest2 +import os.path +from time import sleep + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +exe_name = 'find-bundle-with-dots-in-fn' # must match Makefile + +class BundleWithDotInFilenameTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipIfRemote + @skipUnlessDarwin + # This test is explicitly a dSYM test, it doesn't need to run for any other config, but + # the following doesn't work, fixme. + # @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM") + + def setUp(self): + TestBase.setUp(self) + self.source = 'main.c' + + def tearDown(self): + # Destroy process before TestBase.tearDown() + self.dbg.GetSelectedTarget().GetProcess().Destroy() + + # Call super's tearDown(). + TestBase.tearDown(self) + + def test_attach_and_check_dsyms(self): + """Test attach to binary, see if the bundle dSYM is found""" + exe = os.path.join(os.getcwd(), exe_name) + self.build() + popen = self.spawnSubprocess(exe) + self.addTearDownHook(self.cleanupSubprocesses) + + # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in + sleep(5) + + # Since the library that was dlopen()'ed is now removed, lldb will need to find the + # binary & dSYM via target.exec-search-paths + settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app" + self.runCmd(settings_str) + + self.runCmd("process attach -p " + str(popen.pid)) + + target = self.dbg.GetSelectedTarget() + self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process') + + setup_complete = target.FindFirstGlobalVariable("setup_is_complete") + self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup') + + # Find the bundle module, see if we found the dSYM too (they're both in "hide.app") + i = 0 + while i < target.GetNumModules(): + mod = target.GetModuleAtIndex(i) + if mod.GetFileSpec().GetFilename() == 'com.apple.sbd': + dsym_name = mod.GetSymbolFileSpec().GetFilename() + self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded") + i=i+1 + +if __name__ == '__main__': + unittest.main() Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/bundle.c Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,4 @@ +int foo () +{ + return 5; +} Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/main.c Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,28 @@ +#include +#include +#include + +int setup_is_complete = 0; + +int main() +{ + + void *handle = dlopen ("com.apple.sbd.xpc/com.apple.sbd", RTLD_NOW); + if (handle) + { + if (dlsym(handle, "foo")) + { + system ("/bin/rm -rf com.apple.sbd.xpc com.apple.sbd.xpc.dSYM"); + setup_is_complete = 1; + + // At this point we want lldb to attach to the process. If lldb attaches + // before we've removed the dlopen'ed bundle, lldb will find the bundle + // at its actual filepath and not have to do any tricky work, invalidating + // the test. + + for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++) + sleep (1); + } + } + return 0; +} Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Info.plist Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,44 @@ + + + + + BuildMachineOSBuild + 16B2657 + CFBundleDevelopmentRegion + en + CFBundleExecutable + MyFramework + CFBundleIdentifier + com.apple.test.framework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + MyFramework + CFBundlePackageType + FMWK + CFBundleShortVersionString + 113 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 113 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 9L120i + DTPlatformVersion + GM + DTSDKBuild + 17A261x + DTSDKName + macosx10.13 + DTXcode + 0900 + DTXcodeBuild + 9L120i + + Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,28 @@ +CC ?= clang + +ifeq "$(ARCH)" "" + ARCH = x86_64 +endif + +CFLAGS ?= -g -O0 -arch $(ARCH) + +all: clean + $(CC) $(CFLAGS) -install_name $(PWD)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework myframework.c + mkdir -p MyFramework.framework/Versions/A/Headers + mkdir -p MyFramework.framework/Versions/A/Resources + cp MyFramework MyFramework.framework/Versions/A + cp MyFramework.h MyFramework.framework/Versions/A/Headers + cp Info.plist MyFramework.framework/Versions/A/Resources + ( cd MyFramework.framework/Versions ; ln -s A Current ) + ( cd MyFramework.framework/ ; ln -s Versions/Current/Headers . ) + ( cd MyFramework.framework/ ; ln -s Versions/Current/MyFramework . ) + ( cd MyFramework.framework/ ; ln -s Versions/Current/Resources . ) + mv MyFramework.dSYM MyFramework.framework.dSYM + mkdir hide.app + rm -f MyFramework + tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -) + $(CC) $(CFLAGS) -o deep-bundle main.c -F. -framework MyFramework + + +clean: + rm -rf a.out a.out.dSYM deep-bundle deep-bundle.dSYM MyFramework.framework MyFramework.framework.dSYM MyFramework MyFramework.dSYM hide.app Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/MyFramework.h Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1 @@ +int foo (); Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,75 @@ +"""Test that a dSYM can be found when a binary is in a deep bundle with multiple pathname components.""" + +from __future__ import print_function + +#import unittest2 +import os.path +from time import sleep + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +exe_name = 'deep-bundle' # must match Makefile + +class DeepBundleTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipIfRemote + @skipUnlessDarwin + # This test is explicitly a dSYM test, it doesn't need to run for any other config, but + # the following doesn't work, fixme. + # @skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is looking explicitly for a dSYM") + + def setUp(self): + TestBase.setUp(self) + self.source = 'main.c' + + def tearDown(self): + # Destroy process before TestBase.tearDown() + self.dbg.GetSelectedTarget().GetProcess().Destroy() + + # Call super's tearDown(). + TestBase.tearDown(self) + + def test_attach_and_check_dsyms(self): + """Test attach to binary, see if the framework dSYM is found""" + exe = os.path.join(os.getcwd(), exe_name) + self.build() + popen = self.spawnSubprocess(exe) + self.addTearDownHook(self.cleanupSubprocesses) + + # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in + sleep(5) + + # Since the library that was dlopen()'ed is now removed, lldb will need to find the + # binary & dSYM via target.exec-search-paths + settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app" + self.runCmd(settings_str) + + self.runCmd("process attach -p " + str(popen.pid)) + + target = self.dbg.GetSelectedTarget() + self.assertTrue(target.IsValid(), 'Should have a valid Target after attaching to process') + + setup_complete = target.FindFirstGlobalVariable("setup_is_complete") + self.assertTrue(setup_complete.GetValueAsUnsigned() == 1, 'Check that inferior process has completed setup') + + # Find the bundle module, see if we found the dSYM too (they're both in "hide.app") + i = 0 + found_module = False + while i < target.GetNumModules(): + mod = target.GetModuleAtIndex(i) + if mod.GetFileSpec().GetFilename() == 'MyFramework': + found_module = True + dsym_name = mod.GetSymbolFileSpec().GetFilename() + self.assertTrue (dsym_name == 'MyFramework', "Check that we found the dSYM for the bundle that was loaded") + i=i+1 + + self.assertTrue(found_module, "Check that we found the framework loaded in lldb's image list") + +if __name__ == '__main__': + unittest.main() Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,22 @@ +#include +#include +#include + +int setup_is_complete = 0; + +int main() +{ + system ("/bin/rm -rf MyFramework MyFramework.framework MyFramework.framework.dSYM"); + + setup_is_complete = 1; + + // At this point we want lldb to attach to the process. If lldb attaches + // before we've removed the framework we're running against, it will be + // easy for lldb to find the binary & dSYM without using target.exec-search-paths, + // which is the point of this test. + + for (int loop_limiter = 0; loop_limiter < 100; loop_limiter++) + sleep (1); + + return foo(); +} Added: vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/myframework.c Fri Jun 16 21:04:22 2017 (r320023) @@ -0,0 +1,4 @@ +int foo () +{ + return 5; +} Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py Fri Jun 16 21:04:22 2017 (r320023) @@ -31,6 +31,7 @@ class TestGdbRemoteSingleStep(gdbremote_testcase.GdbRe "arm", "aarch64"], bugnumber="llvm.org/pr24739") + @skipIf(triple='^mips') def test_single_step_only_steps_one_instruction_with_s_llgs(self): self.init_llgs_test() self.build() Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py Fri Jun 16 21:04:22 2017 (r320023) @@ -108,6 +108,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemote "arm", "aarch64"], bugnumber="llvm.org/pr24739") + @skipIf(triple='^mips') def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self): self.init_llgs_test() self.build() @@ -136,6 +137,7 @@ class TestGdbRemote_vCont(gdbremote_testcase.GdbRemote "arm", "aarch64"], bugnumber="llvm.org/pr24739") + @skipIf(triple='^mips') def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs( self): self.init_llgs_test() Modified: vendor/lldb/dist/scripts/lldb.swig ============================================================================== --- vendor/lldb/dist/scripts/lldb.swig Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/scripts/lldb.swig Fri Jun 16 21:04:22 2017 (r320023) @@ -40,7 +40,13 @@ us to override the module import logic to suit our nee Older swig versions will simply ignore this setting. */ %define MODULEIMPORT -"from . import $module" +"try: + # Try a relative import first + from . import $module +except ImportError: + # Maybe absolute import will work (if we're being loaded from lldb, it + # should). + import $module" %enddef // These versions will not generate working python modules, so error out early. #if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011 Modified: vendor/lldb/dist/source/Commands/CommandObjectThread.cpp ============================================================================== --- vendor/lldb/dist/source/Commands/CommandObjectThread.cpp Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/source/Commands/CommandObjectThread.cpp Fri Jun 16 21:04:22 2017 (r320023) @@ -42,10 +42,44 @@ using namespace lldb; using namespace lldb_private; //------------------------------------------------------------------------- -// CommandObjectThreadBacktrace +// CommandObjectIterateOverThreads //------------------------------------------------------------------------- class CommandObjectIterateOverThreads : public CommandObjectParsed { + + class UniqueStack { + + public: + UniqueStack(std::stack stack_frames, uint32_t thread_index_id) + : m_stack_frames(stack_frames) { + m_thread_index_ids.push_back(thread_index_id); + } + + void AddThread(uint32_t thread_index_id) const { + m_thread_index_ids.push_back(thread_index_id); + } + + const std::vector &GetUniqueThreadIndexIDs() const { + return m_thread_index_ids; + } + + lldb::tid_t GetRepresentativeThread() const { + return m_thread_index_ids.front(); + } + + friend bool inline operator<(const UniqueStack &lhs, + const UniqueStack &rhs) { + return lhs.m_stack_frames < rhs.m_stack_frames; + } + + protected: + // Mark the thread index as mutable, as we don't care about it from a const + // perspective, we only care about m_stack_frames so we keep our std::set + // sorted. + mutable std::vector m_thread_index_ids; + std::stack m_stack_frames; + }; + public: CommandObjectIterateOverThreads(CommandInterpreter &interpreter, const char *name, const char *help, @@ -57,11 +91,15 @@ class CommandObjectIterateOverThreads : public Command bool DoExecute(Args &command, CommandReturnObject &result) override { result.SetStatus(m_success_return); + bool all_threads = false; if (command.GetArgumentCount() == 0) { Thread *thread = m_exe_ctx.GetThreadPtr(); if (!HandleOneThread(thread->GetID(), result)) return false; return result.Succeeded(); + } else if (command.GetArgumentCount() == 1) { + all_threads = ::strcmp(command.GetArgumentAtIndex(0), "all") == 0; + m_unique_stacks = ::strcmp(command.GetArgumentAtIndex(0), "unique") == 0; } // Use tids instead of ThreadSPs to prevent deadlocking problems which @@ -69,8 +107,7 @@ class CommandObjectIterateOverThreads : public Command // code while iterating over the (locked) ThreadSP list. std::vector tids; - if (command.GetArgumentCount() == 1 && - ::strcmp(command.GetArgumentAtIndex(0), "all") == 0) { + if (all_threads || m_unique_stacks) { Process *process = m_exe_ctx.GetProcessPtr(); for (ThreadSP thread_sp : process->Threads()) @@ -108,15 +145,47 @@ class CommandObjectIterateOverThreads : public Command } } - uint32_t idx = 0; - for (const lldb::tid_t &tid : tids) { - if (idx != 0 && m_add_return) - result.AppendMessage(""); + if (m_unique_stacks) { + // Iterate over threads, finding unique stack buckets. + std::set unique_stacks; + for (const lldb::tid_t &tid : tids) { + if (!BucketThread(tid, unique_stacks, result)) { + return false; + } + } - if (!HandleOneThread(tid, result)) - return false; + // Write the thread id's and unique call stacks to the output stream + Stream &strm = result.GetOutputStream(); + Process *process = m_exe_ctx.GetProcessPtr(); + for (const UniqueStack &stack : unique_stacks) { + // List the common thread ID's + const std::vector &thread_index_ids = + stack.GetUniqueThreadIndexIDs(); + strm.Printf("%lu thread(s) ", thread_index_ids.size()); + for (const uint32_t &thread_index_id : thread_index_ids) { + strm.Printf("#%u ", thread_index_id); + } + strm.EOL(); - ++idx; + // List the shared call stack for this set of threads + uint32_t representative_thread_id = stack.GetRepresentativeThread(); + ThreadSP thread = process->GetThreadList().FindThreadByIndexID( + representative_thread_id); + if (!HandleOneThread(thread->GetID(), result)) { + return false; + } + } + } else { + uint32_t idx = 0; + for (const lldb::tid_t &tid : tids) { + if (idx != 0 && m_add_return) + result.AppendMessage(""); + + if (!HandleOneThread(tid, result)) + return false; + + ++idx; + } } return result.Succeeded(); } @@ -134,7 +203,43 @@ class CommandObjectIterateOverThreads : public Command virtual bool HandleOneThread(lldb::tid_t, CommandReturnObject &result) = 0; + bool BucketThread(lldb::tid_t tid, std::set &unique_stacks, + CommandReturnObject &result) { + // Grab the corresponding thread for the given thread id. + Process *process = m_exe_ctx.GetProcessPtr(); + Thread *thread = process->GetThreadList().FindThreadByID(tid).get(); + if (thread == nullptr) { + result.AppendErrorWithFormat("Failed to process thread# %lu.\n", tid); + result.SetStatus(eReturnStatusFailed); + return false; + } + + // Collect the each frame's address for this call-stack + std::stack stack_frames; + const uint32_t frame_count = thread->GetStackFrameCount(); + for (uint32_t frame_index = 0; frame_index < frame_count; frame_index++) { + const lldb::StackFrameSP frame_sp = + thread->GetStackFrameAtIndex(frame_index); + const lldb::addr_t pc = frame_sp->GetStackID().GetPC(); + stack_frames.push(pc); + } + + uint32_t thread_index_id = thread->GetIndexID(); + UniqueStack new_unique_stack(stack_frames, thread_index_id); + + // Try to match the threads stack to and existing entry. + std::set::iterator matching_stack = + unique_stacks.find(new_unique_stack); + if (matching_stack != unique_stacks.end()) { + matching_stack->AddThread(thread_index_id); + } else { + unique_stacks.insert(new_unique_stack); + } + return true; + } + ReturnStatus m_success_return = eReturnStatusSuccessFinishResult; + bool m_unique_stacks = false; bool m_add_return = true; }; @@ -218,9 +323,10 @@ class CommandObjectThreadBacktrace : public CommandObj : CommandObjectIterateOverThreads( interpreter, "thread backtrace", "Show thread call stacks. Defaults to the current thread, thread " - "indexes can be specified as arguments. Use the thread-index " - "\"all\" " - "to see all threads.", + "indexes can be specified as arguments.\n" + "Use the thread-index \"all\" to see all threads.\n" + "Use the thread-index \"unique\" to see threads grouped by unique " + "call stacks.", nullptr, eCommandRequiresProcess | eCommandRequiresThread | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched | @@ -270,11 +376,14 @@ class CommandObjectThreadBacktrace : public CommandObj Stream &strm = result.GetOutputStream(); + // Only dump stack info if we processing unique stacks. + const bool only_stacks = m_unique_stacks; + // Don't show source context when doing backtraces. const uint32_t num_frames_with_source = 0; const bool stop_format = true; if (!thread->GetStatus(strm, m_options.m_start, m_options.m_count, - num_frames_with_source, stop_format)) { + num_frames_with_source, stop_format, only_stacks)) { result.AppendErrorWithFormat( "error displaying backtrace for thread: \"0x%4.4x\"\n", thread->GetIndexID()); Modified: vendor/lldb/dist/source/Core/Debugger.cpp ============================================================================== --- vendor/lldb/dist/source/Core/Debugger.cpp Fri Jun 16 21:04:18 2017 (r320022) +++ vendor/lldb/dist/source/Core/Debugger.cpp Fri Jun 16 21:04:22 2017 (r320023) @@ -112,6 +112,12 @@ OptionEnumValueElement g_language_enumerators[] = { "{ " \ "${module.file.basename}{`${function.name-with-args}" \ "{${frame.no-debug}${function.pc-offset}}}}" + +#define MODULE_WITH_FUNC_NO_ARGS \ + "{ " \ + "${module.file.basename}{`${function.name-without-args}" \ + "{${frame.no-debug}${function.pc-offset}}}}" + #define FILE_AND_LINE "{ at ${line.file.basename}:${line.number}}" #define IS_OPTIMIZED "{${function.is-optimized} [opt]}" @@ -141,6 +147,10 @@ OptionEnumValueElement g_language_enumerators[] = { "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE \ IS_OPTIMIZED "\\n" +#define DEFAULT_FRAME_FORMAT_NO_ARGS \ + "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC_NO_ARGS FILE_AND_LINE \ + IS_OPTIMIZED "\\n" + // Three parts to this disassembly format specification: // 1. If this is a new function/symbol (no previous symbol/function), print // dylib`funcname:\n @@ -186,13 +196,15 @@ static PropertyDefinition g_properties[] = { {"auto-confirm", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "If true all confirmation prompts will receive their default reply."}, {"disassembly-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_DISASSEMBLY_FORMAT, nullptr, "The default disassembly format " - "string to use when disassembling " - "instruction sequences."}, + DEFAULT_DISASSEMBLY_FORMAT, nullptr, + "The default disassembly format " + "string to use when disassembling " + "instruction sequences."}, {"frame-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_FRAME_FORMAT, nullptr, "The default frame format string to use " - "when displaying stack frame information " - "for threads."}, + DEFAULT_FRAME_FORMAT, nullptr, + "The default frame format string to use " + "when displaying stack frame information " + "for threads."}, {"notify-void", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Notify the user explicitly if an expression returns void (default: " "false)."}, @@ -203,18 +215,21 @@ static PropertyDefinition g_properties[] = { nullptr, g_language_enumerators, "The script language to be used for evaluating user-written scripts."}, {"stop-disassembly-count", OptionValue::eTypeSInt64, true, 4, nullptr, - nullptr, "The number of disassembly lines to show when displaying a " - "stopped context."}, + nullptr, + "The number of disassembly lines to show when displaying a " + "stopped context."}, {"stop-disassembly-display", OptionValue::eTypeEnum, true, Debugger::eStopDisassemblyTypeNoDebugInfo, nullptr, g_show_disassembly_enum_values, "Control when to display disassembly when displaying a stopped context."}, {"stop-line-count-after", OptionValue::eTypeSInt64, true, 3, nullptr, - nullptr, "The number of sources lines to display that come after the " - "current source line when displaying a stopped context."}, + nullptr, + "The number of sources lines to display that come after the " + "current source line when displaying a stopped context."}, {"stop-line-count-before", OptionValue::eTypeSInt64, true, 3, nullptr, - nullptr, "The number of sources lines to display that come before the " - "current source line when displaying a stopped context."}, + nullptr, + "The number of sources lines to display that come before the " + "current source line when displaying a stopped context."}, {"stop-show-column", OptionValue::eTypeEnum, false, eStopShowColumnAnsiOrCaret, nullptr, s_stop_show_column_values, "If true, LLDB will use the column information from the debug info to " @@ -232,19 +247,22 @@ static PropertyDefinition g_properties[] = { {"term-width", OptionValue::eTypeSInt64, true, 80, nullptr, nullptr, "The maximum number of columns to use for displaying text."}, {"thread-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_THREAD_FORMAT, nullptr, "The default thread format string to use " - "when displaying thread information."}, + DEFAULT_THREAD_FORMAT, nullptr, + "The default thread format string to use " + "when displaying thread information."}, {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, - DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format " - "string to usewhen displaying thread " - "information as part of the stop display."}, + DEFAULT_THREAD_STOP_FORMAT, nullptr, + "The default thread format " + "string to use when displaying thread " + "information as part of the stop display."}, {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Whether to use an external editor or not."}, {"use-color", OptionValue::eTypeBoolean, true, true, nullptr, nullptr, "Whether to use Ansi color codes or not."}, {"auto-one-line-summaries", OptionValue::eTypeBoolean, true, true, nullptr, - nullptr, "If true, LLDB will automatically display small structs in " - "one-liner format (default: true)."}, + nullptr, + "If true, LLDB will automatically display small structs in " + "one-liner format (default: true)."}, {"auto-indent", OptionValue::eTypeBoolean, true, true, nullptr, nullptr, "If true, LLDB will auto indent/outdent code. Currently only supported in " "the REPL (default: true)."}, @@ -255,8 +273,13 @@ static PropertyDefinition g_properties[] = { "The tab size to use when indenting code in multi-line input mode " "(default: 4)."}, {"escape-non-printables", OptionValue::eTypeBoolean, true, true, nullptr, - nullptr, "If true, LLDB will automatically escape non-printable and " - "escape characters when formatting strings."}, + nullptr, + "If true, LLDB will automatically escape non-printable and " + "escape characters when formatting strings."}, + {"frame-format-unique", OptionValue::eTypeFormatEntity, true, 0, + DEFAULT_FRAME_FORMAT_NO_ARGS, nullptr, + "The default frame format string to use when displaying stack frame" + "information for threads from thread backtrace unique."}, {nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, nullptr, nullptr}}; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:20 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21506D89357; Fri, 16 Jun 2017 21:04:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B83B16F8F8; Fri, 16 Jun 2017 21:04:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL4IVR063865; Fri, 16 Jun 2017 21:04:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL4IDN063864; Fri, 16 Jun 2017 21:04:18 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL4IDN063864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320022 - vendor/lld/lld-trunk-r305575 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:20 -0000 Author: dim Date: Fri Jun 16 21:04:18 2017 New Revision: 320022 URL: https://svnweb.freebsd.org/changeset/base/320022 Log: Tag lld trunk r305575. Added: vendor/lld/lld-trunk-r305575/ - copied from r320021, vendor/lld/dist/ From owner-svn-src-vendor@freebsd.org Fri Jun 16 21:04:30 2017 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A387D893E9; Fri, 16 Jun 2017 21:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EA976FA26; Fri, 16 Jun 2017 21:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5GL4TtP063989; Fri, 16 Jun 2017 21:04:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5GL4Tt2063988; Fri, 16 Jun 2017 21:04:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201706162104.v5GL4Tt2063988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 16 Jun 2017 21:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r320024 - vendor/lldb/lldb-trunk-r305575 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 21:04:30 -0000 Author: dim Date: Fri Jun 16 21:04:29 2017 New Revision: 320024 URL: https://svnweb.freebsd.org/changeset/base/320024 Log: Tag lldb trunk r305575. Added: vendor/lldb/lldb-trunk-r305575/ - copied from r320023, vendor/lldb/dist/