<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/objtool, branch v5.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2021-06-28T18:35:55Z</updated>
<entry>
<title>Merge tags 'objtool-urgent-2021-06-28' and 'objtool-core-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2021-06-28T18:35:55Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-06-28T18:35:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b89c07dea16137696d0f2d479ef665ef7c1022ab'/>
<id>urn:sha1:b89c07dea16137696d0f2d479ef665ef7c1022ab</id>
<content type='text'>
Pull objtool fix and updates from Ingo Molnar:
 "An ELF format fix for a section flags mismatch bug that breaks kernel
  tooling such as kpatch-build.

  The biggest change in this cycle is the new code to handle and rewrite
  variable sized jump labels - which results in slightly tighter code
  generation in hot paths, through the use of short(er) NOPs.

  Also a number of cleanups and fixes, and a change to the generic
  include/linux/compiler.h to handle a s390 GCC quirk"

* tag 'objtool-urgent-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Don't make .altinstructions writable

* tag 'objtool-core-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Improve reloc hash size guestimate
  instrumentation.h: Avoid using inline asm operand modifiers
  compiler.h: Avoid using inline asm operand modifiers
  kbuild: Fix objtool dependency for 'OBJECT_FILES_NON_STANDARD_&lt;obj&gt; := n'
  objtool: Reflow handle_jump_alt()
  jump_label/x86: Remove unused JUMP_LABEL_NOP_SIZE
  jump_label, x86: Allow short NOPs
  objtool: Provide stats for jump_labels
  objtool: Rewrite jump_label instructions
  objtool: Decode jump_entry::key addend
  jump_label, x86: Emit short JMP
  jump_label: Free jump_entry::key bit1 for build use
  jump_label, x86: Add variable length patching support
  jump_label, x86: Introduce jump_entry_size()
  jump_label, x86: Improve error when we fail expected text
  jump_label, x86: Factor out the __jump_table generation
  jump_label, x86: Strip ASM jump_label support
  x86, objtool: Dont exclude arch/x86/realmode/
  objtool: Rewrite hashtable sizing
</content>
</entry>
<entry>
<title>objtool: Don't make .altinstructions writable</title>
<updated>2021-06-24T06:55:20Z</updated>
<author>
<name>Josh Poimboeuf</name>
<email>jpoimboe@redhat.com</email>
</author>
<published>2021-06-23T15:42:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e31694e0a7a709293319475d8001e05e31f2178c'/>
<id>urn:sha1:e31694e0a7a709293319475d8001e05e31f2178c</id>
<content type='text'>
When objtool creates the .altinstructions section, it sets the SHF_WRITE
flag to make the section writable -- unless the section had already been
previously created by the kernel.  The mismatch between kernel-created
and objtool-created section flags can cause failures with external
tooling (kpatch-build).  And the section doesn't need to be writable
anyway.

Make the section flags consistent with the kernel's.

Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
Reported-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Signed-off-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/6c284ae89717889ea136f9f0064d914cd8329d31.1624462939.git.jpoimboe@redhat.com
</content>
</entry>
<entry>
<title>objtool: Improve reloc hash size guestimate</title>
<updated>2021-06-14T12:05:36Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-06-11T06:33:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d33b9035e14a35f6f2a5f067f0b156a93581811d'/>
<id>urn:sha1:d33b9035e14a35f6f2a5f067f0b156a93581811d</id>
<content type='text'>
Nathan reported that LLVM ThinLTO builds have a performance regression
with commit 25cf0d8aa2a3 ("objtool: Rewrite hashtable sizing"). Sami
was quick to note that this is due to their use of -ffunction-sections.

As a result the .text section is small and basing the number of relocs
off of that no longer works. Instead have read_sections() compute the
sum of all SHF_EXECINSTR sections and use that.

Fixes: 25cf0d8aa2a3 ("objtool: Rewrite hashtable sizing")
Reported-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Debugged-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Tested-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Link: https://lkml.kernel.org/r/YMJpGLuGNsGtA5JJ@hirez.programming.kicks-ass.net
</content>
</entry>
<entry>
<title>objtool: Only rewrite unconditional retpoline thunk calls</title>
<updated>2021-06-11T06:53:06Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-06-10T07:04:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d49b721dc18c113d5221f4cf5a6104eb66cb7f2'/>
<id>urn:sha1:2d49b721dc18c113d5221f4cf5a6104eb66cb7f2</id>
<content type='text'>
It turns out that the compilers generate conditional branches to the
retpoline thunks like:

  5d5:   0f 85 00 00 00 00       jne    5db &lt;cpuidle_reflect+0x22&gt;
	5d7: R_X86_64_PLT32     __x86_indirect_thunk_r11-0x4

while the rewrite can only handle JMP/CALL to the thunks. The result
is the alternative wrecking the code. Make sure to skip writing the
alternatives for conditional branches.

Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
Reported-by: Lukasz Majczak &lt;lma@semihalf.com&gt;
Reported-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Tested-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
</content>
</entry>
<entry>
<title>objtool: Fix .symtab_shndx handling for elf_create_undef_symbol()</title>
<updated>2021-06-10T08:08:24Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-06-07T09:45:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=584fd3b31889852d0d6f3dd1e3d8e9619b660d2c'/>
<id>urn:sha1:584fd3b31889852d0d6f3dd1e3d8e9619b660d2c</id>
<content type='text'>
When an ELF object uses extended symbol section indexes (IOW it has a
.symtab_shndx section), these must be kept in sync with the regular
symbol table (.symtab).

So for every new symbol we emit, make sure to also emit a
.symtab_shndx value to keep the arrays of equal size.

Note: since we're writing an UNDEF symbol, most GElf_Sym fields will
be 0 and we can repurpose one (st_size) to host the 0 for the xshndx
value.

Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()")
Reported-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Suggested-by: Fangrui Song &lt;maskray@google.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Tested-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Link: https://lkml.kernel.org/r/YL3q1qFO9QIRL/BA@hirez.programming.kicks-ass.net
</content>
</entry>
<entry>
<title>objtool: Reflow handle_jump_alt()</title>
<updated>2021-05-14T07:00:10Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-05-13T14:15:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=48001d26c19f02c33795829ec9fc71a0d8d42413'/>
<id>urn:sha1:48001d26c19f02c33795829ec9fc71a0d8d42413</id>
<content type='text'>
Miroslav figured the code flow in handle_jump_alt() was sub-optimal
with that goto. Reflow the code to make it clearer.

Reported-by: Miroslav Benes &lt;mbenes@suse.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/YJ00lgslY+IpA/rL@hirez.programming.kicks-ass.net
</content>
</entry>
<entry>
<title>objtool/x86: Fix elf_add_alternative() endianness</title>
<updated>2021-05-12T19:17:01Z</updated>
<author>
<name>Vasily Gorbik</name>
<email>gor@linux.ibm.com</email>
</author>
<published>2021-05-12T17:42:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f66c05d6baf36069c01a02f869bebb75586f2318'/>
<id>urn:sha1:f66c05d6baf36069c01a02f869bebb75586f2318</id>
<content type='text'>
Currently x86 kernel cross-compiled on big endian system fails at boot with:

  kernel BUG at arch/x86/kernel/alternative.c:258!

Corresponding bug condition look like the following:

  BUG_ON(feature &gt;= (NCAPINTS + NBUGINTS) * 32);

Fix that by converting alternative feature/cpuid to target endianness.

Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: https://lore.kernel.org/r/patch-2.thread-6c9df9.git-6c9df9a8098d.your-ad-here.call-01620841104-ext-2554@work.hours
</content>
</entry>
<entry>
<title>objtool: Fix elf_create_undef_symbol() endianness</title>
<updated>2021-05-12T19:16:53Z</updated>
<author>
<name>Vasily Gorbik</name>
<email>gor@linux.ibm.com</email>
</author>
<published>2021-05-12T17:42:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=46c7405df7de8deb97229eacebcee96d61415f3f'/>
<id>urn:sha1:46c7405df7de8deb97229eacebcee96d61415f3f</id>
<content type='text'>
Currently x86 cross-compilation fails on big endian system with:

  x86_64-cross-ld: init/main.o: invalid string offset 488112128 &gt;= 6229 for section `.strtab'

Mark new ELF data in elf_create_undef_symbol() as symbol, so that libelf
does endianness handling correctly.

Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()")
Signed-off-by: Vasily Gorbik &lt;gor@linux.ibm.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: https://lore.kernel.org/r/patch-1.thread-6c9df9.git-d39264656387.your-ad-here.call-01620841104-ext-2554@work.hours
</content>
</entry>
<entry>
<title>objtool: Provide stats for jump_labels</title>
<updated>2021-05-12T12:54:56Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-05-06T19:34:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e2d9494beff21a26438eb611c260b8a6c2dc4dbf'/>
<id>urn:sha1:e2d9494beff21a26438eb611c260b8a6c2dc4dbf</id>
<content type='text'>
Add objtool --stats to count the jump_label sites it encounters.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210506194158.153101906@infradead.org
</content>
</entry>
<entry>
<title>objtool: Rewrite jump_label instructions</title>
<updated>2021-05-12T12:54:56Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2021-05-06T19:34:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d37b83c5d79ef5996cc49c3e3ac3d8ecd8c7050'/>
<id>urn:sha1:6d37b83c5d79ef5996cc49c3e3ac3d8ecd8c7050</id>
<content type='text'>
When a jump_entry::key has bit1 set, rewrite the instruction to be a
NOP. This allows the compiler/assembler to emit JMP (and thus decide
on which encoding to use).

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210506194158.091028792@infradead.org
</content>
</entry>
</feed>
