[PATCH v6 0/9] Add jump table support for objtool on LoongArch

Tiezhu Yang posted 9 patches 1 year ago
There is a newer version of this series
arch/loongarch/Kconfig                        |   3 +
arch/loongarch/Makefile                       |   6 +-
arch/loongarch/kernel/machine_kexec.c         |   4 +-
.../drm/amd/display/dc/basics/fixpt31_32.c    |   2 +-
tools/objtool/arch/loongarch/decode.c         |  28 ++-
.../objtool/arch/loongarch/include/arch/elf.h |   7 +
tools/objtool/arch/loongarch/special.c        | 159 +++++++++++++++++-
tools/objtool/arch/powerpc/decode.c           |  15 ++
tools/objtool/arch/x86/decode.c               |  13 ++
tools/objtool/check.c                         |  28 ++-
tools/objtool/include/objtool/arch.h          |   3 +
11 files changed, 251 insertions(+), 17 deletions(-)
[PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Tiezhu Yang 1 year ago
This version is based on tip/tip.git objtool/core branch [1], add some weak
and arch-specific functions to make the generic code more readable, tested
with the latest upstream mainline Binutils, GCC and Clang.

The first 6 patches are preparation for patch #7 to enable jump table for
objtool on LoongArch, the last 2 patches are small enough to fix objtool
warnings "funcA() falls through to next function funcB()", one is under
arch/loongarch and the other is under drm/amd/display.

v6:
  -- Add arch_reloc_size() for x86 and ppc.
  -- Call arch_reloc_size() directly in add_jump_table().
  -- Refine arch_adjust_offset() for LoongArch.
  -- Rename arch_adjust_offset() to arch_jump_table_sym_offset(). 
  -- Get each table size of rodata in time for switch table.
  -- Update the commit message to make it more clear.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core

Tiezhu Yang (9):
  objtool: Handle various symbol types of rodata
  objtool: Handle different entry size of rodata
  objtool: Handle PC relative relocation type
  objtool: Handle unreachable entry of rodata
  objtool/LoongArch: Add support for switch table
  objtool/LoongArch: Add support for goto table
  LoongArch: Enable jump table for objtool
  LoongArch: Convert unreachable() to BUG()
  drm/amd/display: Mark dc_fixpt_from_fraction() noinline

 arch/loongarch/Kconfig                        |   3 +
 arch/loongarch/Makefile                       |   6 +-
 arch/loongarch/kernel/machine_kexec.c         |   4 +-
 .../drm/amd/display/dc/basics/fixpt31_32.c    |   2 +-
 tools/objtool/arch/loongarch/decode.c         |  28 ++-
 .../objtool/arch/loongarch/include/arch/elf.h |   7 +
 tools/objtool/arch/loongarch/special.c        | 159 +++++++++++++++++-
 tools/objtool/arch/powerpc/decode.c           |  15 ++
 tools/objtool/arch/x86/decode.c               |  13 ++
 tools/objtool/check.c                         |  28 ++-
 tools/objtool/include/objtool/arch.h          |   3 +
 11 files changed, 251 insertions(+), 17 deletions(-)

-- 
2.42.0
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Tiezhu Yang 11 months, 1 week ago
Hi Josh and Peter,

On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
> This version is based on tip/tip.git objtool/core branch [1], add some weak
> and arch-specific functions to make the generic code more readable, tested
> with the latest upstream mainline Binutils, GCC and Clang.

...

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
>
> Tiezhu Yang (9):
>   objtool: Handle various symbol types of rodata
>   objtool: Handle different entry size of rodata
>   objtool: Handle PC relative relocation type
>   objtool: Handle unreachable entry of rodata
>   objtool/LoongArch: Add support for switch table
>   objtool/LoongArch: Add support for goto table
>   LoongArch: Enable jump table for objtool
>   LoongArch: Convert unreachable() to BUG()
>   drm/amd/display: Mark dc_fixpt_from_fraction() noinline

Are you OK with the first 8 patches?
What's the merge plan for this series?

Thanks,
Tiezhu
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Josh Poimboeuf 11 months ago
On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote:
> Hi Josh and Peter,
> 
> On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
> > This version is based on tip/tip.git objtool/core branch [1], add some weak
> > and arch-specific functions to make the generic code more readable, tested
> > with the latest upstream mainline Binutils, GCC and Clang.
> 
> ...
> 
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
> > 
> > Tiezhu Yang (9):
> >   objtool: Handle various symbol types of rodata
> >   objtool: Handle different entry size of rodata
> >   objtool: Handle PC relative relocation type
> >   objtool: Handle unreachable entry of rodata
> >   objtool/LoongArch: Add support for switch table
> >   objtool/LoongArch: Add support for goto table
> >   LoongArch: Enable jump table for objtool
> >   LoongArch: Convert unreachable() to BUG()
> >   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
> 
> Are you OK with the first 8 patches?
> What's the merge plan for this series?

Sorry, my inbox is still reeling from the holidays.  I will review this
soon.

-- 
Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Tiezhu Yang 10 months, 1 week ago
On 01/15/2025 09:34 AM, Josh Poimboeuf wrote:
> On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote:
>> Hi Josh and Peter,
>>
>> On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
>>> This version is based on tip/tip.git objtool/core branch [1], add some weak
>>> and arch-specific functions to make the generic code more readable, tested
>>> with the latest upstream mainline Binutils, GCC and Clang.
>>
>> ...
>>
>>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
>>>
>>> Tiezhu Yang (9):
>>>   objtool: Handle various symbol types of rodata
>>>   objtool: Handle different entry size of rodata
>>>   objtool: Handle PC relative relocation type
>>>   objtool: Handle unreachable entry of rodata
>>>   objtool/LoongArch: Add support for switch table
>>>   objtool/LoongArch: Add support for goto table
>>>   LoongArch: Enable jump table for objtool
>>>   LoongArch: Convert unreachable() to BUG()
>>>   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
>>
>> Are you OK with the first 8 patches?
>> What's the merge plan for this series?
>
> Sorry, my inbox is still reeling from the holidays.  I will review this
> soon.

What are the status of the first 8 patches?
What is the next step? Is there anything else to be done here?
I would really appreciate any advice on how to get this merged.

Thanks,
Tiezhu
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Josh Poimboeuf 10 months, 1 week ago
On Mon, Feb 10, 2025 at 02:07:43PM +0800, Tiezhu Yang wrote:
> On 01/15/2025 09:34 AM, Josh Poimboeuf wrote:
> > On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote:
> > > Hi Josh and Peter,
> > > 
> > > On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
> > > > This version is based on tip/tip.git objtool/core branch [1], add some weak
> > > > and arch-specific functions to make the generic code more readable, tested
> > > > with the latest upstream mainline Binutils, GCC and Clang.
> > > 
> > > ...
> > > 
> > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
> > > > 
> > > > Tiezhu Yang (9):
> > > >   objtool: Handle various symbol types of rodata
> > > >   objtool: Handle different entry size of rodata
> > > >   objtool: Handle PC relative relocation type
> > > >   objtool: Handle unreachable entry of rodata
> > > >   objtool/LoongArch: Add support for switch table
> > > >   objtool/LoongArch: Add support for goto table
> > > >   LoongArch: Enable jump table for objtool
> > > >   LoongArch: Convert unreachable() to BUG()
> > > >   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
> > > 
> > > Are you OK with the first 8 patches?
> > > What's the merge plan for this series?
> > 
> > Sorry, my inbox is still reeling from the holidays.  I will review this
> > soon.
> 
> What are the status of the first 8 patches?
> What is the next step? Is there anything else to be done here?
> I would really appreciate any advice on how to get this merged.

Please post a new revision rebased on tip/master, with patch 4 dropped,
and I'll queue them up for -tip.  Thanks for your patience.

-- 
Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Huacai Chen 10 months, 1 week ago
Hi, Josh,

On Tue, Feb 11, 2025 at 5:26 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> On Mon, Feb 10, 2025 at 02:07:43PM +0800, Tiezhu Yang wrote:
> > On 01/15/2025 09:34 AM, Josh Poimboeuf wrote:
> > > On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote:
> > > > Hi Josh and Peter,
> > > >
> > > > On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
> > > > > This version is based on tip/tip.git objtool/core branch [1], add some weak
> > > > > and arch-specific functions to make the generic code more readable, tested
> > > > > with the latest upstream mainline Binutils, GCC and Clang.
> > > >
> > > > ...
> > > >
> > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
> > > > >
> > > > > Tiezhu Yang (9):
> > > > >   objtool: Handle various symbol types of rodata
> > > > >   objtool: Handle different entry size of rodata
> > > > >   objtool: Handle PC relative relocation type
> > > > >   objtool: Handle unreachable entry of rodata
> > > > >   objtool/LoongArch: Add support for switch table
> > > > >   objtool/LoongArch: Add support for goto table
> > > > >   LoongArch: Enable jump table for objtool
> > > > >   LoongArch: Convert unreachable() to BUG()
> > > > >   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
> > > >
> > > > Are you OK with the first 8 patches?
> > > > What's the merge plan for this series?
> > >
> > > Sorry, my inbox is still reeling from the holidays.  I will review this
> > > soon.
> >
> > What are the status of the first 8 patches?
> > What is the next step? Is there anything else to be done here?
> > I would really appreciate any advice on how to get this merged.
>
> Please post a new revision rebased on tip/master, with patch 4 dropped,
> and I'll queue them up for -tip.  Thanks for your patience.
You will queue the whole series, or the first 5 patches, or the first 3 patches?

Huacai

>
> --
> Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Josh Poimboeuf 10 months, 1 week ago
On Tue, Feb 11, 2025 at 07:59:57PM +0800, Huacai Chen wrote:
> Hi, Josh,
> 
> On Tue, Feb 11, 2025 at 5:26 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> >
> > On Mon, Feb 10, 2025 at 02:07:43PM +0800, Tiezhu Yang wrote:
> > > On 01/15/2025 09:34 AM, Josh Poimboeuf wrote:
> > > > On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote:
> > > > > Hi Josh and Peter,
> > > > >
> > > > > On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
> > > > > > This version is based on tip/tip.git objtool/core branch [1], add some weak
> > > > > > and arch-specific functions to make the generic code more readable, tested
> > > > > > with the latest upstream mainline Binutils, GCC and Clang.
> > > > >
> > > > > ...
> > > > >
> > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
> > > > > >
> > > > > > Tiezhu Yang (9):
> > > > > >   objtool: Handle various symbol types of rodata
> > > > > >   objtool: Handle different entry size of rodata
> > > > > >   objtool: Handle PC relative relocation type
> > > > > >   objtool: Handle unreachable entry of rodata
> > > > > >   objtool/LoongArch: Add support for switch table
> > > > > >   objtool/LoongArch: Add support for goto table
> > > > > >   LoongArch: Enable jump table for objtool
> > > > > >   LoongArch: Convert unreachable() to BUG()
> > > > > >   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
> > > > >
> > > > > Are you OK with the first 8 patches?
> > > > > What's the merge plan for this series?
> > > >
> > > > Sorry, my inbox is still reeling from the holidays.  I will review this
> > > > soon.
> > >
> > > What are the status of the first 8 patches?
> > > What is the next step? Is there anything else to be done here?
> > > I would really appreciate any advice on how to get this merged.
> >
> > Please post a new revision rebased on tip/master, with patch 4 dropped,
> > and I'll queue them up for -tip.  Thanks for your patience.
> You will queue the whole series, or the first 5 patches, or the first 3 patches?

The new series now has 7 patches:

Tiezhu Yang (7):
  objtool: Handle various symbol types of rodata
  objtool: Handle different entry size of rodata
  objtool: Handle PC relative relocation type
  objtool/LoongArch: Add support for switch table
  objtool/LoongArch: Add support for goto table
  LoongArch: Enable jump table for objtool
  LoongArch: Convert unreachable() to BUG()

I was planning on queueing all 7.

In particular, patch 6 should stay with the objtool patches since
they're directly related.

But I was also just going to grab 7 as well.

Please let me know if you disagree.

-- 
Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Huacai Chen 10 months, 1 week ago
On Wed, Feb 12, 2025 at 7:30 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> On Tue, Feb 11, 2025 at 07:59:57PM +0800, Huacai Chen wrote:
> > Hi, Josh,
> >
> > On Tue, Feb 11, 2025 at 5:26 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> > >
> > > On Mon, Feb 10, 2025 at 02:07:43PM +0800, Tiezhu Yang wrote:
> > > > On 01/15/2025 09:34 AM, Josh Poimboeuf wrote:
> > > > > On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote:
> > > > > > Hi Josh and Peter,
> > > > > >
> > > > > > On 12/17/2024 09:08 AM, Tiezhu Yang wrote:
> > > > > > > This version is based on tip/tip.git objtool/core branch [1], add some weak
> > > > > > > and arch-specific functions to make the generic code more readable, tested
> > > > > > > with the latest upstream mainline Binutils, GCC and Clang.
> > > > > >
> > > > > > ...
> > > > > >
> > > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
> > > > > > >
> > > > > > > Tiezhu Yang (9):
> > > > > > >   objtool: Handle various symbol types of rodata
> > > > > > >   objtool: Handle different entry size of rodata
> > > > > > >   objtool: Handle PC relative relocation type
> > > > > > >   objtool: Handle unreachable entry of rodata
> > > > > > >   objtool/LoongArch: Add support for switch table
> > > > > > >   objtool/LoongArch: Add support for goto table
> > > > > > >   LoongArch: Enable jump table for objtool
> > > > > > >   LoongArch: Convert unreachable() to BUG()
> > > > > > >   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
> > > > > >
> > > > > > Are you OK with the first 8 patches?
> > > > > > What's the merge plan for this series?
> > > > >
> > > > > Sorry, my inbox is still reeling from the holidays.  I will review this
> > > > > soon.
> > > >
> > > > What are the status of the first 8 patches?
> > > > What is the next step? Is there anything else to be done here?
> > > > I would really appreciate any advice on how to get this merged.
> > >
> > > Please post a new revision rebased on tip/master, with patch 4 dropped,
> > > and I'll queue them up for -tip.  Thanks for your patience.
> > You will queue the whole series, or the first 5 patches, or the first 3 patches?
>
> The new series now has 7 patches:
>
> Tiezhu Yang (7):
>   objtool: Handle various symbol types of rodata
>   objtool: Handle different entry size of rodata
>   objtool: Handle PC relative relocation type
>   objtool/LoongArch: Add support for switch table
>   objtool/LoongArch: Add support for goto table
>   LoongArch: Enable jump table for objtool
>   LoongArch: Convert unreachable() to BUG()
>
> I was planning on queueing all 7.
>
> In particular, patch 6 should stay with the objtool patches since
> they're directly related.
>
> But I was also just going to grab 7 as well.
>
> Please let me know if you disagree.
What about you merge the first 5 patches, and then I merge the last 2
to the loongarch tree? (I prefer to merge the whole series to the
loongarch tree with your acked-by, but that may be inconvenient to
you).


Huacai

>
> --
> Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Josh Poimboeuf 10 months, 1 week ago
On Wed, Feb 12, 2025 at 03:22:45PM +0800, Huacai Chen wrote:
> > The new series now has 7 patches:
> >
> > Tiezhu Yang (7):
> >   objtool: Handle various symbol types of rodata
> >   objtool: Handle different entry size of rodata
> >   objtool: Handle PC relative relocation type
> >   objtool/LoongArch: Add support for switch table
> >   objtool/LoongArch: Add support for goto table
> >   LoongArch: Enable jump table for objtool
> >   LoongArch: Convert unreachable() to BUG()
> >
> > I was planning on queueing all 7.
> >
> > In particular, patch 6 should stay with the objtool patches since
> > they're directly related.
> >
> > But I was also just going to grab 7 as well.
> >
> > Please let me know if you disagree.
> What about you merge the first 5 patches, and then I merge the last 2
> to the loongarch tree? (I prefer to merge the whole series to the
> loongarch tree with your acked-by, but that may be inconvenient to
> you).

I want the first 5 patches to go through the -tip tree because we'll
have other patches depending on them.

I'll go ahead and take the first 5.

If you take in patches 6 & 7 separately, that might introduce a lot of
warnings.  But it's up to you.

For patches 6 & 7:

Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>

-- 
Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Huacai Chen 10 months ago
On Thu, Feb 13, 2025 at 10:51 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> On Wed, Feb 12, 2025 at 03:22:45PM +0800, Huacai Chen wrote:
> > > The new series now has 7 patches:
> > >
> > > Tiezhu Yang (7):
> > >   objtool: Handle various symbol types of rodata
> > >   objtool: Handle different entry size of rodata
> > >   objtool: Handle PC relative relocation type
> > >   objtool/LoongArch: Add support for switch table
> > >   objtool/LoongArch: Add support for goto table
> > >   LoongArch: Enable jump table for objtool
> > >   LoongArch: Convert unreachable() to BUG()
> > >
> > > I was planning on queueing all 7.
> > >
> > > In particular, patch 6 should stay with the objtool patches since
> > > they're directly related.
> > >
> > > But I was also just going to grab 7 as well.
> > >
> > > Please let me know if you disagree.
> > What about you merge the first 5 patches, and then I merge the last 2
> > to the loongarch tree? (I prefer to merge the whole series to the
> > loongarch tree with your acked-by, but that may be inconvenient to
> > you).
>
> I want the first 5 patches to go through the -tip tree because we'll
> have other patches depending on them.
>
> I'll go ahead and take the first 5.
>
> If you take in patches 6 & 7 separately, that might introduce a lot of
> warnings.  But it's up to you.
>
> For patches 6 & 7:
>
> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
OK, please take the first 5 patches, I will merge your objtool/core to
the loongarch tree and then apply the last 2 to avoid build warnings.

Huacai

>
> --
> Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Josh Poimboeuf 10 months ago
On Mon, Feb 17, 2025 at 11:13:43AM +0800, Huacai Chen wrote:
> On Thu, Feb 13, 2025 at 10:51 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> >
> > On Wed, Feb 12, 2025 at 03:22:45PM +0800, Huacai Chen wrote:
> > > > The new series now has 7 patches:
> > > >
> > > > Tiezhu Yang (7):
> > > >   objtool: Handle various symbol types of rodata
> > > >   objtool: Handle different entry size of rodata
> > > >   objtool: Handle PC relative relocation type
> > > >   objtool/LoongArch: Add support for switch table
> > > >   objtool/LoongArch: Add support for goto table
> > > >   LoongArch: Enable jump table for objtool
> > > >   LoongArch: Convert unreachable() to BUG()
> > > >
> > > > I was planning on queueing all 7.
> > > >
> > > > In particular, patch 6 should stay with the objtool patches since
> > > > they're directly related.
> > > >
> > > > But I was also just going to grab 7 as well.
> > > >
> > > > Please let me know if you disagree.
> > > What about you merge the first 5 patches, and then I merge the last 2
> > > to the loongarch tree? (I prefer to merge the whole series to the
> > > loongarch tree with your acked-by, but that may be inconvenient to
> > > you).
> >
> > I want the first 5 patches to go through the -tip tree because we'll
> > have other patches depending on them.
> >
> > I'll go ahead and take the first 5.
> >
> > If you take in patches 6 & 7 separately, that might introduce a lot of
> > warnings.  But it's up to you.
> >
> > For patches 6 & 7:
> >
> > Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
> OK, please take the first 5 patches, I will merge your objtool/core to
> the loongarch tree and then apply the last 2 to avoid build warnings.

Looks like that's not going to work.  Without patch 7 I'm getting a
warning (upgraded to a build error with a pending change to upgrade
objtool warnings to errors):

arch/loongarch/kernel/machine_kexec.o: error: objtool: kexec_reboot() falls through to next function crash_shutdown_secondary()
arch/loongarch/kernel/machine_kexec.o: error: objtool:   kexec_reboot+0x1c: (branch)
arch/loongarch/kernel/machine_kexec.o: error: objtool:   kexec_reboot+0x0: <=== (sym)
arch/loongarch/kernel/machine_kexec.o: error: objtool: 1 warning(s) upgraded to errors

And that would break bisection anyway, so that really needs to come
before the others.

-- 
Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Huacai Chen 10 months ago
On Wed, Feb 19, 2025 at 1:46 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> On Mon, Feb 17, 2025 at 11:13:43AM +0800, Huacai Chen wrote:
> > On Thu, Feb 13, 2025 at 10:51 AM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> > >
> > > On Wed, Feb 12, 2025 at 03:22:45PM +0800, Huacai Chen wrote:
> > > > > The new series now has 7 patches:
> > > > >
> > > > > Tiezhu Yang (7):
> > > > >   objtool: Handle various symbol types of rodata
> > > > >   objtool: Handle different entry size of rodata
> > > > >   objtool: Handle PC relative relocation type
> > > > >   objtool/LoongArch: Add support for switch table
> > > > >   objtool/LoongArch: Add support for goto table
> > > > >   LoongArch: Enable jump table for objtool
> > > > >   LoongArch: Convert unreachable() to BUG()
> > > > >
> > > > > I was planning on queueing all 7.
> > > > >
> > > > > In particular, patch 6 should stay with the objtool patches since
> > > > > they're directly related.
> > > > >
> > > > > But I was also just going to grab 7 as well.
> > > > >
> > > > > Please let me know if you disagree.
> > > > What about you merge the first 5 patches, and then I merge the last 2
> > > > to the loongarch tree? (I prefer to merge the whole series to the
> > > > loongarch tree with your acked-by, but that may be inconvenient to
> > > > you).
> > >
> > > I want the first 5 patches to go through the -tip tree because we'll
> > > have other patches depending on them.
> > >
> > > I'll go ahead and take the first 5.
> > >
> > > If you take in patches 6 & 7 separately, that might introduce a lot of
> > > warnings.  But it's up to you.
> > >
> > > For patches 6 & 7:
> > >
> > > Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > OK, please take the first 5 patches, I will merge your objtool/core to
> > the loongarch tree and then apply the last 2 to avoid build warnings.
>
> Looks like that's not going to work.  Without patch 7 I'm getting a
> warning (upgraded to a build error with a pending change to upgrade
> objtool warnings to errors):
>
> arch/loongarch/kernel/machine_kexec.o: error: objtool: kexec_reboot() falls through to next function crash_shutdown_secondary()
> arch/loongarch/kernel/machine_kexec.o: error: objtool:   kexec_reboot+0x1c: (branch)
> arch/loongarch/kernel/machine_kexec.o: error: objtool:   kexec_reboot+0x0: <=== (sym)
> arch/loongarch/kernel/machine_kexec.o: error: objtool: 1 warning(s) upgraded to errors
>
> And that would break bisection anyway, so that really needs to come
> before the others.
OK, then please take the whole series of V7, but please exchange the
order of Patch-6 and Patch-7 (I think the enablement should be the
last for bisection).
For V7: Acked-by: Huacai Chen <chenhuacai@loongson.cn>


Huacai

>
> --
> Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Josh Poimboeuf 9 months, 4 weeks ago
On Wed, Feb 19, 2025 at 05:49:01PM +0800, Huacai Chen wrote:
> > Looks like that's not going to work.  Without patch 7 I'm getting a
> > warning (upgraded to a build error with a pending change to upgrade
> > objtool warnings to errors):
> >
> > arch/loongarch/kernel/machine_kexec.o: error: objtool: kexec_reboot() falls through to next function crash_shutdown_secondary()
> > arch/loongarch/kernel/machine_kexec.o: error: objtool:   kexec_reboot+0x1c: (branch)
> > arch/loongarch/kernel/machine_kexec.o: error: objtool:   kexec_reboot+0x0: <=== (sym)
> > arch/loongarch/kernel/machine_kexec.o: error: objtool: 1 warning(s) upgraded to errors
> >
> > And that would break bisection anyway, so that really needs to come
> > before the others.
> OK, then please take the whole series of V7, but please exchange the
> order of Patch-6 and Patch-7 (I think the enablement should be the
> last for bisection).
> For V7: Acked-by: Huacai Chen <chenhuacai@loongson.cn>

Ok, but to avoid the warning, patch 7 needs to come *before* the objtool
patches, so it will be the following order:

LoongArch: Convert unreachable() to BUG()
objtool: Handle various symbol types of rodata
objtool: Handle different entry size of rodata
objtool: Handle PC relative relocation type
objtool/LoongArch: Add support for switch table
objtool/LoongArch: Add support for goto table
LoongArch: Enable jump table for objtool

-- 
Josh
Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch
Posted by Huacai Chen 11 months, 2 weeks ago
Hi, Josh and Peter,

I think this series (except the last patch, but that one can be a
separate one) is good enough now, right? If so, I think there is some
ways to get it upstream:

1) I merge objtool/core from tip.git to the loongarch tree, then apply
this whole series with your acked-by;
2) You apply the first 4 patches to tip.git, and then I apply others
to the loongarch tree (still need to merge objtool/core before apply
to avoid build issues).

I prefer the first method, but I can also accept other ways.

Huacai

On Tue, Dec 17, 2024 at 9:09 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
>
> This version is based on tip/tip.git objtool/core branch [1], add some weak
> and arch-specific functions to make the generic code more readable, tested
> with the latest upstream mainline Binutils, GCC and Clang.
>
> The first 6 patches are preparation for patch #7 to enable jump table for
> objtool on LoongArch, the last 2 patches are small enough to fix objtool
> warnings "funcA() falls through to next function funcB()", one is under
> arch/loongarch and the other is under drm/amd/display.
>
> v6:
>   -- Add arch_reloc_size() for x86 and ppc.
>   -- Call arch_reloc_size() directly in add_jump_table().
>   -- Refine arch_adjust_offset() for LoongArch.
>   -- Rename arch_adjust_offset() to arch_jump_table_sym_offset().
>   -- Get each table size of rodata in time for switch table.
>   -- Update the commit message to make it more clear.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=objtool/core
>
> Tiezhu Yang (9):
>   objtool: Handle various symbol types of rodata
>   objtool: Handle different entry size of rodata
>   objtool: Handle PC relative relocation type
>   objtool: Handle unreachable entry of rodata
>   objtool/LoongArch: Add support for switch table
>   objtool/LoongArch: Add support for goto table
>   LoongArch: Enable jump table for objtool
>   LoongArch: Convert unreachable() to BUG()
>   drm/amd/display: Mark dc_fixpt_from_fraction() noinline
>
>  arch/loongarch/Kconfig                        |   3 +
>  arch/loongarch/Makefile                       |   6 +-
>  arch/loongarch/kernel/machine_kexec.c         |   4 +-
>  .../drm/amd/display/dc/basics/fixpt31_32.c    |   2 +-
>  tools/objtool/arch/loongarch/decode.c         |  28 ++-
>  .../objtool/arch/loongarch/include/arch/elf.h |   7 +
>  tools/objtool/arch/loongarch/special.c        | 159 +++++++++++++++++-
>  tools/objtool/arch/powerpc/decode.c           |  15 ++
>  tools/objtool/arch/x86/decode.c               |  13 ++
>  tools/objtool/check.c                         |  28 ++-
>  tools/objtool/include/objtool/arch.h          |   3 +
>  11 files changed, 251 insertions(+), 17 deletions(-)
>
> --
> 2.42.0
>