why gcc won't support FDPIC in thumb mode?

Christophe Lyon christophe.lyon.oss@gmail.com
Fri Aug 27 12:51:57 GMT 2021


[please keep the list in cc]


On Fri, Aug 27, 2021 at 2:25 PM Mahyar Shokraeian <mahyarshokraeian@live.com>
wrote:

> Hi. Sorry I forgot to attach the build.log file. Yes crosstool-ng
> officially supports FDPIC. Can I ask how do you build your toolchains
> without the use of crosstool-ng?
>

The log is not very informative, though it fails in
 /home/mahyar1284/embedded/crosstool-ng/.build/arm-linux-uclibcgnueabi/build/build-libc-final/multilib
which seems to confirm that it is building libpthread in several
configurations, include a thumb-1 one, which is not supported.

How is gcc configured? (what is the output
of arm-none-uclinuxfdpiceabi-gcc -v?)

Why does crosstool-ng want to build multilibs? Maybe you can disable this?

For my toolchain builds & testing, I'm using custom scripts.

Christophe


>
> Mahyar
>
>
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows
>
>
> ------------------------------
> *From:* Christophe Lyon <christophe.lyon.oss@gmail.com>
> *Sent:* Thursday, August 26, 2021 5:31:34 PM
> *To:* Mahyar Shokraeian <mahyarshokraeian@live.com>; gcc-help@gcc.gnu.org
> <gcc-help@gcc.gnu.org>
> *Subject:* Re: why gcc won't support FDPIC in thumb mode?
>
>
>
> On Thu, Aug 26, 2021 at 1:24 PM Mahyar Shokraeian <
> mahyarshokraeian@live.com> wrote:
>
> Hi. Thank you for your response. This is where it throws the error:
>
> I’ve also attached my build.log and my crosstool-ng .config file for more
> accurate info. Thanks for helping me out.
>
>
> Hello,
>
> Looks like you forgot to attach build.log?
>
> Sorry I don't use crosstool-ng, so I am afraid I won't be able to help
> much.
> Does crosstool-ng actually support arm FDPIC configs?
>
> Christophe
>
>
>
>
> [INFO ]  =================================================================
>
> [INFO ]  Installing pass-2 core C gcc compiler
>
> [EXTRA]    Configuring core C gcc compiler
>
> [EXTRA]    Building gcc
>
> [EXTRA]    Installing gcc
>
> [EXTRA]    Housekeeping for core gcc compiler
>
> [EXTRA]       '' --> lib (gcc)   lib (os)
>
> [INFO ]  Installing pass-2 core C gcc compiler: done in 1375.84s (at 58:08)
>
> [INFO ]  Saving state to restart at step 'libc_main'...
>
> [INFO ]  =================================================================
>
> [INFO ]  Installing C library
>
> [INFO ]
> =================================================================
>
> [INFO ]    Building for multilib 1/1: ''
>
> [EXTRA]      Copying sources to build dir
>
> [EXTRA]      Applying configuration
>
> [EXTRA]      Cleaning up startfiles
>
> [EXTRA]      Building C library
>
> [ERROR]      make[2]: *** [Makerules:369:
> libpthread/linuxthreads_db/td_thr_setprio.os] Error 1
>
> [ERROR]
>
> [ERROR]  >>
>
> [ERROR]  >>  Build failed in step 'Building for multilib 1/1: '''
>
> [ERROR]  >>        called in step 'Installing C library'
>
> [ERROR]  >>        called in step '(top-level)'
>
> [ERROR]  >>
>
> [ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@376]
>
> [ERROR]  >>        called from:
> uClibc_backend_once[scripts/build/libc/uClibc.sh@185]
>
> [ERROR]  >>        called from: CT_IterateMultilibs[scripts/functions@1608
> ]
>
> [ERROR]  >>        called from:
> uClibc_backend[scripts/build/libc/uClibc.sh@36]
>
> [ERROR]  >>        called from: uClibc_main[scripts/build/libc/uClibc.sh@16
> ]
>
> [ERROR]  >>        called from: do_libc_main[scripts/build/libc.sh@33]
>
> [ERROR]  >>        called from: main[scripts/crosstool-NG.sh@697]
>
> [ERROR]  >>
>
> [ERROR]  >>  For more info on this error, look at the file: 'build.log'
>
> [ERROR]  >>  There is a list of known issues, some with workarounds, in:
>
> [ERROR]  >>      https://crosstool-ng.github.io/docs/known-issues/
>
> [ERROR]  >>
>
> [ERROR]  >>  If you feel this is a bug in crosstool-NG, report it at:
>
> [ERROR]  >>      https://github.com/crosstool-ng/crosstool-ng/issues/
>
> [ERROR]  >>
>
> [ERROR]  >>  Make sure your report includes all the information pertinent
> to this issue.
>
> [ERROR]  >>  Read the bug reporting guidelines here:
>
> [ERROR]  >>      http://crosstool-ng.github.io/support/
>
> [ERROR]
>
> [ERROR]  (elapsed: 58:52.62)
>
> [58:54] / make[1]: *** [/usr/local/bin/ct-ng:261: build] Error 2
>
> make: *** [/usr/local/bin/ct-ng:265: build.0] Error 2
>
>
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows
>
>
> ------------------------------
> *From:* Christophe Lyon <christophe.lyon.oss@gmail.com>
> *Sent:* Thursday, August 26, 2021 1:14:36 PM
> *To:* Mahyar Shokraeian <mahyarshokraeian@live.com>
> *Cc:* gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org>
> *Subject:* Re: why gcc won't support FDPIC in thumb mode?
>
> Hello,
>
> On Thu, Aug 26, 2021 at 1:06 AM Mahyar Shokraeian via Gcc-help <
> gcc-help@gcc.gnu.org> wrote:
>
> why gcc won't support FDPIC in thumb mode?
>
> I'm trying to build a toolchain for my mmu-less cortex m7 cpu that is
> running the latest release of the mainline linux kernel using crosstool-ng.
> I've set the instruction-set to thumb because cortex m doesn't support ARM
> ISA (it's a thumb only processor).
>
> because I use shared libraries, I need FDPIC ELF instead of flat BFLT
> executables. so, I choosed FDPIC in the crosstool-ng configuration
> menuconfig.
>
> when I build the toolchain, it throws a very strange error.
>
> cc1: sorry, unimplemented: FDPIC mode is not supported in Thumb-1 mode
>
> I'm so confused! FDPIC ELF format is mainly designed for mmu-less
> architectures such as cortex-m and cortex-r that are thumb only processors.
> so why it is saying that FDPIC mode is not supported in Thumb-1 mode?
> Even I've set -mcpu=cortex-m7 and -march=armv7e-m in my toolchain
> configuration but still I see the error.
>
>
> At which point exactly do you see this error?
>
> I run daily builds of  arm-none-uclinuxfdpiceabi for cortex-m4, which is
> similar to cortex-m7 from FDPIC perspective.
> Both support thumb-2, so it should be OK.
>
> Note that FDPIC support has not been ported to thumb-1, as indicated by
> the error message you are seeing.
> Maybe you are facing the problem when building multilibs for thumb1?
>
> Christophe
>
> these are some useful sources about fdpic format on ARM MCUs:
>
>
> https://static.linaro.org/connect/sfo15/Presentations/09-24-Thursday/SFO15-406-%20ARM%20FDPIC%20Toolchains.pdf
>
> https://gcc.gnu.org/legacy-ml/gcc-patches/2019-09/msg00098.html
>
> https://gcc.gnu.org/legacy-ml/gcc-patches/2019-09/msg00533.html
>
>
> https://www.google.com/url?sa=t&source=web&rct=j&url=https://ntnuopen.ntnu.no/ntnu-xmlui/bitstream/handle/11250/250748/347817_FULLTEXT01.pdf%3Fsequence%3D3&ved=2ahUKEwiztaiqgMbyAhUFwKQKHeeGAGQ4ChAWegQIHRAB&usg=AOvVaw3SLe1u323I7JjkoqBipoXH
>
>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
>
>


More information about the Gcc-help mailing list