lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWY4AeMxfNGh_jB4gss_qtGSgfX4pvv-D-fpCWuqamVfA@mail.gmail.com>
Date: Mon, 15 Jul 2024 13:06:40 -0700
From: Ian Rogers <irogers@...gle.com>
To: Leo Yan <leo.yan@....com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...nel.org>, 
	Adrian Hunter <adrian.hunter@...el.com>, "Liang, Kan" <kan.liang@...ux.intel.com>, 
	Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>, 
	Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>, 
	James Clark <james.clark@...aro.org>, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] perf docs: Mark the Android document as obsolete

On Mon, Jul 15, 2024 at 12:44 PM Ian Rogers <irogers@...gle.com> wrote:
>
> On Mon, Jul 15, 2024 at 12:31 PM Leo Yan <leo.yan@....com> wrote:
> >
> >
> > Hi Ian,
> >
> > On 7/15/24 18:17, Ian Rogers wrote:
> > > On Mon, Jul 15, 2024 at 7:34 AM Leo Yan <leo.yan@....com> wrote:
> > > [snip]
> > >> +Android NDK compilation is deprecated and no longer supported.
> > >
> > > I think this is objectively worse than just removing the file. It is
> > > likely the perf tool can build with clang/LLVM, I do it every day
> >
> > Just curious, are you using LLVM/clang for cross building (e.g. build
> > aarch64 target on x86_64 host) or just native building?
> >
> > Clang/LLVM is a natively cross-compiler [1], I installed Clang-15 in the
> > offical package on Ubuntu, but I failed to do cross compilation with it:
> >
> >    make ARCH=arm64 LLVM=-15 VF=1 DEBUG=1 -C tools/perf
>
> So we're cross-compiling in bazel, so it is a different set up than
> the makefiles - I'm happy to work to share the bazel set up if other
> people care. I'm having a play to see if I can get the Makefile
> working, my first attempts are clearly mixing x86 code into the
> supposedly arm64 build, which would appear to be more of a build
> system rather than code problem.

So if I add (somewhat taken from tools/testing/selftests/lib.mk):
```
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 5271a4c1d2b3..9edf5f41d6e4 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -19,6 +19,35 @@ detected_var = $(shell echo "$(1)=$($(1))" >>
$(OUTPUT).config-detected)
CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))

+CLANG := clang
+
+CLANG_TARGET_FLAGS_arm          := arm-linux-gnueabi
+CLANG_TARGET_FLAGS_arm64        := aarch64-linux-gnu
+CLANG_TARGET_FLAGS_hexagon      := hexagon-linux-musl
+CLANG_TARGET_FLAGS_i386         := i386-linux-gnu
+CLANG_TARGET_FLAGS_m68k         := m68k-linux-gnu
+CLANG_TARGET_FLAGS_mips         := mipsel-linux-gnu
+CLANG_TARGET_FLAGS_powerpc      := powerpc64le-linux-gnu
+CLANG_TARGET_FLAGS_riscv        := riscv64-linux-gnu
+CLANG_TARGET_FLAGS_s390         := s390x-linux-gnu
+CLANG_TARGET_FLAGS_x86          := x86_64-linux-gnu
+CLANG_TARGET_FLAGS_x86_64       := x86_64-linux-gnu
+
+# Default to host architecture if ARCH is not explicitly given.
+ifeq ($(ARCH),)
+CLANG_TARGET_FLAGS := $(shell $(CLANG) -print-target-triple)
+else
+CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH))
+endif
+
+ifeq ($(CLANG_TARGET_FLAGS),)
+$(error Specify CROSS_COMPILE or add '--target=' option to lib.mk)
+else
+CLANG_FLAGS     += --target=$(CLANG_TARGET_FLAGS)
+endif # CLANG_TARGET_FLAGS
+
+CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as
+
# Enabled Wthread-safety analysis for clang builds.
ifeq ($(CC_NO_CLANG), 0)
  CFLAGS += -Wthread-safety
```
I was able to build with:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
O=/tmp/perf NO_LIBELF=1 NO_LIBTRACEEVENT=1 NO_LIBPYTHON=1 CC=clang
CXX=clang++

Obviously not a complete fix as it is unconditionally forcing CC to
clang, but I don't think we're too far from having a clang/llvm cross
compile build that can work.

Thanks,
Ian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ