本文整理匯總了C++中GLRO函數的典型用法代碼示例。如果您正苦於以下問題:C++ GLRO函數的具體用法?C++ GLRO怎麽用?C++ GLRO使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GLRO函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: __libc_ifunc_impl_list
size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
size_t max)
{
size_t i = 0;
bool use_neon = true;
#ifdef __ARM_NEON__
# define __memcpy_neon memcpy
#else
use_neon = (GLRO(dl_hwcap) & HWCAP_ARM_NEON) != 0;
#endif
#ifndef __ARM_NEON__
bool use_vfp = true;
# ifdef __SOFTFP__
use_vfp = (GLRO(dl_hwcap) & HWCAP_ARM_VFP) != 0;
# endif
#endif
IFUNC_IMPL (i, name, memcpy,
IFUNC_IMPL_ADD (array, i, memcpy, use_neon, __memcpy_neon)
#ifndef __ARM_NEON__
IFUNC_IMPL_ADD (array, i, memcpy, use_vfp, __memcpy_vfp)
#endif
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_arm));
return i;
}
示例2: _dl_make_stack_executable
int
internal_function
_dl_make_stack_executable (void **stack_endp)
{
/* This gives us the highest/lowest page that needs to be changed. */
uintptr_t page = ((uintptr_t) *stack_endp
& -(intptr_t) GLRO(dl_pagesize));
int result = 0;
/* Challenge the caller. */
if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
allow_ldso|allow_libpthread) != 0, 0)
|| __builtin_expect (*stack_endp != __libc_stack_end, 0))
return EPERM;
if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize),
__stack_prot) == 0, 1))
goto return_success;
result = errno;
goto out;
return_success:
/* Clear the address. */
*stack_endp = NULL;
/* Remember that we changed the permission. */
GL(dl_stack_flags) |= PF_X;
out:
#ifdef check_consistency
check_consistency ();
#endif
return result;
}
示例3: frob_brk
static inline void
frob_brk (void)
{
__brk (0); /* Initialize the break. */
#if ! __ASSUME_BRK_PAGE_ROUNDED
/* If the dynamic linker was executed as a program, then the break may
start immediately after our data segment. However, dl-minimal.c has
already stolen the remainder of the page for internal allocations.
If we don't adjust the break location recorded by the kernel, the
normal program startup will inquire, find the value at our &_end,
and start allocating its own data there, clobbering dynamic linker
data structures allocated there during startup.
Later Linux kernels have changed this behavior so that the initial
break value is rounded up to the page boundary before we start. */
extern char *__curbrk attribute_hidden;
extern char _end[] attribute_hidden;
char *const endpage = (void *) 0 + (((__curbrk - (char *) 0)
+ GLRO(dl_pagesize) - 1)
& -GLRO(dl_pagesize));
if (__builtin_expect (__curbrk >= _end && __curbrk < endpage, 0))
__brk (endpage);
#endif
}
示例4: _dl_unprotect_relro
static void
_dl_unprotect_relro (struct link_map *l)
{
ElfW(Addr) start = ((l->l_addr + l->l_relro_addr)
& ~(GLRO(dl_pagesize) - 1));
ElfW(Addr) end = ((l->l_addr + l->l_relro_addr + l->l_relro_size)
& ~(GLRO(dl_pagesize) - 1));
if (start != end)
__mprotect ((void *) start, end - start, PROT_READ | PROT_WRITE);
}
示例5: _dl_var_init
void
_dl_var_init (void *array[])
{
/* It has to match "variables" below. */
enum
{
DL_PAGESIZE = 0,
DL_CLKTCK
};
GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]);
GLRO(dl_clktck) = *((int *) array[DL_CLKTCK]);
}
示例6: __assert_fail_base
void
__assert_fail_base (const char *fmt, const char *assertion, const char *file,
unsigned int line, const char *function)
{
char *str;
#ifdef FATAL_PREPARE
FATAL_PREPARE;
#endif
int total;
if (__asprintf (&str, fmt,
__progname, __progname[0] ? ": " : "",
file, line,
function ? function : "", function ? ": " : "",
assertion, &total) >= 0)
{
/* Print the message. */
(void) __fxprintf (NULL, "%s", str);
(void) fflush (stderr);
total = (total + 1 + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
struct abort_msg_s *buf = __mmap (NULL, total, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
if (__builtin_expect (buf != MAP_FAILED, 1))
{
buf->size = total;
strcpy (buf->msg, str);
/* We have to free the old buffer since the application might
catch the SIGABRT signal. */
struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg, buf);
if (old != NULL)
__munmap (old, old->size);
}
free (str);
}
else
{
/* At least print a minimal message. */
static const char errstr[] = "Unexpected error.\n";
__libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
}
abort ();
}
示例7: grow_heap
static int
grow_heap (heap_info *h, long diff)
{
size_t pagesize = GLRO (dl_pagesize);
long new_size;
diff = ALIGN_UP (diff, pagesize);
new_size = (long) h->size + diff;
if ((unsigned long) new_size > (unsigned long) HEAP_MAX_SIZE)
return -1;
if ((unsigned long) new_size > h->mprotect_size)
{
if (__mprotect ((char *) h + h->mprotect_size,
(unsigned long) new_size - h->mprotect_size,
PROT_READ | PROT_WRITE) != 0)
return -2;
h->mprotect_size = new_size;
}
h->size = new_size;
LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
示例8: __fesetenv
int
__fesetenv (const fenv_t *envp)
{
if (GLRO (dl_hwcap) & HWCAP_VFP)
{
unsigned int temp;
_FPU_GETCW (temp);
temp &= _FPU_RESERVED;
if (envp == FE_DFL_ENV)
temp |= _FPU_DEFAULT;
else if (envp == FE_NOMASK_ENV)
temp |= _FPU_IEEE;
else
temp |= envp->__cw & ~_FPU_RESERVED;
_FPU_SETCW (temp);
/* Success. */
return 0;
}
/* Unsupported, so fail. */
return 1;
}
示例9: fesetround
int
fesetround (int round)
{
if (GLRO (dl_hwcap) & HWCAP_ARM_VFP)
{
fpu_control_t temp;
switch (round)
{
case FE_TONEAREST:
case FE_UPWARD:
case FE_DOWNWARD:
case FE_TOWARDZERO:
_FPU_GETCW (temp);
temp = (temp & ~FE_TOWARDZERO) | round;
_FPU_SETCW (temp);
return 0;
default:
return 1;
}
}
else if (round == FE_TONEAREST)
/* This is the only supported rounding mode for soft-fp. */
return 0;
/* Unsupported, so fail. */
return 1;
}
示例10: feholdexcept
int
feholdexcept (fenv_t *envp)
{
if (GLRO (dl_hwcap) & HWCAP_VFP)
{
unsigned long int temp;
/* Store the environment. */
_FPU_GETCW(temp);
envp->__cw = temp;
/* Now set all exceptions to non-stop. */
temp &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
/* And clear all exception flags. */
temp &= ~FE_ALL_EXCEPT;
_FPU_SETCW(temp);
return 0;
}
/* Unsupported, so fail. */
return 1;
}
示例11: grow_heap
static int
grow_heap (heap_info *h, long diff)
{
size_t page_mask = GLRO (dl_pagesize) - 1;
long new_size;
diff = (diff + page_mask) & ~page_mask;
new_size = (long) h->size + diff;
if ((unsigned long) new_size > (unsigned long) HEAP_MAX_SIZE)
return -1;
if ((unsigned long) new_size > h->mprotect_size)
{
if (mprotect ((char *) h + h->mprotect_size,
(unsigned long) new_size - h->mprotect_size,
PROT_READ | PROT_WRITE) != 0)
return -2;
h->mprotect_size = new_size;
}
h->size = new_size;
/* LIBC_PROBE (memory_heap_more, 2, h, h->size); */
return 0;
}
示例12: _dl_get_origin
const char *
_dl_get_origin (void)
{
char linkval[PATH_MAX];
char *result;
int len;
INTERNAL_SYSCALL_DECL (err);
len = INTERNAL_SYSCALL (readlinkat, err, 4, AT_FDCWD, "/proc/self/exe",
linkval, sizeof (linkval));
if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[')
{
/* We can use this value. */
assert (linkval[0] == '/');
while (len > 1 && linkval[len - 1] != '/')
--len;
result = (char *) malloc (len + 1);
if (result == NULL)
result = (char *) -1;
else if (len == 1)
memcpy (result, "/", 2);
else
*((char *) __mempcpy (result, linkval, len - 1)) = '\0';
}
else
{
result = (char *) -1;
/* We use the environment variable LD_ORIGIN_PATH. If it is set make
a copy and strip out trailing slashes. */
if (GLRO(dl_origin_path) != NULL)
{
size_t len = strlen (GLRO(dl_origin_path));
result = (char *) malloc (len + 1);
if (result == NULL)
result = (char *) -1;
else
{
char *cp = __mempcpy (result, GLRO(dl_origin_path), len);
while (cp > result + 1 && cp[-1] == '/')
--cp;
*cp = '\0';
}
}
}
return result;
}
示例13: __pthread_get_minstack
size_t
__pthread_get_minstack (const pthread_attr_t *attr)
{
struct pthread_attr *iattr = (struct pthread_attr *) attr;
return (GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN
+ iattr->guardsize);
}
示例14: __getauxval
unsigned long int
__getauxval (unsigned long int type)
{
ElfW(auxv_t) *p;
if (type == AT_HWCAP)
return GLRO(dl_hwcap);
else if (type == AT_HWCAP2)
return GLRO(dl_hwcap2);
for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
if (p->a_type == type)
return p->a_un.a_val;
__set_errno (ENOENT);
return 0;
}
示例15: _init
void
attribute_hidden
_init (int argc, char **argv, char **envp)
{
#endif
#ifdef USE_NONOPTION_FLAGS
extern void __getopt_clean_environment (char **);
#endif
__libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
/* Make sure we don't initialize twice. */
if (!__libc_multiple_libcs)
{
/* Set the FPU control word to the proper default value if the
kernel would use a different value. (In a static program we
don't have this information.) */
#ifdef SHARED
if (__fpu_control != GLRO(dl_fpu_control))
#endif
__setfpucw (__fpu_control);
}
/* Save the command-line arguments. */
__libc_argc = argc;
__libc_argv = argv;
__environ = envp;
#ifndef SHARED
// !BAM
// __libc_init_secure ();
/* First the initialization which normally would be done by the
dynamic linker. */
// !BAM
// _dl_non_dynamic_init ();
#endif
#ifdef VDSO_SETUP
VDSO_SETUP ();
#endif
__init_misc (argc, argv, envp);
#ifdef USE_NONOPTION_FLAGS
/* This is a hack to make the special getopt in GNU libc working. */
__getopt_clean_environment (envp);
#endif
/* Initialize ctype data. */
__ctype_init ();
#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
__libc_global_ctors ();
#endif
}