Skip to content

fix build issues when building stm32f4discovery with elf and cpp exceptions#11688

Open
CookieDoughMixer wants to merge 2 commits intoapache:masterfrom
CookieDoughMixer:fix_build_break
Open

fix build issues when building stm32f4discovery with elf and cpp exceptions#11688
CookieDoughMixer wants to merge 2 commits intoapache:masterfrom
CookieDoughMixer:fix_build_break

Conversation

@CookieDoughMixer
Copy link
Copy Markdown

Summary

binfmt/libelf: add exidx and extab sections in linker script

exidx and extab sections are required for exception handling, hence
add them to the elf linker script

include/nuttx: fix "unknown type name bool" build error in elf.h

fix the following error by including stdbool.h in elf.h

CC:  machine/arm/gnu_unwind_find_exidx.c In file included from machine/arm/gnu_unwind_find_exidx.c:25:
/home/abhishek/Work/public/nuttx_build/nuttx/include/nuttx/elf.h:118:1: error: unknown type name 'bool'
  118 | bool up_checkarch(FAR const Elf_Ehdr *hdr);
      | ^~~~
make[1]: *** [Makefile:153: bin/gnu_unwind_find_exidx.o] Error 1
make: *** [tools/LibTargets.mk:180: libs/libc/libc.a] Error 2

Impact

Testing

fix the following error by including stdbool.h in elf.h

CC:  machine/arm/gnu_unwind_find_exidx.c In file included from machine/arm/gnu_unwind_find_exidx.c:25:
/home/abhishek/Work/public/nuttx_build/nuttx/include/nuttx/elf.h:118:1: error: unknown type name 'bool'
  118 | bool up_checkarch(FAR const Elf_Ehdr *hdr);
      | ^~~~
make[1]: *** [Makefile:153: bin/gnu_unwind_find_exidx.o] Error 1
make: *** [tools/LibTargets.mk:180: libs/libc/libc.a] Error 2

Signed-off-by: Abhishek Akkabathula <a.akkabathul@samsung.com>
…ions

exidx and extab sections are required for exception handling and are not part
of linker script present in binfmt/libelf. Hence, added linker script with the
sections for stm32f4discovery

Signed-off-by: Abhishek Akkabathula <a.akkabathul@samsung.com>

LDELFFLAGS = -r -e main
LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld)
LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/boards/arm/stm32/stm32f4discovery/scripts/gnu-elf.ld)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abhishek-samsung let's fix gnu-elf.ld directly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11688 (comment)

I was told not to direclty modify the gnu-elf.ld file, as it might be used for other architectures

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nonexistent section doesn't have any bad side effect. @acassis is it good to only fix stm32f4discovery?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaoxiang781216 adding an ARM only section inside a generic libelf doesn't seams the right approach. An option is creating a generic section and at board level that section is defined and include the ARM specific section inside it (other boards from different arch could do the same). Maybe @patacongo could have a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants