public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgcc: IA64: don't compile glibc-based unwinder without libc headers
@ 2022-04-07 16:12 Sergei Trofimovich
  2022-04-08  6:26 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Trofimovich @ 2022-04-07 16:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ian Lance Taylor, Sergei Trofimovich

From: Sergei Trofimovich <siarheit@google.com>

In --without-headers mode gcc fails to bootstrap on libgcc as:

    /build/build/./gcc/xgcc -B/build/build/./gcc/ ... -Dinhibit_libc -c fde-glibc.c
    ../../../gcc-12-20220403/libgcc/config/ia64/fde-glibc.c:33:10:
        fatal error: stdlib.h: No such file or directory

Most other linux targets are able to build the --without-headers
compiler without additional effort. This change adds IA64 to the fold.

The change drops part of the code that relies on DYNAMIC glibc
section traversal for backtraces.

Tested bootstrap of ia64-unknown-linux-gnu with and without libc
headers present.

libgcc/
	* config/ia64/fde-glibc.c: Make a no-op in inhibit_libc mode.
---
 libgcc/config/ia64/fde-glibc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libgcc/config/ia64/fde-glibc.c b/libgcc/config/ia64/fde-glibc.c
index 9caac2bca24..bd74847fa85 100644
--- a/libgcc/config/ia64/fde-glibc.c
+++ b/libgcc/config/ia64/fde-glibc.c
@@ -22,20 +22,21 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
 /* Locate the FDE entry for a given address, using glibc ld.so routines
    to avoid register/deregister calls at DSO load/unload.  */
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE 1
 #endif
 #include "config.h"
+#ifndef inhibit_libc
 #include <stddef.h>
 #include <stdlib.h>
 #include <link.h>
 #include "unwind-ia64.h"
 
 #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) \
     || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && !defined(DT_CONFIG))
 # error You need GLIBC 2.2.4 or later on IA-64 Linux
 #endif
 
@@ -152,10 +153,11 @@ _Unwind_FindTableEntry (void *pc, unw_word *segment_base, unw_word *gp,
   data.pc = (Elf64_Addr) pc;
   data.segment_base = segment_base;
   data.gp = gp;
   data.ret = NULL;
 
   if (dl_iterate_phdr (_Unwind_IteratePhdrCallback, &data) < 0)
     return NULL;
 
   return data.ret;
 }
+#endif
-- 
2.35.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libgcc: IA64: don't compile glibc-based unwinder without libc headers
  2022-04-07 16:12 [PATCH] libgcc: IA64: don't compile glibc-based unwinder without libc headers Sergei Trofimovich
@ 2022-04-08  6:26 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-04-08  6:26 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: GCC Patches, Ian Lance Taylor, Sergei Trofimovich

On Thu, Apr 7, 2022 at 6:13 PM Sergei Trofimovich via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> From: Sergei Trofimovich <siarheit@google.com>
>
> In --without-headers mode gcc fails to bootstrap on libgcc as:
>
>     /build/build/./gcc/xgcc -B/build/build/./gcc/ ... -Dinhibit_libc -c fde-glibc.c
>     ../../../gcc-12-20220403/libgcc/config/ia64/fde-glibc.c:33:10:
>         fatal error: stdlib.h: No such file or directory
>
> Most other linux targets are able to build the --without-headers
> compiler without additional effort. This change adds IA64 to the fold.
>
> The change drops part of the code that relies on DYNAMIC glibc
> section traversal for backtraces.
>
> Tested bootstrap of ia64-unknown-linux-gnu with and without libc
> headers present.

OK.

Thanks,
Richard.

> libgcc/
>         * config/ia64/fde-glibc.c: Make a no-op in inhibit_libc mode.
> ---
>  libgcc/config/ia64/fde-glibc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libgcc/config/ia64/fde-glibc.c b/libgcc/config/ia64/fde-glibc.c
> index 9caac2bca24..bd74847fa85 100644
> --- a/libgcc/config/ia64/fde-glibc.c
> +++ b/libgcc/config/ia64/fde-glibc.c
> @@ -22,20 +22,21 @@
>     see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>     <http://www.gnu.org/licenses/>.  */
>
>  /* Locate the FDE entry for a given address, using glibc ld.so routines
>     to avoid register/deregister calls at DSO load/unload.  */
>
>  #ifndef _GNU_SOURCE
>  #define _GNU_SOURCE 1
>  #endif
>  #include "config.h"
> +#ifndef inhibit_libc
>  #include <stddef.h>
>  #include <stdlib.h>
>  #include <link.h>
>  #include "unwind-ia64.h"
>
>  #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) \
>      || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && !defined(DT_CONFIG))
>  # error You need GLIBC 2.2.4 or later on IA-64 Linux
>  #endif
>
> @@ -152,10 +153,11 @@ _Unwind_FindTableEntry (void *pc, unw_word *segment_base, unw_word *gp,
>    data.pc = (Elf64_Addr) pc;
>    data.segment_base = segment_base;
>    data.gp = gp;
>    data.ret = NULL;
>
>    if (dl_iterate_phdr (_Unwind_IteratePhdrCallback, &data) < 0)
>      return NULL;
>
>    return data.ret;
>  }
> +#endif
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-08  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 16:12 [PATCH] libgcc: IA64: don't compile glibc-based unwinder without libc headers Sergei Trofimovich
2022-04-08  6:26 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).