4.6.0-9
This commit is contained in:
parent
d176bf367a
commit
55c286cdef
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
/gcc-4.6.0-20110128.tar.bz2
|
||||
/gcc-4.6.0-20110205.tar.bz2
|
||||
/gcc-4.6.0-20110525.tar.bz2
|
||||
/gcc-4.6.0-20110530.tar.bz2
|
||||
|
153
gcc.spec
153
gcc.spec
@ -1,9 +1,9 @@
|
||||
%global DATE 20110525
|
||||
%global SVNREV 174173
|
||||
%global DATE 20110530
|
||||
%global SVNREV 174441
|
||||
%global gcc_version 4.6.0
|
||||
# Note, gcc_release must be integer, if you want to add suffixes to
|
||||
# %{release}, append them after %{gcc_release} on Release: line.
|
||||
%global gcc_release 8
|
||||
%global gcc_release 9
|
||||
%global _unpackaged_files_terminate_build 0
|
||||
%global multilib_64_archs sparc64 ppc64 s390x x86_64
|
||||
%ifarch %{ix86} x86_64 ia64 ppc ppc64 alpha
|
||||
@ -25,9 +25,9 @@
|
||||
%global build_cloog 1
|
||||
%global build_libstdcxx_docs 1
|
||||
# If you don't have already a usable gcc-java and libgcj for your arch,
|
||||
# do on some arch which has it rpmbuild -bc --with java_tar gcc41.spec
|
||||
# do on some arch which has it rpmbuild -bc --with java_tar gcc.spec
|
||||
# which creates libjava-classes-%{version}-%{release}.tar.bz2
|
||||
# With this then on the new arch do rpmbuild -ba -v --with java_bootstrap gcc41.spec
|
||||
# With this then on the new arch do rpmbuild -ba -v --with java_bootstrap gcc.spec
|
||||
%global bootstrap_java %{?_with_java_bootstrap:%{build_java}}%{!?_with_java_bootstrap:0}
|
||||
%global build_java_tar %{?_with_java_tar:%{build_java}}%{!?_with_java_tar:0}
|
||||
%ifarch s390x
|
||||
@ -55,7 +55,6 @@ Group: Development/Languages
|
||||
# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_6-branch@%{SVNREV} gcc-%{version}-%{DATE}
|
||||
# tar cf - gcc-%{version}-%{DATE} | bzip2 -9 > gcc-%{version}-%{DATE}.tar.bz2
|
||||
Source0: gcc-%{version}-%{DATE}.tar.bz2
|
||||
Source1: libgcc_post_upgrade.c
|
||||
%global fastjar_ver 0.97
|
||||
Source4: http://download.savannah.nongnu.org/releases/fastjar/fastjar-%{fastjar_ver}.tar.gz
|
||||
URL: http://gcc.gnu.org
|
||||
@ -579,6 +578,43 @@ This package contains header files and other support files
|
||||
for compiling GCC plugins. The GCC plugin ABI is currently
|
||||
not stable, so plugins must be rebuilt any time GCC is updated.
|
||||
|
||||
%if 0%{?_enable_debug_packages}
|
||||
%define debug_package %{nil}
|
||||
%global __debug_package 1
|
||||
%global __debug_install_post \
|
||||
%{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/gcc-%{version}-%{DATE}"\
|
||||
%{_builddir}/gcc-%{version}-%{DATE}/split-debuginfo.sh\
|
||||
%{nil}
|
||||
|
||||
%package debuginfo
|
||||
Summary: Debug information for package %{name}
|
||||
Group: Development/Debug
|
||||
AutoReqProv: 0
|
||||
Requires: gcc-base-debuginfo = %{version}-%{release}
|
||||
|
||||
%description debuginfo
|
||||
This package provides debug information for package %{name}.
|
||||
Debug information is useful when developing applications that use this
|
||||
package or when debugging this package.
|
||||
|
||||
%files debuginfo -f debugfiles.list
|
||||
%defattr(-,root,root)
|
||||
|
||||
%package base-debuginfo
|
||||
Summary: Debug information for libraries from package %{name}
|
||||
Group: Development/Debug
|
||||
AutoReqProv: 0
|
||||
|
||||
%description base-debuginfo
|
||||
This package provides debug information for libgcc_s, libgomp and
|
||||
libstdc++ libraries from package %{name}.
|
||||
Debug information is useful when developing applications that use this
|
||||
package or when debugging this package.
|
||||
|
||||
%files base-debuginfo -f debugfiles-base.list
|
||||
%defattr(-,root,root)
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n gcc-%{version}-%{DATE}
|
||||
%patch0 -p0 -b .hack~
|
||||
@ -604,6 +640,53 @@ not stable, so plugins must be rebuilt any time GCC is updated.
|
||||
%endif
|
||||
%patch19 -p0 -b .pr47858~
|
||||
|
||||
%if 0%{?_enable_debug_packages}
|
||||
cat > split-debuginfo.sh <<\EOF
|
||||
#!/bin/sh
|
||||
BUILDDIR="%{_builddir}/gcc-%{version}-%{DATE}"
|
||||
if [ -f "${BUILDDIR}"/debugfiles.list \
|
||||
-a -f "${BUILDDIR}"/debuglinks.list ]; then
|
||||
> "${BUILDDIR}"/debugsources-base.list
|
||||
> "${BUILDDIR}"/debugfiles-base.list
|
||||
cd "${RPM_BUILD_ROOT}"
|
||||
for f in `find usr/lib/debug -name \*.debug \
|
||||
| egrep 'lib[0-9]*/lib(gcc|gomp|stdc)'`; do
|
||||
echo "/$f" >> "${BUILDDIR}"/debugfiles-base.list
|
||||
if [ -f "$f" -a ! -L "$f" ]; then
|
||||
cp -a "$f" "${BUILDDIR}"/test.debug
|
||||
/usr/lib/rpm/debugedit -b "${RPM_BUILD_DIR}" -d /usr/src/debug \
|
||||
-l "${BUILDDIR}"/debugsources-base.list \
|
||||
"${BUILDDIR}"/test.debug
|
||||
rm "${BUILDDIR}"/test.debug
|
||||
fi
|
||||
done
|
||||
for f in `find usr/lib/debug/.build-id -type l`; do
|
||||
ls -l "$f" | egrep -q -- '->.*lib[0-9]*/lib(gcc|gomp|stdc)' \
|
||||
&& echo "/$f" >> "${BUILDDIR}"/debugfiles-base.list
|
||||
done
|
||||
grep -v -f "${BUILDDIR}"/debugfiles-base.list \
|
||||
"${BUILDDIR}"/debugfiles.list > "${BUILDDIR}"/debugfiles.list.new
|
||||
mv -f "${BUILDDIR}"/debugfiles.list.new "${BUILDDIR}"/debugfiles.list
|
||||
for f in `LC_ALL=C sort -z -u "${BUILDDIR}"/debugsources-base.list \
|
||||
| grep -E -v -z '(<internal>|<built-in>)$' \
|
||||
| xargs --no-run-if-empty -n 1 -0 echo \
|
||||
| sed 's,^,usr/src/debug/,'`; do
|
||||
if [ -f "$f" ]; then
|
||||
echo "/$f" >> "${BUILDDIR}"/debugfiles-base.list
|
||||
echo "%%exclude /$f" >> "${BUILDDIR}"/debugfiles.list
|
||||
fi
|
||||
done
|
||||
mv "${BUILDDIR}"/debugfiles-base.list{,.old}
|
||||
echo "%%dir /usr/lib/debug" > "${BUILDDIR}"/debugfiles-base.list
|
||||
awk 'BEGIN{FS="/"}(NF>4&&$NF){d="%%dir /"$2"/"$3"/"$4;for(i=5;i<NF;i++){d=d"/"$i;if(!v[d]){v[d]=1;print d}}}' \
|
||||
"${BUILDDIR}"/debugfiles-base.list.old >> "${BUILDDIR}"/debugfiles-base.list
|
||||
cat "${BUILDDIR}"/debugfiles-base.list.old >> "${BUILDDIR}"/debugfiles-base.list
|
||||
rm "${BUILDDIR}"/debugfiles-base.list.old
|
||||
fi
|
||||
EOF
|
||||
chmod 755 split-debuginfo.sh
|
||||
%endif
|
||||
|
||||
# This testcase doesn't compile.
|
||||
rm libjava/testsuite/libjava.lang/PR35020*
|
||||
|
||||
@ -622,9 +705,18 @@ tar xjf %{SOURCE10}
|
||||
sed -i -e 's/4\.6\.1/4.6.0/' gcc/BASE-VER
|
||||
echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
|
||||
|
||||
%if 0%{fedora} >= 16
|
||||
# Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
|
||||
sed -i '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' gcc/common.opt
|
||||
sed -i '/flag_debug_types_section/s/Init(1)/Init(0)/' gcc/common.opt
|
||||
sed -i 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./' gcc/doc/invoke.texi
|
||||
%else
|
||||
# Default to -gdwarf-3 rather than -gdwarf-2
|
||||
sed -i '/UInteger Var(dwarf_version)/s/Init(2)/Init(3)/' gcc/common.opt
|
||||
sed -i 's/\(may be either 2, 3 or 4; the default version is \)2\./\13./' gcc/doc/invoke.texi
|
||||
sed -i 's/#define[[:blank:]]*EMIT_ENTRY_VALUE[[:blank:]].*$/#define EMIT_ENTRY_VALUE 0/' gcc/{cfgexpand,var-tracking,dwarf2out}.c
|
||||
sed -i 's/#define[[:blank:]]*EMIT_TYPED_DWARF_STACK[[:blank:]].*$/#define EMIT_TYPED_DWARF_STACK 0/' gcc/dwarf2out.c
|
||||
%endif
|
||||
|
||||
cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
|
||||
|
||||
@ -1381,10 +1473,6 @@ exec gcc $fl ${1+"$@"}
|
||||
EOF
|
||||
chmod 755 %{buildroot}%{_prefix}/bin/c?9
|
||||
|
||||
mkdir -p %{buildroot}%{_prefix}/sbin
|
||||
gcc -static -Os %{SOURCE1} -o %{buildroot}%{_prefix}/sbin/libgcc_post_upgrade
|
||||
strip %{buildroot}%{_prefix}/sbin/libgcc_post_upgrade
|
||||
|
||||
cd ..
|
||||
%find_lang %{name}
|
||||
%find_lang cpplib
|
||||
@ -1529,7 +1617,25 @@ fi
|
||||
# Because glibc Prereq's libgcc and /sbin/ldconfig
|
||||
# comes from glibc, it might not exist yet when
|
||||
# libgcc is installed
|
||||
%post -n libgcc -p %{_prefix}/sbin/libgcc_post_upgrade
|
||||
%post -n libgcc -p <lua>
|
||||
if posix.access ("/sbin/ldconfig", "x") then
|
||||
local pid = posix.fork ()
|
||||
if pid == 0 then
|
||||
posix.exec ("/sbin/ldconfig")
|
||||
elseif pid ~= -1 then
|
||||
posix.wait (pid)
|
||||
end
|
||||
end
|
||||
|
||||
%postun -n libgcc -p <lua>
|
||||
if posix.access ("/sbin/ldconfig", "x") then
|
||||
local pid = posix.fork ()
|
||||
if pid == 0 then
|
||||
posix.exec ("/sbin/ldconfig")
|
||||
elseif pid ~= -1 then
|
||||
posix.wait (pid)
|
||||
end
|
||||
end
|
||||
|
||||
%post -n libstdc++ -p /sbin/ldconfig
|
||||
|
||||
@ -1761,7 +1867,6 @@ fi
|
||||
%defattr(-,root,root,-)
|
||||
/%{_lib}/libgcc_s-%{gcc_version}-%{DATE}.so.1
|
||||
/%{_lib}/libgcc_s.so.1
|
||||
%{_prefix}/sbin/libgcc_post_upgrade
|
||||
%doc gcc/COPYING.LIB
|
||||
|
||||
%files c++
|
||||
@ -2342,6 +2447,30 @@ fi
|
||||
%{_prefix}/lib/gcc/%{gcc_target_platform}/%{gcc_version}/plugin
|
||||
|
||||
%changelog
|
||||
* Mon May 30 2011 Jakub Jelinek <jakub@redhat.com> 4.6.0-9
|
||||
- update from the 4.6 branch
|
||||
- PRs c++/44311, c++/44994, c++/45080, c++/45401, c++/45418, c++/45698,
|
||||
c++/46005, c++/46245, c++/46696, c++/47049, c++/47184, c++/47277,
|
||||
c++/48284, c++/48292, c++/48424, c++/48935, c++/49156, c++/49165,
|
||||
c++/49176, c++/49223, fortran/48955, libobjc/48177, libstdc++/49141,
|
||||
target/43700, target/43995, target/44643, target/45263,
|
||||
tree-optimization/44897, tree-optimization/49161,
|
||||
tree-optimization/49217, tree-optimization/49218
|
||||
%if 0%{fedora} >= 16
|
||||
- default to -gdwarf-4 -fno-debug-types-section instead of -gdwarf-3
|
||||
- backport DW_OP_GNU_entry_value support
|
||||
(PRs rtl-optimization/48826, debug/48902, bootstrap/48148,
|
||||
debug/48203, bootstrap/48168, debug/48023, debug/48178,
|
||||
debug/48163, debug/48160, bootstrap/48153, middle-end/48152,
|
||||
bootstrap/48148, debug/45882)
|
||||
- backport DW_OP_GNU_{{const,regval,deref}_type,convert,reinterpret}
|
||||
support (PRs debug/48928, debug/48853)
|
||||
%endif
|
||||
- split off debuginfo for libgcc_s, libstdc++ and libgomp into
|
||||
gcc-base-debuginfo subpackage (#706973)
|
||||
- run ldconfig in libgcc %%postun, drop libcc_post_upgrade,
|
||||
instead write the script in <lua> (#705832)
|
||||
|
||||
* Wed May 25 2011 Jakub Jelinek <jakub@redhat.com> 4.6.0-8
|
||||
- update from the 4.6 branch
|
||||
- PRs bootstrap/49086, c++/47263, c++/47336, c++/47544, c++/48522,
|
||||
|
@ -1,483 +0,0 @@
|
||||
#ifdef __sparc__
|
||||
register void *__thread_self __asm ("g7");
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <syscall.h>
|
||||
|
||||
#if defined __i386__
|
||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
({ \
|
||||
register unsigned int resultvar; \
|
||||
asm volatile ( \
|
||||
"movl %1, %%eax\n\t" \
|
||||
"int $0x80\n\t" \
|
||||
: "=a" (resultvar) \
|
||||
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
|
||||
(int) resultvar; })
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||
((unsigned int) (val) >= 0xfffff001u)
|
||||
# define ASMFMT_0()
|
||||
# define ASMFMT_1(arg1) \
|
||||
, "b" (arg1)
|
||||
# define ASMFMT_2(arg1, arg2) \
|
||||
, "b" (arg1), "c" (arg2)
|
||||
# define ASMFMT_3(arg1, arg2, arg3) \
|
||||
, "b" (arg1), "c" (arg2), "d" (arg3)
|
||||
#elif defined __x86_64__
|
||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
||||
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
||||
({ \
|
||||
unsigned long resultvar; \
|
||||
LOAD_ARGS_##nr (args) \
|
||||
LOAD_REGS_##nr \
|
||||
asm volatile ( \
|
||||
"syscall\n\t" \
|
||||
: "=a" (resultvar) \
|
||||
: "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \
|
||||
(long) resultvar; })
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||
((unsigned long) (val) >= -4095L)
|
||||
# define LOAD_ARGS_0()
|
||||
# define LOAD_REGS_0
|
||||
# define ASM_ARGS_0
|
||||
# define LOAD_ARGS_1(a1) \
|
||||
long int __arg1 = (long) (a1); \
|
||||
LOAD_ARGS_0 ()
|
||||
# define LOAD_REGS_1 \
|
||||
register long int _a1 asm ("rdi") = __arg1; \
|
||||
LOAD_REGS_0
|
||||
# define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1)
|
||||
# define LOAD_ARGS_2(a1, a2) \
|
||||
long int __arg2 = (long) (a2); \
|
||||
LOAD_ARGS_1 (a1)
|
||||
# define LOAD_REGS_2 \
|
||||
register long int _a2 asm ("rsi") = __arg2; \
|
||||
LOAD_REGS_1
|
||||
# define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2)
|
||||
# define LOAD_ARGS_3(a1, a2, a3) \
|
||||
long int __arg3 = (long) (a3); \
|
||||
LOAD_ARGS_2 (a1, a2)
|
||||
# define LOAD_REGS_3 \
|
||||
register long int _a3 asm ("rdx") = __arg3; \
|
||||
LOAD_REGS_2
|
||||
# define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3)
|
||||
#elif defined __powerpc__
|
||||
# define INTERNAL_SYSCALL_DECL(err) long int err
|
||||
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
||||
({ \
|
||||
register long int r0 __asm__ ("r0"); \
|
||||
register long int r3 __asm__ ("r3"); \
|
||||
register long int r4 __asm__ ("r4"); \
|
||||
register long int r5 __asm__ ("r5"); \
|
||||
register long int r6 __asm__ ("r6"); \
|
||||
register long int r7 __asm__ ("r7"); \
|
||||
register long int r8 __asm__ ("r8"); \
|
||||
LOADARGS_##nr(name, args); \
|
||||
__asm__ __volatile__ \
|
||||
("sc\n\t" \
|
||||
"mfcr %0\n\t" \
|
||||
: "=&r" (r0), \
|
||||
"=&r" (r3), "=&r" (r4), "=&r" (r5), \
|
||||
"=&r" (r6), "=&r" (r7), "=&r" (r8) \
|
||||
: ASM_INPUT_##nr \
|
||||
: "r9", "r10", "r11", "r12", \
|
||||
"cr0", "ctr", "memory"); \
|
||||
err = r0; \
|
||||
(int) r3; \
|
||||
})
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||
((void) (val), __builtin_expect ((err) & (1 << 28), 0))
|
||||
# define LOADARGS_0(name, dummy) \
|
||||
r0 = name
|
||||
# define LOADARGS_1(name, __arg1) \
|
||||
long int arg1 = (long int) (__arg1); \
|
||||
LOADARGS_0(name, 0); \
|
||||
r3 = arg1
|
||||
# define LOADARGS_2(name, __arg1, __arg2) \
|
||||
long int arg2 = (long int) (__arg2); \
|
||||
LOADARGS_1(name, __arg1); \
|
||||
r4 = arg2
|
||||
# define LOADARGS_3(name, __arg1, __arg2, __arg3) \
|
||||
long int arg3 = (long int) (__arg3); \
|
||||
LOADARGS_2(name, __arg1, __arg2); \
|
||||
r5 = arg3
|
||||
# define ASM_INPUT_0 "0" (r0)
|
||||
# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
|
||||
# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4)
|
||||
# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5)
|
||||
#elif defined __ia64__
|
||||
# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \
|
||||
LOAD_ARGS_##nr (args) \
|
||||
register long _r8 asm ("r8"); \
|
||||
register long _r10 asm ("r10"); \
|
||||
register long _r15 asm ("r15") = name; \
|
||||
long _retval; \
|
||||
LOAD_REGS_##nr \
|
||||
__asm __volatile ("break 0x100000;;" \
|
||||
: "=r" (_r8), "=r" (_r10), "=r" (_r15) \
|
||||
ASM_OUTARGS_##nr \
|
||||
: "2" (_r15) ASM_ARGS_##nr \
|
||||
: "memory" ASM_CLOBBERS_##nr); \
|
||||
_retval = _r8;
|
||||
# define INTERNAL_SYSCALL_DECL(err) long int err
|
||||
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
|
||||
({ \
|
||||
DO_INLINE_SYSCALL_NCS (name, nr, args) \
|
||||
err = _r10; \
|
||||
_retval; })
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1)
|
||||
# define LOAD_ARGS_0()
|
||||
# define LOAD_REGS_0
|
||||
# define LOAD_ARGS_1(a1) \
|
||||
long _arg1 = (long) (a1); \
|
||||
LOAD_ARGS_0 ()
|
||||
# define LOAD_REGS_1 \
|
||||
register long _out0 asm ("out0") = _arg1; \
|
||||
LOAD_REGS_0
|
||||
# define LOAD_ARGS_2(a1, a2) \
|
||||
long _arg2 = (long) (a2); \
|
||||
LOAD_ARGS_1 (a1)
|
||||
# define LOAD_REGS_2 \
|
||||
register long _out1 asm ("out1") = _arg2; \
|
||||
LOAD_REGS_1
|
||||
# define LOAD_ARGS_3(a1, a2, a3) \
|
||||
long _arg3 = (long) (a3); \
|
||||
LOAD_ARGS_2 (a1, a2)
|
||||
# define LOAD_REGS_3 \
|
||||
register long _out2 asm ("out2") = _arg3; \
|
||||
LOAD_REGS_2
|
||||
# define ASM_OUTARGS_0
|
||||
# define ASM_OUTARGS_1 ASM_OUTARGS_0, "=r" (_out0)
|
||||
# define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1)
|
||||
# define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2)
|
||||
# define ASM_ARGS_0
|
||||
# define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0)
|
||||
# define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1)
|
||||
# define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2)
|
||||
# define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0"
|
||||
# define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1"
|
||||
# define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2"
|
||||
# define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3"
|
||||
# define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4"
|
||||
# define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5"
|
||||
# define ASM_CLOBBERS_6_COMMON , "out6", "out7", \
|
||||
/* Non-stacked integer registers, minus r8, r10, r15. */ \
|
||||
"r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \
|
||||
"r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \
|
||||
"r28", "r29", "r30", "r31", \
|
||||
/* Predicate registers. */ \
|
||||
"p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \
|
||||
/* Non-rotating fp registers. */ \
|
||||
"f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
|
||||
/* Branch registers. */ \
|
||||
"b6"
|
||||
# define ASM_CLOBBERS_6 ASM_CLOBBERS_6_COMMON , "b7"
|
||||
#elif defined __s390__
|
||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
||||
# define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \
|
||||
({ \
|
||||
DECLARGS_##nr(args) \
|
||||
register long _ret asm("2"); \
|
||||
asm volatile ( \
|
||||
"svc %b1\n\t" \
|
||||
: "=d" (_ret) \
|
||||
: "i" (__NR_##name) ASMFMT_##nr \
|
||||
: "memory" ); \
|
||||
_ret; })
|
||||
# define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \
|
||||
({ \
|
||||
DECLARGS_##nr(args) \
|
||||
register unsigned long _nr asm("1") = (unsigned long)(__NR_##name); \
|
||||
register long _ret asm("2"); \
|
||||
asm volatile ( \
|
||||
"svc 0\n\t" \
|
||||
: "=d" (_ret) \
|
||||
: "d" (_nr) ASMFMT_##nr \
|
||||
: "memory" ); \
|
||||
_ret; })
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
(((__NR_##name) < 256) ? \
|
||||
INTERNAL_SYSCALL_DIRECT(name, err, nr, args) : \
|
||||
INTERNAL_SYSCALL_SVC0(name, err,nr, args))
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||
((unsigned long) (val) >= -4095UL)
|
||||
# define DECLARGS_0()
|
||||
# define DECLARGS_1(arg1) \
|
||||
register unsigned long gpr2 asm ("2") = (unsigned long)(arg1);
|
||||
# define DECLARGS_2(arg1, arg2) \
|
||||
DECLARGS_1(arg1) \
|
||||
register unsigned long gpr3 asm ("3") = (unsigned long)(arg2);
|
||||
# define DECLARGS_3(arg1, arg2, arg3) \
|
||||
DECLARGS_2(arg1, arg2) \
|
||||
register unsigned long gpr4 asm ("4") = (unsigned long)(arg3);
|
||||
# define ASMFMT_0
|
||||
# define ASMFMT_1 , "0" (gpr2)
|
||||
# define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
|
||||
# define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
|
||||
#elif defined __sparc__
|
||||
# ifndef __arch64__
|
||||
# define __INTERNAL_SYSCALL_STRING \
|
||||
"ta 0x10;" \
|
||||
"bcs,a 1f;" \
|
||||
" sub %%g0, %%o0, %%o0;" \
|
||||
"1:"
|
||||
# define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \
|
||||
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
|
||||
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
|
||||
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
|
||||
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
|
||||
"cc", "memory"
|
||||
# else
|
||||
# define __INTERNAL_SYSCALL_STRING \
|
||||
"ta 0x6d;" \
|
||||
"bcs,a,pt %%xcc, 1f;" \
|
||||
" sub %%g0, %%o0, %%o0;" \
|
||||
"1:"
|
||||
# define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \
|
||||
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
|
||||
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
|
||||
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
|
||||
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
|
||||
"f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \
|
||||
"f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \
|
||||
"cc", "memory"
|
||||
# endif
|
||||
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
inline_syscall##nr(__INTERNAL_SYSCALL_STRING, __NR_##name, args)
|
||||
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||
((unsigned long) (val) >= -515L)
|
||||
# define inline_syscall0(string,name,dummy...) \
|
||||
({ \
|
||||
register long __o0 __asm__ ("o0"); \
|
||||
register long __g1 __asm__ ("g1") = name; \
|
||||
__asm __volatile (string : "=r" (__g1), "=r" (__o0) : \
|
||||
"0" (__g1) : \
|
||||
__SYSCALL_CLOBBERS); \
|
||||
__o0; \
|
||||
})
|
||||
# define inline_syscall1(string,name,arg1) \
|
||||
({ \
|
||||
register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
register long __g1 __asm__ ("g1") = name; \
|
||||
__asm __volatile (string : "=r" (__g1), "=r" (__o0) : \
|
||||
"0" (__g1), "1" (__o0) : \
|
||||
__SYSCALL_CLOBBERS); \
|
||||
__o0; \
|
||||
})
|
||||
# define inline_syscall2(string,name,arg1,arg2) \
|
||||
({ \
|
||||
register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
register long __g1 __asm__ ("g1") = name; \
|
||||
__asm __volatile (string : "=r" (__g1), "=r" (__o0) : \
|
||||
"0" (__g1), "1" (__o0), "r" (__o1) : \
|
||||
__SYSCALL_CLOBBERS); \
|
||||
__o0; \
|
||||
})
|
||||
# define inline_syscall3(string,name,arg1,arg2,arg3) \
|
||||
({ \
|
||||
register long __o0 __asm__ ("o0") = (long)(arg1); \
|
||||
register long __o1 __asm__ ("o1") = (long)(arg2); \
|
||||
register long __o2 __asm__ ("o2") = (long)(arg3); \
|
||||
register long __g1 __asm__ ("g1") = name; \
|
||||
__asm __volatile (string : "=r" (__g1), "=r" (__o0) : \
|
||||
"0" (__g1), "1" (__o0), "r" (__o1), \
|
||||
"r" (__o2) : \
|
||||
__SYSCALL_CLOBBERS); \
|
||||
__o0; \
|
||||
})
|
||||
#elif defined __alpha__
|
||||
# define INTERNAL_SYSCALL(name, err_out, nr, args...) \
|
||||
INTERNAL_SYSCALL1(name, err_out, nr, args)
|
||||
# define INTERNAL_SYSCALL1(name, err_out, nr, args...) \
|
||||
INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args)
|
||||
# define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \
|
||||
({ \
|
||||
long _sc_ret, _sc_err; \
|
||||
inline_syscall##nr(name, args); \
|
||||
err_out = _sc_err; \
|
||||
_sc_ret; \
|
||||
})
|
||||
# define INTERNAL_SYSCALL_DECL(err) long int err
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) err
|
||||
# define inline_syscall_clobbers \
|
||||
"$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
|
||||
"$22", "$23", "$24", "$25", "$27", "$28", "memory"
|
||||
# define inline_syscall_r0_asm
|
||||
# define inline_syscall_r0_out_constraint "=v"
|
||||
# define inline_syscall0(name, args...) \
|
||||
{ \
|
||||
register long _sc_0 inline_syscall_r0_asm; \
|
||||
register long _sc_19 __asm__("$19"); \
|
||||
\
|
||||
_sc_0 = name; \
|
||||
__asm__ __volatile__ \
|
||||
("callsys # %0 %1 <= %2" \
|
||||
: inline_syscall_r0_out_constraint (_sc_0), \
|
||||
"=r"(_sc_19) \
|
||||
: "0"(_sc_0) \
|
||||
: inline_syscall_clobbers, \
|
||||
"$16", "$17", "$18", "$20", "$21"); \
|
||||
_sc_ret = _sc_0, _sc_err = _sc_19; \
|
||||
}
|
||||
# define inline_syscall1(name,arg1) \
|
||||
{ \
|
||||
register long _sc_0 inline_syscall_r0_asm; \
|
||||
register long _sc_16 __asm__("$16"); \
|
||||
register long _sc_19 __asm__("$19"); \
|
||||
\
|
||||
_sc_0 = name; \
|
||||
_sc_16 = (long) (arg1); \
|
||||
__asm__ __volatile__ \
|
||||
("callsys # %0 %1 <= %2 %3" \
|
||||
: inline_syscall_r0_out_constraint (_sc_0), \
|
||||
"=r"(_sc_19), "=r"(_sc_16) \
|
||||
: "0"(_sc_0), "2"(_sc_16) \
|
||||
: inline_syscall_clobbers, \
|
||||
"$17", "$18", "$20", "$21"); \
|
||||
_sc_ret = _sc_0, _sc_err = _sc_19; \
|
||||
}
|
||||
# define inline_syscall2(name,arg1,arg2) \
|
||||
{ \
|
||||
register long _sc_0 inline_syscall_r0_asm; \
|
||||
register long _sc_16 __asm__("$16"); \
|
||||
register long _sc_17 __asm__("$17"); \
|
||||
register long _sc_19 __asm__("$19"); \
|
||||
\
|
||||
_sc_0 = name; \
|
||||
_sc_16 = (long) (arg1); \
|
||||
_sc_17 = (long) (arg2); \
|
||||
__asm__ __volatile__ \
|
||||
("callsys # %0 %1 <= %2 %3 %4" \
|
||||
: inline_syscall_r0_out_constraint (_sc_0), \
|
||||
"=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17) \
|
||||
: "0"(_sc_0), "2"(_sc_16), "3"(_sc_17) \
|
||||
: inline_syscall_clobbers, \
|
||||
"$18", "$20", "$21"); \
|
||||
_sc_ret = _sc_0, _sc_err = _sc_19; \
|
||||
}
|
||||
# define inline_syscall3(name,arg1,arg2,arg3) \
|
||||
{ \
|
||||
register long _sc_0 inline_syscall_r0_asm; \
|
||||
register long _sc_16 __asm__("$16"); \
|
||||
register long _sc_17 __asm__("$17"); \
|
||||
register long _sc_18 __asm__("$18"); \
|
||||
register long _sc_19 __asm__("$19"); \
|
||||
\
|
||||
_sc_0 = name; \
|
||||
_sc_16 = (long) (arg1); \
|
||||
_sc_17 = (long) (arg2); \
|
||||
_sc_18 = (long) (arg3); \
|
||||
__asm__ __volatile__ \
|
||||
("callsys # %0 %1 <= %2 %3 %4 %5" \
|
||||
: inline_syscall_r0_out_constraint (_sc_0), \
|
||||
"=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \
|
||||
"=r"(_sc_18) \
|
||||
: "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \
|
||||
"4"(_sc_18) \
|
||||
: inline_syscall_clobbers, "$20", "$21"); \
|
||||
_sc_ret = _sc_0, _sc_err = _sc_19; \
|
||||
}
|
||||
#elif defined __arm__ && defined __ARM_EABI__
|
||||
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
({ \
|
||||
register int _r0 __asm__("r0"); \
|
||||
register int _nr __asm__("r7"); \
|
||||
LOAD_ARGS_##nr(args) \
|
||||
_nr = __NR_##name; \
|
||||
asm volatile ("swi\t0\t@ syscall " #name "\n\t" \
|
||||
: "=r" (_r0) \
|
||||
: "r" (_nr) ASM_ARGS_##nr \
|
||||
: "memory"); \
|
||||
_r0; })
|
||||
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
|
||||
((unsigned int) (val) >= 0xfffff001u)
|
||||
# define ASM_ARGS_0
|
||||
# define ASM_ARGS_1 , "r" (_r0)
|
||||
# define ASM_ARGS_2 , "r" (_r0), "r" (_r1)
|
||||
# define ASM_ARGS_3 , "r" (_r0), "r" (_r1), "r" (_r2)
|
||||
# define LOAD_ARGS_0()
|
||||
# define LOAD_ARGS_1(r0) \
|
||||
_r0 = (int)r0;
|
||||
# define LOAD_ARGS_2(r0, r1) \
|
||||
_r0 = (int)r0; \
|
||||
register int _r1 __asm__("r1") = (int)r1;
|
||||
# define LOAD_ARGS_3(r0, r1, r2) \
|
||||
_r0 = (int)r0; \
|
||||
register int _r1 __asm__("r1") = (int)r1; \
|
||||
register int _r2 __asm__("r2") = (int)r2;
|
||||
#endif
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
const char *arg[] = { "/sbin/ldconfig", 0 };
|
||||
long ret;
|
||||
INTERNAL_SYSCALL_DECL (err);
|
||||
ret = INTERNAL_SYSCALL (access, err, 2, arg[0], X_OK);
|
||||
if (INTERNAL_SYSCALL_ERROR_P (ret, err))
|
||||
INTERNAL_SYSCALL (exit, err, 1, 0);
|
||||
INTERNAL_SYSCALL (execve, err, 3, arg[0], arg, &argv[argc + 1]);
|
||||
INTERNAL_SYSCALL (exit, err, 1, 110);
|
||||
return 110;
|
||||
}
|
||||
|
||||
int __libc_multiple_threads __attribute__((nocommon));
|
||||
int __libc_enable_asynccancel (void) { return 0; }
|
||||
void __libc_disable_asynccancel (int x) { }
|
||||
void __libc_csu_init (void) { }
|
||||
void __libc_csu_fini (void) { }
|
||||
pid_t __fork (void) { return -1; }
|
||||
char thr_buf[65536];
|
||||
|
||||
#ifndef __powerpc__
|
||||
int __libc_start_main (int (*main) (int argc, char **argv),
|
||||
int argc, char **argv,
|
||||
void (*init) (void), void (*fini) (void),
|
||||
void (*rtld_fini) (void), void * stack_end)
|
||||
#else
|
||||
struct startup_info
|
||||
{
|
||||
void *sda_base;
|
||||
int (*main) (int, char **, char **, void *);
|
||||
int (*init) (int, char **, char **, void *);
|
||||
void (*fini) (void);
|
||||
};
|
||||
|
||||
int __libc_start_main (int argc, char **argv, char **ev,
|
||||
void *auxvec, void (*rtld_fini) (void),
|
||||
struct startup_info *stinfo,
|
||||
char **stack_on_entry)
|
||||
#endif
|
||||
{
|
||||
#if defined __ia64__ || defined __powerpc64__
|
||||
register void *r13 __asm ("r13") = thr_buf + 32768;
|
||||
__asm ("" : : "r" (r13));
|
||||
#elif defined __sparc__
|
||||
register void *g6 __asm ("g6") = thr_buf + 32768;
|
||||
__thread_self = thr_buf + 32768;
|
||||
__asm ("" : : "r" (g6), "r" (__thread_self));
|
||||
#elif defined __s390__ && !defined __s390x__
|
||||
__asm ("sar %%a0,%0" : : "d" (thr_buf + 32768));
|
||||
#elif defined __s390x__
|
||||
__asm ("sar %%a1,%0; srlg 0,%0,32; sar %%a0,0" : : "d" (thr_buf + 32768) : "0");
|
||||
#elif defined __powerpc__ && !defined __powerpc64__
|
||||
register void *r2 __asm ("r2") = thr_buf + 32768;
|
||||
__asm ("" : : "r" (r2));
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
argc = (long)*stack_on_entry;
|
||||
argv = stack_on_entry + 1;
|
||||
#endif
|
||||
main (argc, argv);
|
||||
return 110;
|
||||
}
|
Loading…
Reference in New Issue
Block a user