dietlibc-0.33-biarch.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. diff -Naurp dietlibc-0.33.20120825/diet.c~ dietlibc-0.33.20120825/diet.c
  2. --- diet.c~ 2013-11-03 18:56:45.416768005 +0100
  3. +++ diet.c 2013-11-03 18:59:06.785762840 +0100
  4. @@ -71,6 +71,7 @@ int main(int argc,char *argv[]) {
  5. int shared=0;
  6. #endif
  7. char* shortplatform=0;
  8. + char* shortplatform32=0;
  9. #ifdef WANT_SAFEGUARD
  10. char safeguard1[]="-include";
  11. char* safeguard2;
  12. @@ -187,11 +188,26 @@ int main(int argc,char *argv[]) {
  13. shortplatform="parisc";
  14. #endif
  15. #ifdef __x86_64__
  16. - shortplatform=(m==32?"i386":(m==33?"x32":"x86_64"));
  17. + shortplatform="x86_64";
  18. + shortplatform32="i386";
  19. #endif
  20. #ifdef __ia64__
  21. shortplatform="ia64";
  22. #endif
  23. + /* Check for -m32 on biarch platforms */
  24. + /* NOTE: though it's wrong to pass both -m32/-m64 flags to
  25. + * gcc at once, we pick up the last one only */
  26. + if (shortplatform32) {
  27. + int i, m64=1;
  28. + for (i=0; i<argc; ++i) {
  29. + if (!strcmp(argv[i],"-m32"))
  30. + m64=0;
  31. + else if (!strcmp(argv[i],"-m64"))
  32. + m64=1;
  33. + }
  34. + if (!m64)
  35. + shortplatform=shortplatform32;
  36. + }
  37. {
  38. char *tmp=platform+strlen(platform);
  39. strcpy(tmp,shortplatform);
  40. diff -Naurp dietlibc-0.33.20120825/Makefile~ dietlibc-0.33.20120825/Makefile
  41. --- Makefile~ 2013-11-03 19:10:57.392736875 +0100
  42. +++ Makefile 2013-11-03 19:15:01.344727962 +0100
  43. @@ -56,6 +56,7 @@ MYARCH=parisc
  44. else
  45. ifeq ($(MYARCH),x86_64)
  46. ARCH=x86_64
  47. +ARCH32=i386
  48. else
  49. ifeq ($(MYARCH),ia64)
  50. ARCH=ia64
  51. @@ -88,15 +89,22 @@ ILIBDIR=$(LIBDIR)-$(ARCH)
  52. HOME=$(shell pwd)
  53. -WHAT= $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \
  54. +LIBS= $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \
  55. $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \
  56. $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \
  57. $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \
  58. - $(OBJDIR)/libcrypt.a \
  59. - $(OBJDIR)/diet $(OBJDIR)/diet-i $(OBJDIR)/elftrunc \
  60. - $(OBJDIR)/dnsd
  61. + $(OBJDIR)/libcrypt.a
  62. -all: $(WHAT)
  63. +all: all_32 libs $(OBJDIR)/diet $(OBJDIR)/diet-i
  64. +
  65. +libs: $(LIBS)
  66. +
  67. +ifeq (,$(ARCH32))
  68. +all_32:
  69. +else
  70. +all_32:
  71. + $(MAKE) MYARCH=$(ARCH32) CC="$(CC) -m32" libs
  72. +endif
  73. profiling: $(OBJDIR)/libgmon.a $(OBJDIR)/pstart.o
  74. @@ -363,17 +371,19 @@ t:
  75. t1:
  76. $(CROSS)$(CC) -g -o t1 t.c
  77. -install-bin: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/librpc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(OBJDIR)/elftrunc $(OBJDIR)/diet-i
  78. - $(INSTALL) -d $(DESTDIR)$(ILIBDIR) $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(BINDIR)
  79. +install-lib: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/librpc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a
  80. + $(INSTALL) -d $(DESTDIR)$(ILIBDIR)
  81. $(INSTALL) $(OBJDIR)/start.o $(DESTDIR)$(ILIBDIR)/start.o
  82. $(INSTALL) -m 644 $(OBJDIR)/libm.a $(OBJDIR)/libpthread.a $(OBJDIR)/librpc.a \
  83. $(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(OBJDIR)/libcrypt.a $(DESTDIR)$(ILIBDIR)
  84. $(INSTALL) -m 644 $(OBJDIR)/dietlibc.a $(DESTDIR)$(ILIBDIR)/libc.a
  85. +
  86. +install-bin: $(OBJDIR)/diet-i
  87. + $(INSTALL) -d $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(BINDIR)
  88. ifeq ($(MYARCH),$(ARCH))
  89. $(INSTALL) $(OBJDIR)/diet-i $(DESTDIR)$(BINDIR)/diet
  90. -$(INSTALL) $(PICODIR)/diet-dyn-i $(DESTDIR)$(BINDIR)/diet-dyn
  91. endif
  92. - $(INSTALL) -m 755 $(OBJDIR)/elftrunc $(OBJDIR)/dnsd $(DESTDIR)$(BINDIR)
  93. $(INSTALL) -m 644 diet.1 $(DESTDIR)$(MAN1DIR)/diet.1
  94. install-profiling:
  95. @@ -393,8 +403,14 @@ install-pic:
  96. install-headers:
  97. for i in `find include -name \*.h`; do install -m 644 -D $$i $(DESTDIR)$(prefix)/$$i; done
  98. +ifeq (,$(ARCH32))
  99. +install-32:
  100. +else
  101. +install-32:
  102. + $(MAKE) MYARCH=$(ARCH32) CC="$(CC) -m32" install-lib
  103. +endif
  104. -install: install-bin install-profiling install-pic install-headers
  105. +install: install-32 install-lib install-bin install-profiling install-pic install-headers
  106. uninstall:
  107. for i in start.o libm.a libpthread.a librpc.a liblatin1.a libcompat.a libcrypt.a libc.a; do rm -f $(DESTDIR)$(ILIBDIR)/$$i; done