Esempio n. 1
0
// { dg-do compile }

namespace std __attribute__ ((__visibility__ ("default")))
{
  typedef __SIZE_TYPE__ size_t;
  template<typename _Alloc>     class allocator;
  template<class _CharT>     struct char_traits;
  template<typename _CharT, typename _Traits = char_traits<_CharT>,
      typename _Alloc = allocator<_CharT> >
	  class basic_string;
  typedef basic_string<char> string;
  template<class _T1, class _T2>     struct pair     { };
  template<typename _Tp>     class allocator    { };
  template<typename _Arg1, typename _Arg2, typename _Result>
      struct binary_function     {
	  typedef _Arg1 first_argument_type;
	  typedef _Arg2 second_argument_type;
	  typedef _Result result_type;
      };
  template<typename _CharT, typename _Traits, typename _Alloc>
  class basic_string {
  public:
      basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());
  };
  class type_info   {
  public:
      const char* name() const;
  };
  extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
  void * memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len) throw ()
  {
* Executes a loop: Within the loop, the function first attempts to allocate
  the requested storage. Whether the attempt involves a call to the Standard C
  library function malloc is unspecified.

* Returns a pointer to the allocated storage if the attempt is successful.
  Otherwise, if the current new_handler (18.6.2.5) is a null pointer value,
  throws bad_alloc.

* Otherwise, the function calls the current new_handler function (18.6.2.3).
  If the called function returns, the loop repeats.

* The loop terminates when an attempt to allocate the requested storage is
  successful or when a called new_handler function does not return.
*/
__attribute__((__weak__, __visibility__("default")))
void *
operator new(std::size_t size)
#if !__has_feature(cxx_noexcept)
    throw(std::bad_alloc)
#endif
{
    if (size == 0)
        size = 1;
    void* p;
    while ((p = std::malloc(size)) == 0)
    {
        std::new_handler nh = std::get_new_handler();
        if (nh)
            nh();
        else
Esempio n. 3
0
#include "pthread_impl.h"
#include <stdint.h>

__attribute__((__visibility__("hidden")))
void *__aeabi_read_tp_c(void)
{
	return (void *)((uintptr_t)__pthread_self()-8+sizeof(struct pthread));
}
Esempio n. 4
0
  __attribute__ ((unused, section(JCR_SECTION_NAME), aligned(sizeof(void*))))
  = { };
#endif /* JCR_SECTION_NAME */

#ifdef INIT_SECTION_ASM_OP

#ifdef OBJECT_FORMAT_ELF

/* Declare the __dso_handle variable.  It should have a unique value
   in every shared-object; in a main program its value is zero.  The
   object should in any case be protected.  This means the instance
   in one DSO or the main program is not used in another object.  The
   dynamic linker takes care of this.  */

#ifdef HAVE_GAS_HIDDEN
extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
#endif
#ifdef CRTSTUFFS_O
void *__dso_handle = &__dso_handle;
#else
void *__dso_handle = 0;
#endif

/* The __cxa_finalize function may not be available so we use only a
   weak declaration.  */
extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;

/* Run all the global destructors on exit from the program.  */
 
/* Some systems place the number of pointers in the first word of the
   table.  On SVR4 however, that word is -1.  In all cases, the table is
Esempio n. 5
0
#include <stdint.h>
//#include <elf.h>
//#include "pthread_impl.h"
//#include "libc.h"

#define HWCAP_TLS (1 << 15)

extern const unsigned char __attribute__((__visibility__("hidden")))
	__a_barrier_dummy[], __a_barrier_oldkuser[],
	__a_barrier_v6[], __a_barrier_v7[],
	__a_cas_dummy[], __a_cas_v6[], __a_cas_v7[],
	__a_gettp_dummy[];

#define __a_barrier_kuser 0xffff0fa0
#define __a_cas_kuser 0xffff0fc0
#define __a_gettp_kuser 0xffff0fe0

extern uintptr_t __attribute__((__visibility__("hidden")))
	__a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr;

#define SET(op,ver) (__a_##op##_ptr = \
	(uintptr_t)__a_##op##_##ver - (uintptr_t)__a_##op##_dummy)

extern "C"
{
/*
    int __set_thread_area(void *p)
    {
    #if !__ARM_ARCH_7A__ && !__ARM_ARCH_7R__ && __ARM_ARCH < 7
        if (__hwcap & HWCAP_TLS) {
            size_t *aux;
Esempio n. 6
0
// Complain when a class is specified with greater visibility than one of
// its members' types or bases.

// { dg-require-visibility "" }

namespace N __attribute ((__visibility__ ("hidden")))
{
  struct A { };
}

struct B
{				// { dg-warning "visibility" }
  N::A a;
};

struct C: public N::A { };	// { dg-warning "visibility" }
Esempio n. 7
0
#include <dlfcn.h>

__attribute__((__visibility__("hidden"))) int __dl_invalid_handle(void*);

int dlclose(void* p) {
  return __dl_invalid_handle(p);
}
Esempio n. 8
0
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

static int _loaded = 0;

void __attribute__((__visibility__("default"))) loaded()
{
    _loaded = 1;
    printf("Yeah!\n");
}

int main(int argc, char* argv[])
{
    void* handle;

    if (argc < 2) {

        printf("Need a library .so to load!\n");
        return EXIT_FAILURE;
    }

    handle = dlopen(argv[1], RTLD_LAZY);
    if (handle) {

        printf("Library %s loaded\n", argv[1]);

        if (_loaded) {
            printf("Library %s constructed\n", argv[1]);
        }
Esempio n. 9
0
  template<typename _Tp>
  struct remove_reference {
    typedef _Tp type;
  };
  template<typename _Tp>
  constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept {
    return static_cast<_Tp&&>(__t);
  }
}
typedef __SIZE_TYPE__ size_t;
extern "C++" {
  inline void* operator new(std::size_t, void* __p) noexcept {
    return __p;
  }
}
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
  template<typename _Tp>
    class new_allocator {
  public:
    typedef size_t size_type;
    typedef _Tp* pointer;
  };
}
namespace std {
  template<typename _Tp>
  using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
  template<typename _Tp>
  class allocator
    : public __allocator_base<_Tp> {
  public:
    typedef size_t size_type;
Esempio n. 10
0
#include "pthread_impl.h"

void __unmapself_sh_mmu(void *, size_t);
void __unmapself_sh_nommu(void *, size_t);

#if !defined(__SH3__) && !defined(__SH4__)
#define __unmapself __unmapself_sh_nommu
#include "dynlink.h"
#undef CRTJMP
#define CRTJMP(pc,sp) __asm__ __volatile__( \
	"mov.l @%0+,r0 ; mov.l @%0,r12 ; jmp @r0 ; mov %1,r15" \
	: : "r"(pc), "r"(sp) : "r0", "memory" )
#include "../../../src/thread/__unmapself.c"
#undef __unmapself
extern __attribute__((__visibility__("hidden"))) unsigned __sh_nommu;
#else
#define __sh_nommu 0
#endif

void __unmapself(void *base, size_t size)
{
	if (__sh_nommu) __unmapself_sh_nommu(base, size);
	else __unmapself_sh_mmu(base, size);
}
Esempio n. 11
0
/* Disclaimer:  I have never seen any AT&T source code for SVr4, nor have
   I ever taken any courses on internals.  This program was developed using
   information available through the book "UNIX SYSTEM V RELEASE 4,
   Programmers guide: Ansi C and Programming Support Tools", which did
   a more than adequate job of explaining everything required to get this
   working. */

/*
 * _dl_ubicom32_resolve_pending is actually a function, it is used to
 * deal with multiple threads resolving the same function at the same
 * time.  While a resolution is being done the _dl_linux_resolve ptr in
 * the plt is replaced with _dl_ubicom32_resolve_pending The chances that
 * it ever gets called probably 1 in a million.
 */
extern int _dl_ubicom32_resolve_pending __attribute__((__visibility__("hidden")));

 __attribute__((__visibility__("hidden"))) struct funcdesc_value volatile *
_dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry)
{
	int reloc_type;
	ELF_RELOC *this_reloc;
	char *strtab;
	ElfW(Sym) *symtab;
	int symtab_index;
	char *rel_addr;
	struct elf_resolve *new_tpnt;
	char *new_addr;
	struct funcdesc_value funcval;
	struct funcdesc_value volatile *got_entry;
	char *symname;
Esempio n. 12
0
// RUN: clang-cc -fsyntax-only -verify %s
struct X { };
struct Y { };

bool f0(X) {
    return true;
} // expected-note{{definition}}
bool f1(X) {
    return true;
}

__attribute__ ((__visibility__("hidden"))) bool f0(X); // expected-warning{{attribute}}
__attribute__ ((__visibility__("hidden"))) bool f1(Y);
Esempio n. 13
0
File: guid.c Progetto: btian1/efivar
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <dlfcn.h>
#include <errno.h>
#include <stdio.h>

#include "efivar.h"
#include "guid.h"

#define GUID_LENGTH_WITH_NUL 37

int
__attribute__((__nonnull__ (1, 2)))
__attribute__((__visibility__ ("default")))
efi_str_to_guid(const char *s, efi_guid_t *guid)
{
	return text_to_guid(s, guid);
}

int
__attribute__((__nonnull__ (1)))
__attribute__((__visibility__ ("default")))
efi_guid_to_str(const efi_guid_t *guid, char **sp)
{
	char *ret = NULL;
	int rc = -1;

	if (!sp) {
		return snprintf(NULL, 0, GUID_FORMAT,
Esempio n. 14
0
extern int bar(void) __attribute__((__visibility__("hidden"), __const__));
extern void baz(int);

void foo(char c)
{
  int i;

  if (bar())
    i = c;
  else
    i = c;

  baz(i);
}