Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

abhishek-samsung
Copy link

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>
binfmt/libelf/gnu-elf.ld Outdated Show resolved Hide resolved
…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>
@@ -51,4 +51,4 @@ CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs

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
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
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
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
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.

None yet

3 participants