From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Cc: phcoder@gmail.com, bean123ch@gmail.com,
David Miller <davem@davemloft.net>
Subject: [PATCH] auto-generate libgcc.h
Date: Tue, 20 Oct 2009 23:38:41 +0200 [thread overview]
Message-ID: <20091020213841.GA8854@thorin> (raw)
In-Reply-To: <20091017101110.GA11305@thorin>
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
This should be a much cleaner option than maintaining libgcc.h by hand. Only
tested on sparc, but it should also cast out the build problems on powerpc.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
[-- Attachment #2: libgcc.diff --]
[-- Type: text/x-diff, Size: 8566 bytes --]
2009-10-20 Robert Millan <rmh.grub@aybabtu.com>
* genlibgcc_h.sh.in: New file.
* conf/powerpc-ieee1275.rmk (MOSTLYCLEANFILES): Add `libgcc.h'.
(libgcc.h): New rule.
(kernel_syms.lst): Add `libgcc.h' to header list.
* conf/sparc64-ieee1275.rmk: Likewise.
* include/grub/sparc64/libgcc.h: Remove. Update all users.
* include/grub/powerpc/libgcc.h: Likewise.
* configure.ac: Stop checking for libgcc symbols.
* include/grub/misc.h [!GRUB_UTIL] (memset, memcmp): New prototypes
(provided by libc.so or kernel.img, NOT libgcc).
Index: conf/powerpc-ieee1275.rmk
===================================================================
--- conf/powerpc-ieee1275.rmk (revision 2641)
+++ conf/powerpc-ieee1275.rmk (working copy)
@@ -10,19 +10,22 @@ script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
-MOSTLYCLEANFILES += symlist.c kernel_syms.lst
+MOSTLYCLEANFILES += symlist.c kernel_syms.lst libgcc.h
DEFSYMFILES += kernel_syms.lst
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
- symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
+ symbol.h term.h time.h types.h loader.h partition.h \
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
command.h
+libgcc.h: genlibgcc_h.sh
+ /bin/sh $< > $@ || (rm -f $@; exit 1)
+
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
-kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
+kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) libgcc.h config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Programs
Index: conf/sparc64-ieee1275.rmk
===================================================================
--- conf/sparc64-ieee1275.rmk (revision 2641)
+++ conf/sparc64-ieee1275.rmk (working copy)
@@ -23,14 +23,14 @@ diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
diskboot_img_FORMAT = binary
-MOSTLYCLEANFILES += symlist.c kernel_syms.lst
+MOSTLYCLEANFILES += symlist.c kernel_syms.lst libgcc.h
DEFSYMFILES += kernel_syms.lst
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
list.h handler.h command.h \
- sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
+ ieee1275/ieee1275.h machine/kernel.h \
sparc64/ieee1275/ieee1275.h
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
@@ -54,7 +54,10 @@ kernel_img_FORMAT = binary
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
-kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
+libgcc.h: genlibgcc_h.sh
+ /bin/sh $< > $@ || (rm -f $@; exit 1)
+
+kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) libgcc.h config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Utilities.
Index: configure.ac
===================================================================
--- configure.ac (revision 2642)
+++ configure.ac (working copy)
@@ -411,9 +411,6 @@ AC_SUBST(TARGET_ASFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_LDFLAGS)
-# Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS)
-AC_CHECK_FUNCS(__bswapsi2 __bswapdi2)
-
# Set them to their new values for the tests below.
CC="$TARGET_CC"
if test "x$TARGET_APPLE_CC" = x1 ; then
@@ -615,7 +612,7 @@ else
rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
fi
-AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
+AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh genlibgcc_h.sh])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_OUTPUT
[
Index: include/grub/misc.h
===================================================================
--- include/grub/misc.h (revision 2641)
+++ include/grub/misc.h (working copy)
@@ -78,6 +78,8 @@ grub_strncat (char *dest, const char *src, int c)
#if !defined (GRUB_UTIL) || !defined (APPLE_CC)
void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
+void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
+int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
#endif
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
Index: include/grub/sparc64/libgcc.h
===================================================================
--- include/grub/sparc64/libgcc.h (revision 2641)
+++ include/grub/sparc64/libgcc.h (working copy)
@@ -1,31 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2004,2007 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-void EXPORT_FUNC (memset) (void);
-
-#ifdef HAVE___BSWAPSI2
-typedef int SItype __attribute__ ((mode (SI)));
-SItype EXPORT_FUNC (__bswapsi2) (SItype);
-#endif
-
-#ifdef HAVE___BSWAPDI2
-typedef int DItype __attribute__ ((mode (DI)));
-DItype EXPORT_FUNC (__bswapdi2) (DItype);
-#endif
Index: include/grub/powerpc/libgcc.h
===================================================================
--- include/grub/powerpc/libgcc.h (revision 2641)
+++ include/grub/powerpc/libgcc.h (working copy)
@@ -1,24 +0,0 @@
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2004,2007 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-void EXPORT_FUNC (memset) (void);
-void EXPORT_FUNC (__ashldi3) (void);
-void EXPORT_FUNC (__ashrdi3) (void);
-void EXPORT_FUNC (__lshrdi3) (void);
-void EXPORT_FUNC (__trampoline_setup) (void);
-void EXPORT_FUNC (__ucmpdi2) (void);
Index: genlibgcc_h.sh.in
===================================================================
--- genlibgcc_h.sh.in (revision 0)
+++ genlibgcc_h.sh.in (revision 0)
@@ -0,0 +1,31 @@
+#! /bin/sh
+#
+# Copyright (C) 2006,2009 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+### The configure script will replace these variables.
+
+: ${srcdir=@srcdir@}
+: ${CC=@CC@}
+
+
+cat <<EOF
+/* This file is automatically generated by $0. DO NOT EDIT! */
+
+EOF
+
+nm --defined-only `$CC -print-libgcc-file-name` \
+ | sed -ne "s/^[0-9]* T //p" \
+ | sed -e "s/\(.*\)/void EXPORT_FUNC (\1) (void);/"
next prev parent reply other threads:[~2009-10-20 21:38 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-12 8:55 powerpc/sparc problems Felix Zielcke
2009-10-12 9:05 ` David Miller
2009-10-12 9:42 ` Felix Zielcke
2009-10-12 9:56 ` Vladimir 'phcoder' Serbinenko
2009-10-12 10:11 ` David Miller
2009-10-12 10:27 ` Felix Zielcke
2009-10-12 9:26 ` Vladimir 'phcoder' Serbinenko
2009-10-12 9:33 ` Felix Zielcke
2009-10-20 18:07 ` rubisher
2009-10-20 20:24 ` Vladimir 'phcoder' Serbinenko
2009-10-21 15:59 ` rubisher
2009-10-12 9:58 ` Bean
2009-10-12 10:14 ` David Miller
2009-10-12 10:26 ` Vladimir 'phcoder' Serbinenko
2009-10-12 10:28 ` David Miller
2009-10-12 15:29 ` Pavel Roskin
2009-10-12 15:45 ` Vladimir 'phcoder' Serbinenko
2009-10-12 22:03 ` Pavel Roskin
2009-10-12 23:39 ` David Miller
2009-10-15 11:58 ` Vladimir 'phcoder' Serbinenko
2009-10-15 22:41 ` Pavel Roskin
2009-10-16 12:44 ` David Miller
2009-10-16 14:10 ` Pavel Roskin
2009-10-17 1:21 ` Pavel Roskin
2009-10-17 9:08 ` Vladimir 'phcoder' Serbinenko
2009-10-17 10:11 ` Robert Millan
2009-10-20 21:38 ` Robert Millan [this message]
2009-10-21 6:28 ` [PATCH] auto-generate libgcc.h Vladimir 'phcoder' Serbinenko
2009-10-21 15:55 ` rubisher
2009-10-21 21:00 ` Vladimir 'phcoder' Serbinenko
2009-10-23 16:19 ` rubisher
2009-10-12 10:31 ` powerpc/sparc problems Bean
2009-10-12 11:07 ` David Miller
2009-10-12 14:05 ` Bean
2009-10-14 16:37 ` Robert Millan
2009-10-21 16:03 ` rubisher
2009-10-21 20:15 ` Bean
2009-10-28 10:24 ` Felix Zielcke
2009-10-28 10:29 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091020213841.GA8854@thorin \
--to=rmh@aybabtu.com \
--cc=bean123ch@gmail.com \
--cc=davem@davemloft.net \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.