New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some function symbols from assembly files miss lowest bit set to indicate Thumb mode #866
Comments
It seems that the label
|
From what I understand
|
The symbol table seems to have entries to indicate that this is Thumb2 (the first object file is from
|
When I remove @smithp35 does that look like the failure mode you had in mind earlier? |
No it isn't; unfortunately it looks like a bad integrated as bug. In summary the ENDPROC macro adds A reproducer:
llvm-mc --triple=armv7a-linux-gnueabihf blne.s -filetype=obj -o blne.o --arm-add-build-attributes
We want the value of __setup_mmu to be I know that the integrated assembler keeps track of the current state (ARM or Thumb), this may be inheriting the state from the last known value. Definitely worth raising an upstream PR for. |
@smithp35 thanks for looking into this. I can confirm that using the macro before the label helps. I also found two more instances in Created a bug upstream: https://llvm.org/pr44860 |
Patch submitted: |
cc @jcai19 |
Make sure to set the bottom bit of the symbol even when the type attribute of a label is set after the label. GNU as sets the thumb state according to the thumb state of the label. If a .type directive is placed after the label, set the symbol's thumb state according to the thumb state of the .type directive. This matches GNU as in most cases. From: Stefan Agner <stefan@agner.ch> This fixes: https://bugs.llvm.org/show_bug.cgi?id=44860 ClangBuiltLinux/linux#866 Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D74927
Make sure to set the bottom bit of the symbol even when the type attribute of a label is set after the label. GNU as sets the thumb state according to the thumb state of the label. If a .type directive is placed after the label, set the symbol's thumb state according to the thumb state of the .type directive. This matches GNU as in most cases. From: Stefan Agner <stefan@agner.ch> This fixes: https://bugs.llvm.org/show_bug.cgi?id=44860 ClangBuiltLinux/linux#866 Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D74927
Make sure to set the bottom bit of the symbol even when the type attribute of a label is set after the label. GNU as sets the thumb state according to the thumb state of the label. If a .type directive is placed after the label, set the symbol's thumb state according to the thumb state of the .type directive. This matches GNU as in most cases. From: Stefan Agner <stefan@agner.ch> This fixes: https://bugs.llvm.org/show_bug.cgi?id=44860 ClangBuiltLinux/linux#866 Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D74927
When building with
AS=clang
andCONFIG_THUMB2_KERNEL=y
the kernel crashes shortly after relocating itself (but still inarch/arm/boot/compressed/head.S
).Debugging showed that the CPU switches at a branch in
__armv7_mmu_cache_on
to ARM mode and crashes subsequently.Further investigations needed.
Update: Renamed titel to reflect findings.
The text was updated successfully, but these errors were encountered: