Re: [PATCH v5] docs/zh_CN: add translations in zh_CN/dev-tools/gcov

2021-04-14 Thread Fangrui Song
Reviewed-by: Fangrui Song Inlined some suggestions. On 2021-04-14, Alex Shi wrote: Reviewed-by: Alex Shi On 2021/4/14 下午9:21, Wu XiangCheng wrote: From: Bernard Zhao Add new zh translations * zh_CN/dev-tools/gcov.rst * zh_CN/dev-tools/index.rst and link them to zh_CN/index.rst Signed

Re: [PATCH 2/2] gcov: re-drop support for clang-10

2021-04-07 Thread Fangrui Song
pos += store_gcov_u32(buffer, pos, GCOV_TAG_COUNTER_BASE); pos += store_gcov_u32(buffer, pos, fi_ptr->num_counters * 2); for (i = 0; i < fi_ptr->num_counters; i++) -- 2.31.1.295.g9ea45b61b8-goog Looks good for both. Thanks! Reviewed-by: Fangrui Song

Re: [PATCH] riscv: Use $(LD) instead of $(CC) to link vDSO

2021-03-26 Thread Fangrui Song
style=both can be --hash-style=gnu. We don't need sysv .hash . The glibc/musl support for .gnu.hash has been there for years. .gnu.hash is often smaller than .hash . Reviewed-by: Fangrui Song Additionally, since this area is being modified, use the $(OBJCOPY) variable instead of an open coded

Re: [PATCH] riscv: Use $(LD) instead of $(CC) to link vDSO

2021-03-26 Thread Fangrui Song
On 2021-03-26, Nathan Chancellor wrote: On Sat, Mar 27, 2021 at 12:05:34AM +0800, kernel test robot wrote: Hi Nathan, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.12-rc4 next-20210326] [If your patch is applied to the

Re: [PATCH 3/3] riscv: Select HAVE_DYNAMIC_FTRACE when -fpatchable-function-entry is available

2021-03-25 Thread Fangrui Song
is not available. If clang -fpatchable-function-entry=8 does not error "unsupported option" for one target, it means the backend feature is supported on this target. Reviewed-by: Fangrui Song Fixes: afc76b8b8011 ("riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT") Link

Re: [PATCH 1/3] scripts/recordmcount.pl: Fix RISC-V regex for clang

2021-03-25 Thread Fangrui Song
this, the __start_mcount_loc section is properly generated and function tracing still works. R_RISCV_CALL_PLT can replace R_RISCV_CALL in all use cases. R_RISCV_CALL can/may be deprecated: https://github.com/ClangBuiltLinux/linux/issues/1331#issuecomment-802468296 Reviewed-by: Fangrui Song Cc: sta

Re: [PATCH] gcov: fix clang-11+ support

2021-03-12 Thread Fangrui Song
On 2021-03-12, Nick Desaulniers wrote: On Fri, Mar 12, 2021 at 12:25 PM 'Fangrui Song' via Clang Built Linux wrote: function_name can be unconditionally deleted. It is not used by llvm-cov gcov. You'll need to delete a few assignments to gcov_info_free but you can then unify

Re: [PATCH] gcov: fix clang-11+ support

2021-03-12 Thread Fangrui Song
://reviews.llvm.org/rGcdd683b516d147925212724b09ec6fb792a40041 Link: https://reviews.llvm.org/rG13a633b438b6500ecad9e4f936ebadf3411d0f44 Cc: Fangrui Song Reported-by: Prasad Sodagudi Signed-off-by: Nick Desaulniers --- kernel/gcov/clang.c | 69 + 1 file changed, 69

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Fangrui Song
On 2021-03-10, Nicolas Pitre wrote: On Mon, 1 Mar 2021, Nicholas Piggin wrote: Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > Unlike what Nick expected in his submission, I now think the annotations > will be needed for LTO just like they are for --gc-sections. Yeah I

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Fangrui Song
On 2021-03-10, Arnd Bergmann wrote: On Wed, Mar 10, 2021 at 9:50 PM Masahiro Yamada wrote: On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: masahiro@oscar:~/ref/linux$ echo 'void this_func_is_unused(void) {}' >>

Re: [PATCH v2 1/2] Makefile: Remove '--gcc-toolchain' flag

2021-03-09 Thread Fangrui Song
llor The wording looks good. Reviewed-by: Fangrui Song

[PATCH] Replace __toc_start + 0x8000 with .TOC.

2021-03-06 Thread Fangrui Song
with CONFIG_PPC_OF_BOOT_TRAMPOLINE=y is bootable with LLD. There is still an untriaged issue with Alexey's configuration. Link: https://github.com/ClangBuiltLinux/linux/issues/1318 Reported-by: Alexey Kardashevskiy Signed-off-by: Fangrui Song --- arch/powerpc/boot/crt0.S| 2 +- arch/powerpc/boot

Re: [PATCH 1/2] Makefile: Remove '--gcc-toolchain' flag

2021-03-03 Thread Fangrui Song
On 2021-03-03, Masahiro Yamada wrote: Hi. On Wed, Mar 3, 2021 at 6:44 AM Fangrui Song wrote: Reviewed-by: Fangrui Song Thanks for the clean-up! --gcc-toolchain= is an obsscure way searching for GCC installation prefixes (--prefix). The logic is complex and different for different

Re: [PATCH 2/2] Makefile: Only specify '--prefix=' when building with clang + GNU as

2021-03-02 Thread Fangrui Song
Chancellor Reviewed-by: Fangrui Song clang can spawn GNU as (if -f?no-integrated-as is specified) and GNU objcopy (-f?no-integrated-as and -gsplit-dwarf and -g[123]). With LLVM_IAS=1, these cases are ruled out.

Re: [PATCH 1/2] Makefile: Remove '--gcc-toolchain' flag

2021-03-02 Thread Fangrui Song
Reviewed-by: Fangrui Song Thanks for the clean-up! --gcc-toolchain= is an obsscure way searching for GCC installation prefixes (--prefix). The logic is complex and different for different distributions/architectures. If we specify --prefix= (-B) explicitly, --gcc-toolchain is not needed

Re: [PATCH v8] pgo: add clang's Profile Guided Optimization infrastructure

2021-02-28 Thread Fangrui Song
On 2021-02-28, Fangrui Song wrote: Reviewed-by: Fangrui Song Some minor items below: On 2021-02-26, 'Bill Wendling' via Clang Built Linux wrote: From: Sami Tolvanen Enable the use of clang's Profile-Guided Optimization[1]. To generate a profile, the kernel is instrumented with PGO counters

Re: [PATCH v8] pgo: add clang's Profile Guided Optimization infrastructure

2021-02-28 Thread Fangrui Song
Reviewed-by: Fangrui Song Some minor items below: On 2021-02-26, 'Bill Wendling' via Clang Built Linux wrote: From: Sami Tolvanen Enable the use of clang's Profile-Guided Optimization[1]. To generate a profile, the kernel is instrumented with PGO counters, a representative workload is run

Re: [PATCH RFC] x86: remove toolchain check for X32 ABI capability

2021-02-27 Thread Fangrui Song
On 2021-02-28, Masahiro Yamada wrote: This commit reverts 0bf6276392e9 ("x32: Warn and disable rather than error if binutils too old"). The help text in arch/x86/Kconfig says enabling the X32 ABI support needs binutils 2.22 or later. This is met because the minimal binutils version is 2.23

Re: [PATCH] arm64: vmlinux.lds.S: keep .entry.tramp.text section

2021-02-26 Thread Fangrui Song
und problems, but it not good for CONFIG_LD_DEAD_CODE_DATA_ELIMINATION. Reviewed-by: Fangrui Song This happens when any reference to the trampoline is discarded at link time. Marking the section as KEEP() avoids the assertion, but I have not figured out whether this is the correct solution for th

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-26 Thread Fangrui Song
On 2021-02-25, Arnd Bergmann wrote: From: Arnd Bergmann When looking at kernel size optimizations, I found that arm64 does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which enables the --gc-sections flag to the linker. I see that for a defconfig build with llvm, there are some

Re: [PATCH v7 1/2] Kbuild: make DWARF version a choice

2021-02-04 Thread Fangrui Song
On 2021-02-04, Nick Desaulniers wrote: On Thu, Feb 4, 2021 at 12:28 PM Mark Wielaard wrote: On Thu, 2021-02-04 at 12:04 -0800, Nick Desaulniers wrote: > On Thu, Feb 4, 2021 at 11:56 AM Mark Wielaard wrote: > > I agree with Jakub. Now that GCC has defaulted to DWARF5 all the > > tools > >

Re: [PATCH v7 1/2] Kbuild: make DWARF version a choice

2021-02-03 Thread Fangrui Song
atible with existing > configs, and makes adding future versions more straightforward. > > GCC since ~4.8 has defaulted to this DWARF version implicitly. > > Suggested-by: Arvind Sankar > Suggested-by: Fangrui Song > Suggested-by: Nathan Chancellor > Suggested-by: Masahiro

Re: [PATCH v6 2/2] Kbuild: implement support for DWARF v5

2021-01-29 Thread Fangrui Song
ine Tice Suggested-by: Fangrui Song Suggested-by: Jakub Jelinek Suggested-by: Masahiro Yamada Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Makefile | 12 include/asm-generic/vmlinux.lds.h | 6 +- lib/Kconfig.de

Re: [PATCH v6 2/2] Kbuild: implement support for DWARF v5

2021-01-29 Thread Fangrui Song
ine Tice Suggested-by: Fangrui Song Suggested-by: Jakub Jelinek Suggested-by: Masahiro Yamada Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Makefile | 12 include/asm-generic/vmlinux.lds.h | 6 +- lib/Kconfig.de

Re: [PATCH] vmlinux.lds.h: Define SANTIZER_DISCARDS with CONFIG_GCOV_KERNEL=y

2021-01-29 Thread Fangrui Song
d(CONFIG_GCOV_KERNEL) # ifdef CONFIG_CONSTRUCTORS # define SANITIZER_DISCARDS \ *(.eh_frame) base-commit: bec4c2968fce2f44ce62d05288a633cd99a722eb -- 2.30.0 Drop -ftest-coverage. -ftest-coverage just produces .gcno and does not affect code gen

[tip: x86/build] x86/build: Treat R_386_PLT32 relocation as R_386_PC32

2021-01-28 Thread tip-bot2 for Fangrui Song
The following commit has been merged into the x86/build branch of tip: Commit-ID: bb73d07148c405c293e576b40af37737faf23a6a Gitweb: https://git.kernel.org/tip/bb73d07148c405c293e576b40af37737faf23a6a Author:Fangrui Song AuthorDate:Wed, 27 Jan 2021 12:56:00 -08:00 Committer

[PATCH v4] x86: Treat R_386_PLT32 as R_386_PC32

2021-01-27 Thread Fangrui Song
s, because preventing canonical PLT entries is weighed over the rare ifunc diagnostic. Link: https://github.com/ClangBuiltLinux/linux/issues/1210 Reported-by: Arnd Bergmann Signed-off-by: Fangrui Song Reviewed-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Tested-by: Nick Desaulniers Tested-

Re: [PATCH v3] x86: Treat R_386_PLT32 as R_386_PC32

2021-01-25 Thread Fangrui Song
github.com/ClangBuiltLinux/linux/issues/1210 Reported-by: Arnd Bergmann Signed-off-by: Fangrui Song Reviewed-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Tested-by: Nick Desaulniers Tested-by: Nathan Chancellor On Thu, Jan 14, 2021 at 02:48:19PM -0800, Fangrui Song wrote: This is similar

Re: [PATCH v4 00/10] Function Granular KASLR

2021-01-23 Thread Fangrui Song
On 2020-08-28, Josh Poimboeuf wrote: On Fri, Aug 28, 2020 at 12:21:13PM +0200, Miroslav Benes wrote: > Hi there! I was trying to find a super easy way to address this, so I > thought the best thing would be if there were a compiler or linker > switch to just eliminate any duplicate symbols at

Re: [PATCH bpf-next v2] samples/bpf: Update README.rst and Makefile for manually compiling LLVM and clang

2021-01-19 Thread Fangrui Song
On 2021-01-19, Tiezhu Yang wrote: The current llvm/clang build procedure in samples/bpf/README.rst is out of date. See below that the links are not accessible any more. $ git clone http://llvm.org/git/llvm.git Cloning into 'llvm'... fatal: unable to access 'http://llvm.org/git/llvm.git/':

Re: [PATCH v5 2/3] Kbuild: make DWARF version a choice

2021-01-15 Thread Fangrui Song
adding future versions more straightforward. Suggested-by: Arvind Sankar Suggested-by: Fangrui Song Suggested-by: Masahiro Yamada Signed-off-by: Nick Desaulniers --- Makefile | 13 ++--- lib/Kconfig.debug | 21 - 2 files changed, 22 insertions(+), 12

Re: [PATCH v5 1/3] Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4

2021-01-15 Thread Fangrui Song
On 2021-01-15, Nick Desaulniers wrote: From: Masahiro Yamada The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang. You can see it at https://godbolt.org/z/6ed1oW For gcc 4.5.3 pane,line 37:.value 0x4 For clang 10.0.1 pane, line 117: .short 4 Given

Re: [PATCH] mips: vdso: fix DWARF2 warning

2021-01-15 Thread Fangrui Song
On 2021-01-15, Anders Roxell wrote: On Fri, 15 Jan 2021 at 20:28, Nathan Chancellor wrote: On Fri, Jan 15, 2021 at 08:13:30PM +0100, Anders Roxell wrote: > When building mips tinyconifg the following warning show up > > make --silent --keep-going --jobs=8

[PATCH v3] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols

2021-01-15 Thread Fangrui Song
ode should be refactored to ignore unreferenced symbols. Reported-by: Marco Elver Link: https://github.com/ClangBuiltLinux/linux/issues/1250 Signed-off-by: Fangrui Song Reviewed-by: Nick Desaulniers Tested-by: Marco Elver Cc: --- Changes in v2: * Fix Marco's email address * Add a funct

[PATCH v3] x86: Treat R_386_PLT32 as R_386_PC32

2021-01-14 Thread Fangrui Song
lity ifunc for shared objects. https://sourceware.org/bugzilla/show_bug.cgi?id=27169 Link: https://github.com/ClangBuiltLinux/linux/issues/1210 Reported-by: Arnd Bergmann Signed-off-by: Fangrui Song Reviewed-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Tested-by: Nick Desaulniers Tested-

[PATCH v2] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols

2021-01-14 Thread Fangrui Song
ode should be refactored to ignore unreferenced symbols. Reported-by: Marco Elver Link: https://github.com/ClangBuiltLinux/linux/issues/1250 Signed-off-by: Fangrui Song --- kernel/module.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) --- Changes in v2: * Fix Marco's em

[PATCH] module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols

2021-01-13 Thread Fangrui Song
ode should be refactored to ignore unreferenced symbols. Reported-by: Marco Elver Link: https://github.com/ClangBuiltLinux/linux/issues/1250 Signed-off-by: Fangrui Song --- kernel/module.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/module.c b/kernel/modul

Re: [PATCH v3] x86/entry: emit a symbol for register restoring thunk

2021-01-11 Thread Fangrui Song
if they do not exist in object files. rg 'SYM_CODE.*\.L' reveals a few other .S files which may have similar problems. Cc: Fangrui Song Link: https://github.com/ClangBuiltLinux/linux/issues/1209 Link: https://reviews.llvm.org/D93783 Link: https://sourceware.org/binutils/docs/as/Symbol-Names.html Link

Re: [PATCH] pgo: add clang's Profile Guided Optimization infrastructure

2021-01-11 Thread Fangrui Song
On 2021-01-11, Bill Wendling wrote: On Mon, Jan 11, 2021 at 12:12 PM Fangrui Song wrote: On 2021-01-11, 'Bill Wendling' via Clang Built Linux wrote: >From: Sami Tolvanen > >Enable the use of clang's Profile-Guided Optimization[1]. To generate a >profile, the kernel is instrumen

Re: [PATCH] pgo: add clang's Profile Guided Optimization infrastructure

2021-01-11 Thread Fangrui Song
On 2021-01-11, 'Bill Wendling' via Clang Built Linux wrote: From: Sami Tolvanen Enable the use of clang's Profile-Guided Optimization[1]. To generate a profile, the kernel is instrumented with PGO counters, a representative workload is run, and the raw profile data is collected from

[PATCH v2] x86: Treat R_386_PLT32 as R_386_PC32

2021-01-07 Thread Fangrui Song
/llvm-project/commit/961f31d8ad14c66829991522d73e14b5a96ff6d4 Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112 Reported-by: Arnd Bergmann Signed-off-by: Fangrui Song Reviewed-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Tested-by: Nick Desaulniers Tested-by: Nathan Chancellor --- Change in

Re: [PATCH 4/4] x86: don't build CONFIG_X86_32 as -ffreestanding

2021-01-06 Thread Fangrui Song
CFLAGS += $(cflags-y) - -# temporary until string.h is fixed -KBUILD_CFLAGS += -ffreestanding else BITS := 64 UTS_MACHINE := x86_64 -- 2.28.0.220.ged08abb693-goog Reviewed-by: Fangrui Song But dropping -ffreestanding causes compiler produced declarations

[PATCH] x86: Treat R_386_PLT32 as R_386_PC32

2021-01-06 Thread Fangrui Song
rted-by: Arnd Bergmann Signed-off-by: Fangrui Song --- arch/x86/kernel/module.c | 1 + arch/x86/tools/relocs.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 34b153cbd4ac..5e9a34b5bd74 100644 --- a/arch/x86/kernel/module.c

Re: building csky with CC=clang

2020-12-22 Thread Fangrui Song
On 2020-12-22, 'Nick Desaulniers' via Clang Built Linux wrote: Hello! I was playing with some of LLVM's experimental backends (m68k) and saw there was a CSKY backend. I rebuilt LLVM to support CSKY, but I ran into trouble building the kernel before even getting to the compiler invocation: $

Re: [PATCH v8 00/16] Add support for Clang LTO

2020-12-08 Thread Fangrui Song
On 2020-12-08, 'Sami Tolvanen' via Clang Built Linux wrote: On Tue, Dec 8, 2020 at 4:15 AM Arnd Bergmann wrote: On Tue, Dec 1, 2020 at 10:37 PM 'Sami Tolvanen' via Clang Built Linux wrote: > > This patch series adds support for building the kernel with Clang's > Link Time Optimization

[PATCH v2] firmware_loader: Align .builtin_fw to 8

2020-12-07 Thread Fangrui Song
ALIGN(8). Fixes: 5658c76 ("firmware: allow firmware files to be built into kernel image") Link: https://github.com/ClangBuiltLinux/linux/issues/1204 Reported-by: kernel test robot Signed-off-by: Fangrui Song Acked-by: Arnd Bergmann --- Change in v2: * Use output section alignme

Re: [PATCH] firmware_loader: Align .builtin_fw to 8

2020-12-03 Thread Fangrui Song
On 2020-12-03, Nick Desaulniers wrote: On Thu, Dec 3, 2020 at 9:05 AM Fangrui Song wrote: arm64 references the start address of .builtin_fw (__start_builtin_fw) with a pair of R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_LDST64_ABS_LO12_NC relocations. The compiler is allowed to emit

[PATCH] firmware_loader: Align .builtin_fw to 8

2020-12-03 Thread Fangrui Song
ink: https://github.com/ClangBuiltLinux/linux/issues/1204 Reported-by: kernel test robot Signed-off-by: Fangrui Song --- include/asm-generic/vmlinux.lds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b2b3d81b1535..3c

Re: [PATCH v2 2/4] Kbuild: do not emit debug info for assembly with LLVM_IAS=1

2020-11-04 Thread Fangrui Song
, the option is of very low value, at least for LLVM. Reviewed-by: Fangrui Song

[tip: x86/urgent] x86/lib: Change .weak to SYM_FUNC_START_WEAK for arch/x86/lib/mem*_64.S

2020-11-04 Thread tip-bot2 for Fangrui Song
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 4d6ffa27b8e5116c0abb318790fd01d4e12d75e6 Gitweb: https://git.kernel.org/tip/4d6ffa27b8e5116c0abb318790fd01d4e12d75e6 Author:Fangrui Song AuthorDate:Mon, 02 Nov 2020 17:23:58 -08:00

[PATCH] perf bench: Update arch/x86/lib/mem{cpy,set}_64.S

2020-11-03 Thread Fangrui Song
lude/linux/linkage.h Fixes: 7d7d1bf1d1da ("perf bench: Copy kernel files needed to build mem{cpy,set} x86_64 benchmarks") Link: https://lore.kernel.org/r/20201103012358.168682-1-mask...@google.com Signed-off-by: Fangrui Song --- tools/arch/x86/lib/memcpy_64.S | 4 +--- tools/arch

Re: [PATCH] module: use hidden visibility for weak symbol references

2020-10-27 Thread Fangrui Song
One nit about ".got" in the message: Reviewed-by: Fangrui Song On 2020-10-27, Nick Desaulniers wrote: + Fangrui On Tue, Oct 27, 2020 at 8:11 AM Ard Biesheuvel wrote: Geert reports that commit be2881824ae9eb92 ("arm64/build: Assert for unwanted sections") results in b

Re: [PATCH] Kbuild: implement support for DWARF5

2020-10-21 Thread Fangrui Song
On 2020-10-21, 'Nick Desaulniers' via Clang Built Linux wrote: DWARF5 is the latest standard of the DWARF debug info format. Feature detection of DWARF5 is onerous, especially given that we've removed $(AS), so we must query $(CC) for DWARF5 assembler directive support. Further -gdwarf-X where

Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e

2020-09-16 Thread Fangrui Song
On 2020-09-16, 'Marco Elver' via Clang Built Linux wrote: On Wed, 16 Sep 2020 at 20:22, 'Nick Desaulniers' via kasan-dev wrote: On Wed, Sep 16, 2020 at 1:46 AM Marco Elver wrote: > > On Wed, 16 Sep 2020 at 10:30, wrote: > > On Tue, Sep 15, 2020 at 08:09:16PM +0200, Marco Elver wrote: > > >

Re: [PATCH v2 2/7] Revert "kbuild: disable clang's default use of -fmerge-all-constants"

2020-09-01 Thread Fangrui Song
-6? (Both gcc|clang -fmerge-all-constants can cause an assertion failure for the example on https://bugs.llvm.org/show_bug.cgi?id=18538 ) Reviewed-by: Fangrui Song --- Makefile | 9 - 1 file changed, 9 deletions(-) diff --git a/Makefile b/Makefile index 37739ee53f27..144ac6a07

Re: [PATCH v5 23/36] arm/build: Explicitly keep .ARM.attributes sections

2020-08-17 Thread Fangrui Song
ernal linker scripts (ld --verbose output) use 0 for such non-SHF_ALLOC sections. Without the 0, the section may get a non-zero address, which is not wrong - but probably does not look well. See https://reviews.llvm.org/D85867 for details. Reviewed-by: Fangrui Song + #d

Re: [PATCH v2] lib/string.c: implement stpcpy

2020-08-15 Thread Fangrui Song
On 2020-08-15, 'Nick Desaulniers' via Clang Built Linux wrote: On Sat, Aug 15, 2020 at 2:31 PM Joe Perches wrote: On Sat, 2020-08-15 at 14:28 -0700, Nick Desaulniers wrote: > On Sat, Aug 15, 2020 at 2:24 PM Joe Perches wrote: > > On Sat, 2020-08-15 at 13:47 -0700, Nick Desaulniers wrote: > >

Re: [PATCH v3] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation

2020-07-21 Thread Fangrui Song
On 2020-07-22, Masahiro Yamada wrote: On Wed, Jul 22, 2020 at 9:14 AM Fangrui Song wrote: On 2020-07-22, Masahiro Yamada wrote: >On Wed, Jul 22, 2020 at 2:31 AM 'Fangrui Song' via Clang Built Linux > wrote: >> >> When CROSS_COMPILE is set (e.g. aarch64-linux-gnu-), if

Re: [PATCH v3] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation

2020-07-21 Thread Fangrui Song
On 2020-07-22, Masahiro Yamada wrote: On Wed, Jul 22, 2020 at 2:31 AM 'Fangrui Song' via Clang Built Linux wrote: When CROSS_COMPILE is set (e.g. aarch64-linux-gnu-), if $(CROSS_COMPILE)elfedit is found at /usr/bin/aarch64-linux-gnu-elfedit, GCC_TOOLCHAIN_DIR will be set to /usr/bin

[PATCH v3] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation

2020-07-21 Thread Fangrui Song
find the appropriate cross compiling GNU as (when -no-integrated-as is in effect). Cc: sta...@vger.kernel.org Reported-by: Nathan Chancellor Signed-off-by: Fangrui Song Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Tested-by: Nick Desaulniers Link: https://github.com

[PATCH v2] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation

2020-07-20 Thread Fangrui Song
find the appropriate cross compiling GNU as (when -no-integrated-as is in effect). Reported-by: Nathan Chancellor Signed-off-by: Fangrui Song Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Tested-by: Nick Desaulniers Link: https://github.com/ClangBuiltLinux/linux/issues/1099

Re: [PATCH] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation

2020-07-20 Thread Fangrui Song
On 2020-07-20, Nick Desaulniers wrote: On Mon, Jul 20, 2020 at 11:16 AM Nathan Chancellor wrote: On Mon, Jul 20, 2020 at 11:12:22AM -0700, Fangrui Song wrote: > When CROSS_COMPILE is set (e.g. aarch64-linux-gnu-), if > $(CROSS_COMPILE)elfedit is found at /usr/bin/aarch64-lin

[PATCH] Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation

2020-07-20 Thread Fangrui Song
-by: Nathan Chancellor Signed-off-by: Fangrui Song Link: https://github.com/ClangBuiltLinux/linux/issues/1099 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0b5f8538bde5..3ac83e375b61 100644 --- a/Makefile +++ b/Makefile @@ -567,7 +567,7

Re: Plumbers session on GNU+LLVM collab?

2020-07-10 Thread Fangrui Song
On 2020-07-09, 'Nick Desaulniers' via Clang Built Linux wrote: Hi Segher, Rasmus, and Ramana, I am working on finalizing a proposal for an LLVM microconference at plumbers, which is focusing on a lot of issues we currently face on the LLVM side. I'd really like to host a session with more GNU

Re: [PATCH v3 7/7] x86/boot: Check that there are no runtime relocations

2020-06-30 Thread Fangrui Song
* Ard Biesheuvel On Tue, 30 Jun 2020 at 01:34, Fangrui Song wrote: > > On 2020-06-29, Ard Biesheuvel wrote: > >On Mon, 29 Jun 2020 at 19:37, Fangrui Song wrote: > >> > >> On 2020-06-29, Arvind Sankar wrote: > >> >On Mon, Jun 29, 2020 at 09:20:31AM -070

Re: [PATCH v3 7/7] x86/boot: Check that there are no runtime relocations

2020-06-29 Thread Fangrui Song
On 2020-06-29, Ard Biesheuvel wrote: On Mon, 29 Jun 2020 at 19:37, Fangrui Song wrote: On 2020-06-29, Arvind Sankar wrote: >On Mon, Jun 29, 2020 at 09:20:31AM -0700, Kees Cook wrote: >> On Mon, Jun 29, 2020 at 06:11:59PM +0200, Ard Biesheuvel wrote: >> > On Mon, 29 Jun 2

Re: [PATCH v3 7/7] x86/boot: Check that there are no runtime relocations

2020-06-29 Thread Fangrui Song
ker option, as they > > > are available in all supported gcc and binutils versions (as well as > > > clang and lld). > > > > > > Signed-off-by: Arvind Sankar > > > Reviewed-by: Ard Biesheuvel > > > Reviewed-by: Fangrui Song > > > ---

Re: [PATCH v3 2/9] vmlinux.lds.h: Add .symtab, .strtab, and .shstrtab to STABS_DEBUG

2020-06-24 Thread Fangrui Song
On 2020-06-24, Arvind Sankar wrote: On Wed, Jun 24, 2020 at 09:16:43AM -0700, Fangrui Song wrote: On 2020-06-24, Arvind Sankar wrote: >On Tue, Jun 23, 2020 at 06:49:33PM -0700, Kees Cook wrote: >> When linking vmlinux with LLD, the synthetic sections .symtab, .strtab, >>

Re: [PATCH v3 2/9] vmlinux.lds.h: Add .symtab, .strtab, and .shstrtab to STABS_DEBUG

2020-06-24 Thread Fangrui Song
n '.symtab' ld.lld: warning: :(.shstrtab) is being placed in '.shstrtab' ld.lld: warning: :(.strtab) is being placed in '.strtab' [1] https://lore.kernel.org/lkml/2020064928.o2a7jkq33guxf...@google.com/ Reported-by: Fangrui Song Reviewed-by: Fangrui Song Signed-off-by: Kees Cook --- includ

Re: [PATCH v3 3/9] efi/libstub: Remove .note.gnu.property

2020-06-23 Thread Fangrui Song
On 2020-06-23, Kees Cook wrote: In preparation for adding --orphan-handling=warn to more architectures, make sure unwanted sections don't end up appearing under the .init section prefix that libstub adds to itself during objcopy. Signed-off-by: Kees Cook ---

Re: [PATCH v2 1/3] vmlinux.lds.h: Add .gnu.version* to DISCARDS

2020-06-22 Thread Fangrui Song
On 2020-06-22, Kees Cook wrote: On Mon, Jun 22, 2020 at 03:00:43PM -0700, Fangrui Song wrote: On 2020-06-22, Kees Cook wrote: > For vmlinux linking, no architecture uses the .gnu.version* section, > so remove it via the common DISCARDS macro in preparation for adding > --orphan-hand

Re: [PATCH v2 3/3] x86/boot: Warn on orphan section placement

2020-06-22 Thread Fangrui Song
On 2020-06-22, Kees Cook wrote: On Mon, Jun 22, 2020 at 03:06:28PM -0700, Fangrui Song wrote: LLD may report warnings for 3 synthetic sections if they are orphans: ld.lld: warning: :(.symtab) is being placed in '.symtab' ld.lld: warning: :(.shstrtab) is being placed in '.shstrtab' ld.lld

Re: [PATCH v2 3/3] x86/boot: Warn on orphan section placement

2020-06-22 Thread Fangrui Song
On 2020-06-22, Kees Cook wrote: We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly named in the linker script. Add the common debugging sections. Discard the unused

Re: [PATCH v2 1/3] vmlinux.lds.h: Add .gnu.version* to DISCARDS

2020-06-22 Thread Fangrui Song
On 2020-06-22, Kees Cook wrote: For vmlinux linking, no architecture uses the .gnu.version* section, so remove it via the common DISCARDS macro in preparation for adding --orphan-handling=warn more widely. Signed-off-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 1 + 1 file changed, 1

Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration

2020-06-10 Thread Fangrui Song
But if that gcc was originally _configured_ with a version of binutils that doesn't support -gz=zlib, I agree with this theory :) On 2020-06-10, Arvind Sankar wrote: On Tue, Jun 09, 2020 at 11:23:31PM -0400, Arvind Sankar wrote: On Tue, Jun 09, 2020 at 11:12:25PM -0400, Arvind Sankar wrote:

Re: [kbuild-all] Re: gcc-5: error: -gz is not supported in this configuration

2020-06-09 Thread Fangrui Song
On 2020-06-10, Rong Chen wrote: On 6/10/20 1:49 AM, Fangrui Song wrote: On 2020-06-09, Nick Desaulniers wrote: On Tue, Jun 9, 2020 at 6:12 AM kernel test robot wrote: tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head

Re: gcc-5: error: -gz is not supported in this configuration

2020-06-09 Thread Fangrui Song
On 2020-06-09, Nick Desaulniers wrote: On Tue, Jun 9, 2020 at 6:12 AM kernel test robot wrote: tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: abfbb29297c27e3f101f348dc9e467b0fe70f919 commit: 10e68b02c861ccf2b3adb59d3f0c10dc6b5e3ace Makefile: support

Re: [PATCH] arm64: disable -fsanitize=shadow-call-stack for big-endian

2020-05-27 Thread Fangrui Song
On 2020-05-27, Arnd Bergmann wrote: On Wed, May 27, 2020 at 7:28 PM 'Nick Desaulniers' via Clang Built Linux wrote: On Wed, May 27, 2020 at 8:24 AM Mark Rutland wrote: > > On Wed, May 27, 2020 at 03:39:46PM +0200, Arnd Bergmann wrote: > > clang-11 and earlier do not support

Re: [PATCH] arm64: fix clang integrated assembler build

2020-05-27 Thread Fangrui Song
On 2020-05-27, 'Nick Desaulniers' via Clang Built Linux wrote: On Wed, May 27, 2020 at 7:14 AM Arnd Bergmann wrote: clang and gas seem to interpret the symbols in memmove.S and memset.S differently, such that clang does not make them 'weak' as expected, which leads to a linker error, with

Re: [PATCH v2 4/4] x86/boot: Check that there are no runtime relocations

2020-05-26 Thread Fangrui Song
On 2020-05-26, Arvind Sankar wrote: On Tue, May 26, 2020 at 08:11:56AM +0200, Ard Biesheuvel wrote: On Tue, 26 May 2020 at 00:59, Arvind Sankar wrote: > # Compressed kernel should be built as PIE since it may be loaded at any > # address by the bootloader. > -KBUILD_LDFLAGS += $(call

Re: [PATCH 0/4] x86/boot: Remove runtime relocations from compressed kernel

2020-05-25 Thread Fangrui Song
arch/x86/boot/compressed/mkpiggy.c | 6 ++ arch/x86/boot/compressed/vmlinux.lds.S | 11 +++ arch/x86/boot/setup.ld | 2 +- 6 files changed, 109 insertions(+), 104 deletions(-) -- 2.26.2 All 4 commits look good. Reviewed-by: Fangrui Song

Re: [PATCH 4/4] x86/boot: Check that there are no runtime relocations

2020-05-25 Thread Fangrui Song
On 2020-05-25, Ard Biesheuvel wrote: On Sun, 24 May 2020 at 23:28, Arvind Sankar wrote: Add a linker script check that there are no runtime relocations, and remove the old one that tries to check via looking for specially-named sections in the object files. Drop the tests for -fPIE compiler

Re: [PATCH 2/4] x86/boot: Remove runtime relocations from .head.text code

2020-05-24 Thread Fangrui Song
On 2020-05-24, Arvind Sankar wrote: On Sun, May 24, 2020 at 03:53:59PM -0700, Fangrui Song wrote: On 2020-05-24, Arvind Sankar wrote: >The assembly code in head_{32,64}.S, while meant to be >position-independent, generates run-time relocations because it uses >instructions such as

Re: [PATCH 1/4] x86/boot: Add .text.startup to setup.ld

2020-05-24 Thread Fangrui Song
On 2020-05-24, Arvind Sankar wrote: On Sun, May 24, 2020 at 03:13:26PM -0700, Fangrui Song wrote: On 2020-05-24, Arvind Sankar wrote: >gcc puts the main function into .text.startup when compiled with -Os (or >-O2). This results in arch/x86/boot/main.c having a .text.startup >sect

Re: [PATCH 4/4] x86/boot: Check that there are no runtime relocations

2020-05-24 Thread Fangrui Song
tions is called *.rel.local* ... (it probably wanted to name .rel.data.rel.ro or .rel.data) Reviewed-by: Fangrui Song

Re: [PATCH 3/4] x86/boot: Remove runtime relocations from head_{32,64}.S

2020-05-24 Thread Fangrui Song
This commit fixing https://sourceware.org/bugzilla/show_bug.cgi?id=25754 also fixed the bug. (Just verified that both 2.24 and 2.34 have the bug. binutils-gdb HEAD (future 2.35) is good.) % cat a.s pushl $z_input_len % cat b.s .globl z_input_len z_input_len = 0xb612 % gcc -m32 -c a.s b.s % ld.bfd -m elf_i386 -pie a.o b.o # has an incorrect R_386_RELATIVE before binutils 2.35 Reviewed-by: Fangrui Song

Re: [PATCH 2/4] x86/boot: Remove runtime relocations from .head.text code

2020-05-24 Thread Fangrui Song
On 2020-05-24, Arvind Sankar wrote: The assembly code in head_{32,64}.S, while meant to be position-independent, generates run-time relocations because it uses instructions such as lealgdt(%edx), %eax which make the assembler and linker think that the code is using %edx as an index

Re: [PATCH 1/4] x86/boot: Add .text.startup to setup.ld

2020-05-24 Thread Fangrui Song
ress range overlaps with .entrytext >>> .bsdata range is [0x1FF, 0x398] >>> .entrytext range is [0x26C, 0x2D3] Explicitly pull .text.startup into the .text output section to avoid this. [1] https://reviews.llvm.org/D75225 Signed-off-by: Arvind Sankar Reviewed-by: Fangrui Song

[tip: x86/build] x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux

2020-05-22 Thread tip-bot2 for Fangrui Song
The following commit has been merged into the x86/build branch of tip: Commit-ID: d6ee6529436a15a0541aff6e1697989ee7dc2c44 Gitweb: https://git.kernel.org/tip/d6ee6529436a15a0541aff6e1697989ee7dc2c44 Author:Fangrui Song AuthorDate:Wed, 20 May 2020 11:20:10 -07:00 Committer

Re: [PATCH 0/1] x86/boot: lld fix

2020-05-20 Thread Fangrui Song
) It was intended to match GNU ld. But yes, orphan section placement is still different in the two linkers. Placing .text.startup before .text seems good. In GNU ld's internal linker script (ld --verbose), .text.startup is placed before .text Reviewed-by: Fangrui Song

Re: [PATCH] x86/boot: allow a relocatable kernel to be linked with lld

2020-05-17 Thread Fangrui Song
On 2020-05-16, Dmitry Golovin wrote: 15.05.2020, 21:50, "Borislav Petkov" : I need more info here about which segment is read-only? Is this something LLD does by default or what's happening? Probably should have quoted the original error message: ld.lld: error: can't create dynamic

Re: [PATCH] Makefile: support compressed debug info

2020-05-12 Thread Fangrui Song
object files along with the linked output should be fine. It can save disk space. (It'd be great if you paste the comparison with and w/o object files compressed) Feel free to add: Reviewed-by: Fangrui Song I have a patch series that enables dwarf5 support in the kernel that I'm working up

Re: [PATCH] arm64: disable patchable function entry on big-endian clang builds

2020-05-06 Thread Fangrui Song
On 2020-05-06, Nick Desaulniers wrote: On Wed, May 6, 2020 at 8:46 AM 'Fangrui Song' via Clang Built Linux wrote: Created https://reviews.llvm.org/D79495 to allow the function attribute 'patchable_function_entry' on aarch64_be. I think -fpatchable-function-entry= just works. Note, LLD does

Re: [PATCH] arm64: disable patchable function entry on big-endian clang builds

2020-05-06 Thread Fangrui Song
On 2020-05-06, Nathan Chancellor wrote: On Wed, May 06, 2020 at 12:22:58PM +0200, Arnd Bergmann wrote: On Wed, May 6, 2020 at 5:45 AM Nathan Chancellor wrote: > On Tue, May 05, 2020 at 07:42:43PM +0200, Torsten Duwe wrote: > > On Tue, 5 May 2020 15:25:56 +0100 Mark Rutland wrote: > > > On

Re: [PATCH] Makefile: support compressed debug info

2020-05-04 Thread Fangrui Song
On 2020-05-04, Sedat Dilek wrote: On Mon, May 4, 2020 at 5:13 AM Nick Desaulniers wrote: As debug information gets larger and larger, it helps significantly save the size of vmlinux images to compress the information in the debug information sections. Note: this debug info is typically

Re: [PATCH v4 4/5] MIPS: VDSO: Use $(LD) instead of $(CC) to link VDSO

2020-04-28 Thread Fangrui Song
On 2020-04-28, Nathan Chancellor wrote: Currently, the VDSO is being linked through $(CC). This does not match how the rest of the kernel links objects, which is through the $(LD) variable. When clang is built in a default configuration, it first attempts to use the target triple's default