You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symbol table '.symtab' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0
2: 00000000 0 FUNC LOCAL DEFAULT 2 __setup_mmu
This has been observed when trying to build Linux for 32-bit ARM in Thumb2 mode. When the object file gets linked, the linker inserts a blx instruction which switches the CPU instruction set...
The text was updated successfully, but these errors were encountered:
Symbol table '.symtab' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0
2: 00000000 0 FUNC LOCAL DEFAULT 2 __setup_mmu
Symbol table '.symtab' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0
2: 00000001 0 FUNC LOCAL DEFAULT 2 __setup_mmu << value = 1 here
Yes, the type STT_FUNC says the state (ARM/Thumb) of the symbol is determined by the bottom bit. So when STT_FUNC is set bit0 == 0 means the linker treats the symbol as ARM, bit 0 == 1 means Thumb. So this in effect causes the linker to change state incorrectly causing an illegal instruction.
Extended Description
Using the .type directive to mark a label as a function in Thumb mode does not get the correct symbol table entry.
__setup_mmu:
it ne
blne __setup_mmu
.type __setup_mmu, %function // Move this line before __setup_mmu for correct behaviour.
llvm-mc --triple=armv7a-linux-gnueabihf blne.s -filetype=obj -o blne.o --arm-add-build-attributes
llvm-readelf --symbols blne.o
Symbol table '.symtab' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 2 $t.0
2: 00000000 0 FUNC LOCAL DEFAULT 2 __setup_mmu
This has been observed when trying to build Linux for 32-bit ARM in Thumb2 mode. When the object file gets linked, the linker inserts a blx instruction which switches the CPU instruction set...
The text was updated successfully, but these errors were encountered: