This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fwd: [PATCH] arm: ensure symbol is a thumb symbol in new binutils


Hi Nick,
On 06/11/2018 04:03 PM, Nick Clifton wrote:
> Hi Christophe,
>
>> On code generated we see the issue on entry-common.o
>> (arch/arm/kernel/entry-common.o):
>> code ok: f2af 1e3b     subw    lr, pc, #315    ; 0x13b
>> code KO: f2af 1e3a     subw    lr, pc, #314    ; 0x13a
>> (see assembler code obtained by objdump)
> OK - so this translates to the use of the "badr" macro defined
> in include/asm/assembler.h:
>
> 	.macro	badr\c, rd, sym
> #ifdef CONFIG_THUMB2_KERNEL
> 	adr\c	\rd, \sym + 1
> #else
> 	adr\c	\rd, \sym
> #endif
> 	.endm
>
>
> What is the CONFIG_THUMB2_KERNEL flag ?
Defiinition of CONFIG_THUMB2_KERNEL
config THUMB2_KERNEL "Compile the kernel in Thumb-2 mode"
     help
       By enabling this option, the kernel will be compiled in
       Thumb-2 mode. A compiler/assembler that understand the unified
       ARM-Thumb syntax is needed.

>
> I am wondering why it alters the behaviour of the badr macro...
>
>
>> -fno-PIE -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
> Question - is the -mno-thumb-interwork flag always used ?
The compilation option "-mno-thumb-interwork" are used only
if "CONFIG_AEABI" are put in place for arm platform therefore yes for 
arm cortex-M
is used on all ARM of kernel configuration.

>
> It seems to me that this flag might provide a much simpler option
> to fix the assembler.  Ie:  if -mthumb-interwork is enabled then
> the ADR pseudo-instruction should include the interworking bit (for
> thumb function symbols), whereas if -mno-thumb-interwork is in
> effect, then it should not.
>
> Cheers
>    Nick
Info for CONFIG_AEABI: Use the ARM EABI to compile the kernel.
This option allows for the kernel to be compiled using the latest
ARM ABI (aka EABI).  This is only useful if you are using a user
space environment that is also compiled with EABI.
Since there are major incompatibilities between the legacy ABI and
EABI, especially with regard to structure member alignment, this
option also changes the kernel syscall calling convention to
disambiguate both ABIs and allow for backward compatibility support

Thanks for the analysis


-- 

Best regards / Cordialement,

Christophe Priouzeau | Tel: +33 244027320
STMicroelectronics
ST online: www.st.com<http://www.st.com/>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]