Linux: llvm-objcopy: error: --set-section-flags=.text conflicts with --rename-section=.text=.rodata

Created on 10 Apr 2019  路  6Comments  路  Source: ClangBuiltLinux/linux

From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/misc/lkdtm/Makefile?h=v5.1-rc4

To reproduce:

make -j$(nproc) ARCH=arm64 CC=clang CROSS_COMPILE=aarch64-linux-gnu- OBJCOPY=llvm-objcopy allyesconfig drivers/misc/lkdtm/

This is not architecture specific, arm64 is just the easiest to test because it requires no additional patches.

[BUG] linux [FIXED][LINUX] 5.3 [TOOL] llvm-objcopy

Most helpful comment

The usage linked above is:

            --set-section-flags .text=alloc,readonly \
            --rename-section .text=.rodata

which should be equivalent to:

            --rename-section .text=.rodata,alloc,readonly

which is also, IMHO, a much better way to do it as it's less confusing: you don't have to worry about whether --set-section-flags applies to the section name before or after --rename-section is applied.

We _could_ add this for compatibility, but I think it would be easier to fix the objcopy usage here. I'll ask some others if this is reasonable to add.

All 6 comments

cc @rupprecht

The usage linked above is:

            --set-section-flags .text=alloc,readonly \
            --rename-section .text=.rodata

which should be equivalent to:

            --rename-section .text=.rodata,alloc,readonly

which is also, IMHO, a much better way to do it as it's less confusing: you don't have to worry about whether --set-section-flags applies to the section name before or after --rename-section is applied.

We _could_ add this for compatibility, but I think it would be easier to fix the objcopy usage here. I'll ask some others if this is reasonable to add.

Requires CONFIG_LKDTM to repro. Patch sent: https://lkml.org/lkml/2019/5/13/949

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathanchance picture nathanchance  路  3Comments

nickdesaulniers picture nickdesaulniers  路  4Comments

nathanchance picture nathanchance  路  3Comments

tpimh picture tpimh  路  5Comments

tpgxyz picture tpgxyz  路  4Comments