xen: Drop __text_section()
PATCH 1/1 xen: Drop __text_section()
This is an unnecessary indirection.
---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
--- xen/include/xen/compiler.h | 1 - xen/include/xen/init.h | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-)
xen/include/xen/compiler.h +0 -1
@@ -72,7 +72,6 @@#define __section (s) __attribute__((__section__(s)))#endif #define __used_section (s) __used __attribute__((__section__(s))) -#define __text_section (s) __attribute__((__section__(s)))#define __aligned (a) __attribute__((__aligned__(a)))
xen/include/xen/init.h +3 -3
@@ -5,9 +5,9 @@* Mark functions and data as being only used at initialization * or exit time. */ -#define __init __text_section(".init.text") -#define __exit __text_section(".exit.text") -#define __cold __text_section(".text.cold") +#define __init __section(".init.text") +#define __exit __section(".exit.text") +#define __cold __section(".text.cold")#define __initdata __section(".init.data")#define __initconst __section(".init.rodata")#define __initconstrel __section(".init.rodata.rel")
Signature · 1 line
2.39.5
Quoted 3 lines · Andrew Cooper
This is an unnecessary indirection.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Andrew Cooper
This is an unnecessary indirection.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>
So, this is the patch causing build chaos. I've reproduced locally, even though I still can't explain what is going on.
One example breakage is:
Quoted 10 lines
In file included from
drivers/passthrough/amd/iommu_acpi.c:20:
In file included from./include/xen/acpi.h:41:
In file included from./include/xen/list.h:10:./include/xen/bug.h:107:5: error: invalid operand for inline asm constraint 'i'
BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL);
^./include/xen/bug.h:94:20: note: expanded from macro 'BUG_FRAME' asm volatile (
_ASM_BUGFRAME_TEXT(second_frame) \
Quoted 8 lines
^
./include/xen/bug.h:68:5: note: expanded from macro '_ASM_BUGFRAME_TEXT'
".Lbug%=:"BUG_INSTR"\n"
\
^
1 error generated.
make[4]: *** [Rules.mk:249:drivers/passthrough/amd/iommu_acpi.o] Error 1
although most translation units fail in the same way.
This is run_in_exception_handler(), but there's nothing obviously wrong in the preprocessed source. The parameters are respectively:
: [bf_type] "i" (0),
[bf_ptr] "i" (fn),
[bf_msg] "i" (((void*)0)),
[bf_line_lo] "i" (((0) & ((1 << (31 - 24)) - 1)) << 24), [bf_line_hi] "i" (((0) >> (31 - 24)) << 24)
which is as expected.
There is one difference I have noticed which is clearly relevant but I'm not sure how.
__section() isn't exactly __attribute__((__section__(s))), because (just out of scope of the patch), __clang__ adds a __used attribute to __section().
The logic doing this is ahead of __used being defined, and the TUs which break are -DINIT_SECTIONS_ONLY which includes init.h prior to __used having being defined.
And yet, there's no un-expanded __used in the preprocessed source.
Also, this only goes wrong in the Shim build, not in the main build.
Also, building the object file in isolation seems to work fine, although this seems to remove -DINIT_SECTIONS_ONLY from the cmdline which is almost certainly masking what's going wrong.
~Andrew
Quoted 54 lines · Andrew Cooper
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Andrew Cooper
This is an unnecessary indirection.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>So, this is the patch causing build chaos. I've reproduced locally, even though I still can't explain what is going on.
One example breakage is:
Quoted 10 lines
In file included from
drivers/passthrough/amd/iommu_acpi.c:20:
In file included from./include/xen/acpi.h:41:
In file included from./include/xen/list.h:10:./include/xen/bug.h:107:5: error: invalid operand for inline asm constraint 'i'
BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL);
^./include/xen/bug.h:94:20: note: expanded from macro 'BUG_FRAME' asm volatile (
_ASM_BUGFRAME_TEXT(second_frame) \Quoted 8 lines
^
./include/xen/bug.h:68:5: note: expanded from macro '_ASM_BUGFRAME_TEXT'
".Lbug%=:"BUG_INSTR"\n"
\
^
1 error generated.
make[4]: *** [Rules.mk:249:drivers/passthrough/amd/iommu_acpi.o] Error 1although most translation units fail in the same way.
This is
run_in_exception_handler(), but there's nothing obviously wrong in the preprocessed source. The parameters are respectively:: [
bf_type] "i" (0),
[bf_ptr] "i" (fn),
[bf_msg] "i" (((void*)0)),
[bf_line_lo] "i" (((0) & ((1 << (31 - 24)) - 1)) << 24), [bf_line_hi] "i" (((0) >> (31 - 24)) << 24)which is as expected.
There is one difference I have noticed which is clearly relevant but I'm not sure how.
__section()isn't exactly __attribute__((__section__(s))), because (just out of scope of the patch),__clang__adds a__usedattribute to__section().The logic doing this is ahead of
__usedbeing defined, and the TUs which break are -DINIT_SECTIONS_ONLY which includesinit.hprior to__usedhaving being defined.
Quoted 7 lines
And yet, there's no un-expanded
__usedin the preprocessed source.Also, this only goes wrong in the Shim build, not in the main build.
Also, building the object file in isolation seems to work fine, although this seems to remove -DINIT_SECTIONS_ONLY from the cmdline which is almost certainly masking what's going wrong.
It is the extra __used in the Clang case. Taking that out causes everything to compile fine.
Attempts to minimise the failing case aren't working. cvise has minimised to:
void run_in_exception_handler_fn() {
asm("" ::"i"(run_in_exception_handler_fn));
}
but this is clearly not the same issue because it's not sensitive to the presence/absence of __used.
I can't help but feeling that "error: invalid operand for inline asm constraint 'i'" is a knock-on effect from something else, rather than the original root cause.
~Andrew