On 2025-12-08 03:46, Jan Beulich wrote:
On 05.12.2025 23:40, Andrew Cooper wrote:
On 05/12/2025 10:28 pm, Jason Andryuk wrote:
When linking to create xen-syms, add --gc-sections to garbage collect
unused stuff. Relies on CONFIG_CC_SPLIT_SECTIONS
We need to add KEEP() to the linker script in assorted places to retain
appropriate data - especially the arrays created therein.
Something is off though. In a test where memory_add() is unreachable,
it is still included. I'm not sure, but I am wondering if it's the
alternatives somehow keeping a reference to it.
Yes, .altinstructions contains relocations against the origin patch
site, which will cause it to appear to be referenced. The same will be
happening with a bunch of other sections.
We will need to derive helper section names from base section ones. See
e.g. HAVE_AS_SECTNAME_SUBST as introduced by "common: honor
CONFIG_CC_SPLIT_SECTIONS also for assembly functions", controlling the
use of the --sectname-subst asssembler option, to in turn be able to use
%S in section names (available from gas 2.26 onwards).
I tried to add your patch and change ALTERNATIVE to:
".pushsection .altinstructions.%S, \"a\", @progbits\n"
but it fails to build. One example:
./include/xen/compiler.h:62:21: error: invalid 'asm': operand number
missing after %-letter
62 | # define asm_inline asm __inline
| ^~~
./arch/x86/include/asm/pdx.h:13:5: note: in expansion of macro ‘asm_inline’
13 | asm_inline goto ( \
| ^~~~~~~~~~
./arch/x86/include/asm/pdx.h:22:5: note: in expansion of macro
‘PDX_ASM_GOTO’
22 | PDX_ASM_GOTO(skip);
| ^~~~~~~~~~~~
".pushsection .altinstructions.%%S, \"a\", @progbits\n" ends up creating
section ".altinstructions.%S" which doesn't helpful.
Is %S expected to work with inline asm, or only standalone?
Regards,
Jason