elf: ELF toolchain --without-{headers, newlib} should provide stdint.h

Message ID 20221003203543.154431-1-arsen@aarsen.me
State Accepted, archived
Headers
Series elf: ELF toolchain --without-{headers, newlib} should provide stdint.h |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Arsen Arsenović Oct. 3, 2022, 8:35 p.m. UTC
  stdint.h is considered a freestanding headers by C, and a valid stdint.h
is required for certain parts of libstdc++' configuration, so we should
simply provide one when we have no other way (i.e. newlib or
user-specified sysroot) of getting one.

gcc/ChangeLog:

	* config.gcc: --target=*-elf --without-{newlib,headers} should
	provide stdint.h.
---
Evening,

Currently, freestanding *-elf toolchains without newlib will always produce
invalid stdint.h files, tripping up libstdc++ configure scripts (see PR104605).
This patch should make no-newlib no-headers always provide stdint.h.

Thanks.

 gcc/config.gcc | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Arsen Arsenović Oct. 10, 2022, 6:05 p.m. UTC | #1
Evening,

Ping on this patch, it should fix some configuration issues we get on 
ELF targets (especially in libstdc++).

https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602751.html

Thanks,
  
Richard Biener Oct. 11, 2022, 6:47 a.m. UTC | #2
On Mon, Oct 10, 2022 at 8:06 PM Arsen Arsenović via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Evening,
>
> Ping on this patch, it should fix some configuration issues we get on
> ELF targets (especially in libstdc++).
>
> https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602751.html

OK.

Thanks,
Richard.

> Thanks,
> --
> Arsen Arsenović
  
Arsen Arsenović Oct. 14, 2022, 7:33 p.m. UTC | #3
On Tuesday, 11 October 2022 08:47:32 CEST Richard Biener wrote:
> OK.

Thanks for the review.  I don't have push rights currently, so could you 
push this for me?

Have a good evening,
  

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 555f257c2e7..6633910d2b7 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1079,6 +1079,11 @@  case ${target} in
   # Assume that newlib is being used and so __cxa_atexit is provided.
   default_use_cxa_atexit=yes
   use_gcc_stdint=wrap
+
+  case "${with_newlib}-${with_headers}" in
+  no-no) use_gcc_stdint=provide ;;
+  *) ;;
+  esac
   ;;
 esac