Embedded targets should not have to provide sysconf(), getpagesize(), or mprotect(). This appears to be responsible for 40 test failures. Targetting sparc-elf some tests fail to link like this: spawn /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/xgcc -B/usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/ /usr3/ftp_archive/gnu/gcc/ss/b3/gcc-30-cvs/gcc/testsuite/gcc.c-torture/execute/20000822-1.c testglue.o -w -O0 -I/usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/sparc-elf//newlib/targ-include -I/usr3/ftp_archive/gnu/gcc/ss/b3/gcc-30-cvs/newlib/libc/include -nostdlib -nostartfiles -B/usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/sparc-elf//libgloss/sparc/ -L/usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/sparc-elf//libgloss/sparc -L/usr3/ftp_archive/gnu/gcc/ss/b3/gcc-30-cvs/libgloss/sparc -B/usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/sparc-elf//newlib/ -L/usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/sparc-elf//newlib -Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort -lm -Telfsim.ld -o /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/testsuite/20000822-1.x0 ^M /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/libgcc.a(_trampoline.o): In function `check_enabling':^M /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/../../gcc-30-cvs/gcc/libgcc2.c(.text+0x4): undefined reference to `sysconf'^M /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/libgcc.a(_trampoline.o): In function `__enable_execute_stack':^M /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/../../gcc-30-cvs/gcc/libgcc2.c(.text+0x40): undefined reference to `getpagesize'^M /usr3/ftp_archive/gnu/gcc/ss/b3/b-sparc-elf/gcc/../../gcc-30-cvs/gcc/libgcc2.c(.text+0x64): undefined reference to `mprotect'^M collect2: ld returned 1 exit status^M compiler exited with status 1 Release: gcc-30-cvs checked out on 20010802 Environment: GNU/Linux RedHat 6.2 How-To-Repeat: try to compile at least the test indicated above.
Fix: I don't know how the embedded sparc-elf ends up using the trampoline code in sol2.h which is where these references appear to come from.
State-Changed-From-To: open->analyzed State-Changed-Why: It gets it from the trampoline stack execute protection code, ie. the macro sol2.h:TRANSFER_FROM_TRAMPOLINE I've always been mystified why the embedded targets use the Solaris headers. They either have to start using their own embedded headers or somehow conditionalize TRANSFER_FROM_TRAMPOLINE with a suitable ifdef that will match on the embedded Sparc targets.
From: Joel Sherrill <joel.sherrill@OARcorp.com> To: davem@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Cc: Subject: Re: bootstrap/3922: sparc-elf embedded target makes UNIX calls Date: Tue, 25 Jun 2002 14:52:38 -0500 davem@gcc.gnu.org wrote: > > Synopsis: sparc-elf embedded target makes UNIX calls > > State-Changed-From-To: open->analyzed > State-Changed-By: davem > State-Changed-When: Tue Jun 25 12:47:03 2002 > State-Changed-Why: > It gets it from the trampoline stack execute protection > code, ie. the macro sol2.h:TRANSFER_FROM_TRAMPOLINE > > I've always been mystified why the embedded targets > use the Solaris headers. They either have to start > using their own embedded headers or somehow > conditionalize TRANSFER_FROM_TRAMPOLINE with a suitable > ifdef that will match on the embedded Sparc targets. > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3922 FWIW newlib prototypes the missing routines and RTEMS includes stubs for all the UNIX routines that are sufficient to make the linkage happy. If anyone cares, I can provide them and maybe they can go in newlib. But someone more knowledgeable about sparc-elf (not sparc-rtems) would have to speak. -- Joel Sherrill, Ph.D. Director of Research & Development joel@OARcorp.com On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available (256) 722-9985
State-Changed-From-To: analyzed->feedback State-Changed-Why: Still broken on 3.2.2 20030130 (prerelease)
State-Changed-From-To: feedback->analyzed State-Changed-Why: Shouldn't be in feedback state
Joel, you last tested this with gcc 3.2. Can you confirm whether this problem still occurs with gcc 3.3 branch and or mainline? Thanks, Dara
Just a reminder that this bug is awaiting feedback. Does this problem still occur with gcc 3.3? Thanks.
Fixed in 3.3 by: 2002-06-20 Rainer Orth * config/sol2.h: New file. * config.gcc (i?86-*-solaris2*): Include it before i386/sol2.h. (sparc64-wrs-vxworks*): Include it before sparc/sol2.h. (sparc-*-chorusos*): Likewise. (sparc-*-elf*): Likewise. (sparc-*-rtems*, sparc-*-rtemself*): Likewise. (sparc64-*-solaris2*, sparcv9-*-solaris2*): Likewise. (sparc-hal-solaris2*): Likewise. (sparc-*-solaris2*): Likewise. (sparclite-*-elf*): Likewise. (sparc86x-*-elf*): Likewise. (sparc64-*-elf*): Likewise. * config/i386/sol2.h (PREFERRED_DEBUGGING_TYPE): Moved to config/sol2.h. (ASM_SPEC): Override config/sol2.h version for now. Removed obsolete GAS_REJECTS_MINUS_S variant. (WINT_TYPE, WINT_TYPE_SIZE): Moved to config/sol2.h. (HANDLE_PRAGMA_REDEFINE_EXTNAME): Likewise. (TARGET_OS_CPP_BUILTINS): Likewise. Assert system=unix. (CPP_SPEC): Simplified using new CPP_SUBTARGET_SPEC. (LIB_SPEC, ENDFILE_SPEC, STARTFILE_SPEC, LINK_SPEC): Moved to config/sol2.h. (SWITCH_TAKES_ARG, STDC_0_IN_SYSTEM_HEADERS): Likewise. (ASM_CPU_SPEC): Define. (SUBTARGET_EXTRA_SPECS): Define. * config/sparc/sol2-bi.h (LONG_DOUBLE_TYPE_SIZE): Removed, already in config/sparc/sol2.h. (ASM_SPEC): Moved to config/sol2.h. (CPP_CPU_SPEC): Simplified. (STARTFILE_SPEC32): Likewise, renamed to STARTFILE_ARCH32_SPEC for consistency. (STARTFILE_SPEC64): Renamed to STARTFILE_ARCH64_SPEC. (STARTFILE_ARCH_SPEC): Use new names STARTFILE_ARCH32_SPEC, STARTFILE_ARCH64_SPEC. (STARTFILE_SPEC): Moved to config/sol2.h (SUBTARGET_EXTRA_SPECS): Add startfile_arch. (LINK_ARCH32_SPEC): Moved to config/sol2.h. (LINK_ARCH64_SPEC): Simplified. (LINK_ARCH_SPEC): Redefined config/sol2.h version for 64-bit support. (LINK_SPEC): Moved to config/sol2.h * config/sparc/sol2.h (WCHAR_TYPE, WCHAR_TYPE_SIZE): Moved to config/sol2.h. Use BITS_PER_WORD for size. (WINT_TYPE, WINT_TYPE_SIZE): Likewise. (HANDLE_PRAGMA_REDEFINE_EXTNAME): Likewise. (CPP_PREDEFINES): Removed OS-specific part handled by TARGET_OS_CPP_BUILTINS. (CPP_SUBTARGET_SPEC): Moved to config/sol2.h. (CPLUSPLUS_CPP_SPEC): Removed, handled by TARGET_OS_CPP_BUILTINS. (ASM_SPEC): Moved to config/sol2.h. (PREFERRED_DEBUGGING_TYPE): Likewise. (STARTFILE_SPEC, LIB_SPEC, LINK_SPEC): Likewise. (SWITCH_TAKES_ARG, STDC_0_IN_SYSTEM_HEADERS): Likewise. (TARGET_DEFAULT): Reordered to match config/sparc/sol2-bi.h version. (TRANSFER_FROM_TRAMPOLINE): Moved to config/sol2.h * config.gcc (i?86-*-solaris2*): Removed obsolete gas support. * config/i386/sol2gas.h: Removed.