Re: [PATCH v6 2/7] objtool: Fix unreachable instruction warnings for weak functions

2024-10-28 Thread Rong Xu
I think the objtool works on individual object files (or vmlinux.o). The -Wl,--gc-sections flag, on the other hand, is a linker flag that acts on the final link -- it's applied after objtool invocations. Therefore, even with -Wl,--gc-sections, we'll still encounter those spurious warnings from objt

Re: [PATCH v6 2/7] objtool: Fix unreachable instruction warnings for weak functions

2024-10-28 Thread Josh Poimboeuf
On Mon, Oct 28, 2024 at 05:16:44PM -0700, Kees Cook wrote: > On Fri, Oct 25, 2024 at 10:14:04PM -0700, Rong Xu wrote: > > In the presence of both weak and strong function definitions, the > > linker drops the weak symbol in favor of a strong symbol, but > > leaves the code in place. Code in ignore_

Re: [PATCH v6 2/7] objtool: Fix unreachable instruction warnings for weak functions

2024-10-28 Thread H. Peter Anvin
On 10/28/24 17:16, Kees Cook wrote: On Fri, Oct 25, 2024 at 10:14:04PM -0700, Rong Xu wrote: In the presence of both weak and strong function definitions, the linker drops the weak symbol in favor of a strong symbol, but leaves the code in place. Code in ignore_unreachable_insn() has some heuris

Re: [PATCH v6 2/7] objtool: Fix unreachable instruction warnings for weak functions

2024-10-28 Thread Kees Cook
On Fri, Oct 25, 2024 at 10:14:04PM -0700, Rong Xu wrote: > In the presence of both weak and strong function definitions, the > linker drops the weak symbol in favor of a strong symbol, but > leaves the code in place. Code in ignore_unreachable_insn() has > some heuristics to suppress the warning, b

[PATCH v6 2/7] objtool: Fix unreachable instruction warnings for weak functions

2024-10-25 Thread Rong Xu
In the presence of both weak and strong function definitions, the linker drops the weak symbol in favor of a strong symbol, but leaves the code in place. Code in ignore_unreachable_insn() has some heuristics to suppress the warning, but it does not work when -ffunction-sections is enabled. Suppose