ISR weak alias used when ISR defined without flto

Bug #1857138 reported by Mr Ben W Midgley
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Invalid
Undecided
Joey Ye

Bug Description

gcc-arm-none-eabi-9-2019-q4-major-win32 -- binary install (full version details at end of this text).

Running on windows 10, cross compile for (arm-m4) STM32F4xx

CCOPTS=arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -DSTM32F4XX -DHSE_VALUE=8000000 -DSTM32F40XX -DUSE_STDPERIPH_DRIVER -std=gnu11 -MMD -MP

LINKOPTS=arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -T "application.ld" -Xlinker --gc-sections --specs=nosys.specs -o "debug.elf"

I have all my interrupts weak aliased to a default handler and in some cases these are meant to be overridden, instead the default handler is always linked inspite of a defined handler existing elsewhere.

I am aware of both the following which are similar but I have checked and I am NOT using -flto
 - https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
 - https://bugs.launchpad.net/gcc-arm-embedded/+bug/1788156

One difference I am aware of is that I have re-located my application 128K further up the flash to make space for a bootloader as follows..

 - If I put my .isr_vector in FLASH section and reset SCB->VTOR = 0x08020000 then my TIM2_IRQHandler is
   not executed, instead the Default_Handler is periodically executed.

 - It does not appear to matter which order the object files are presented to the linker.

 - Moving .isr_vector back to BOOT and resetting VTOR does not resolve this.

---------------------------------------------------------------------------------------------------
startup.s:

 .section .isr_vector, "a", %progbits
 .type g_pfnVectors, %object
 .size g_pfnVectors, .-g_pfnVectors

 g_pfnVectors:
  .word _estack
  .word Reset_Handler
  .word NMI_Handler
..
  .word TIM2_IRQHandler

---------------------------------------------------------------------------------------------------

system.c

{
..
SCB->VTOR = 0x08020000
..

---------------------------------------------------------------------------------------------------

linker.ld:

MEMORY
{
  BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* Sector 0..11 */
  FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* Sector 0..11 */
  UPDATE (rx) : ORIGIN = 0x08080000, LENGTH = 384K /* Sector 0..11 */
  SWAP (rx) : ORIGIN = 0x080E0000, LENGTH = 128K /* Sector 0..11 */
..
..

  .isr_vector :
  {
    . = ALIGN(4);
    KEEP(*(.isr_vector)) /* Startup code */
    . = ALIGN(4);
  } >FLASH

..
..

   .weak TIM2_IRQHandler
   .thumb_set TIM2_IRQHandler,Default_Handler

---------------------------------------------------------------------------------------------------

arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=c:/users/bmidgley/work/sherpa/fccp_sw-add_dataload/bin/arm-none-eabi-gcc/9\ 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/src/gcc/configure --build=x86_64-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw --libexecdir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw/lib --infodir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-mingw-wildcard --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/install-mingw/arm-none-eabi --with-libiconv-prefix=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/build-mingw/host-libs/usr --with-gmp=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/build-mingw/host-libs/usr --with-mpfr=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/build-mingw/host-libs/usr --with-mpc=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/build-mingw/host-libs/usr --with-isl=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/build-mingw/host-libs/usr --with-libelf=/mnt/workspace/workspace/GCC-9-pipeline/jenkins-GCC-9-pipeline-100_20191030_1572397542/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for Arm Embedded Processors 9-2019-q4-major' --with-multilib-list=rmprofile
Thread model: single
gcc version 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599] (GNU Tools for Arm Embedded Processors 9-2019-q4-major)

Revision history for this message
stewo (wolfer-y) wrote : [Autoreply] [Bug 1857138] [NEW] ISR weak alias used when ISR defined without flto
Download full text (12.5 KiB)

Ich bin bis 08.01. nicht im Haus und kann Ihre Nachricht daher leider nicht bearbeiten. In dringenden Fällen wenden Sie sich bitte an <email address hidden> bzw. für technische Fragen an <email address hidden>.

I am out of office until January 8th and won't be able to read your message. In urgent cases, please refer to <email address hidden> or for technical questions to <email address hidden>.

Mit freundlichen Grüßen / Best regards

Steffen Wolfer

--
Dipl.-Inform. Steffen Wolfer
Software Engineer Embedded Systems

WEISS ROBOTICS GmbH & Co. KG
Karl-Heinrich-Käferle-Str. 8
D-71640 Ludwigsburg, Germany

Phone: +49 7141 94702-22
Fax: +49 7141 94702-99
http://www.weiss-robotics.com

Sitz der Gesellschaft: Ludwigsburg
Registergericht Stuttgart, HRA725006

Pers. haftende Gesellschafterin:
Weiss Robotics Verwaltungs-GmbH, Sitz Ludwigsburg
Registergericht Stuttgart, HRB73310
Geschäftsführer: Dr. Karsten Weiß

Public bug reported:

gcc-arm-none-eabi-9-2019-q4-major-win32 -- binary install (full version
details at end of this text).

Running on windows 10, cross compile for (arm-m4) STM32F4xx

CCOPTS=arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard
-mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-
sections -fdata-sections -g3 -DSTM32F4XX -DHSE_VALUE=8000000
-DSTM32F40XX -DUSE_STDPERIPH_DRIVER -std=gnu11 -MMD -MP

LINKOPTS=arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard
-mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-
sections -fdata-sections -g3 -T "application.ld" -Xlinker --gc-sections
--specs=nosys.specs -o "debug.elf"

I have all my interrupts weak aliased to a default handler and in some
cases these are meant to be overridden, instead the default handler is
always linked inspite of a defined handler existing elsewhere.

I am aware of both the following which are similar but I have checked and I am NOT using -flto
 - https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
 - https://bugs.launchpad.net/gcc-arm-embedded/+bug/1788156

One difference I am aware of is that I have re-located my application
128K further up the flash to make space for a bootloader as follows..

 - If I put my .isr_vector in FLASH section and reset SCB->VTOR = 0x08020000 then my TIM2_IRQHandler is
   not executed, instead the Default_Handler is periodically executed.

 - It does not appear to matter which order the object files are
presented to the linker.

 - Moving .isr_vector back to BOOT and resetting VTOR does not resolve
this.

---------------------------------------------------------------------------------------------------
startup.s:

 .section .isr_vector, "a", %progbits
 .type g_pfnVectors, %object
 .size g_pfnVectors, .-g_pfnVectors

 g_pfnVectors:
  .word _estack
  .word Reset_Handler
  .word NMI_Handler
..
  .word TIM2_IRQHandler

---------------------------------------------------------------------------------------------------

system.c

{
..
SCB->VTOR = 0x08020000
..

---------------------------------------------------------------------------------------------------

linker.ld:

MEMORY
{
  BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* Sector 0..11 */
  FL...

Revision history for this message
Joey Ye (jinyun-ye) wrote :

This doesn't seem to be a bug in toolchain itself. It is likely a usage problem in startup code. Please reach to forums to seek help.

Changed in gcc-arm-embedded:
assignee: nobody → Joey Ye (jinyun-ye)
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.