mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 00:50:50 +00:00
libsys auxv.c: add fences needed to ensure that flag works
Noted by: jrtc27 Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
58df49801d
commit
2f4cbf459d
|
@ -36,6 +36,7 @@
|
||||||
#include <sys/auxv.h>
|
#include <sys/auxv.h>
|
||||||
#include "un-namespace.h"
|
#include "un-namespace.h"
|
||||||
#include "libc_private.h"
|
#include "libc_private.h"
|
||||||
|
#include <machine/atomic.h>
|
||||||
|
|
||||||
extern int _DYNAMIC;
|
extern int _DYNAMIC;
|
||||||
#pragma weak _DYNAMIC
|
#pragma weak _DYNAMIC
|
||||||
|
@ -66,7 +67,7 @@ __init_elf_aux_vector(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool aux_once = false;
|
static int aux_once;
|
||||||
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
|
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
|
||||||
static int hwcap_present, hwcap2_present;
|
static int hwcap_present, hwcap2_present;
|
||||||
static char *canary, *pagesizes, *execpath;
|
static char *canary, *pagesizes, *execpath;
|
||||||
|
@ -92,7 +93,7 @@ init_aux(void)
|
||||||
{
|
{
|
||||||
Elf_Auxinfo *aux;
|
Elf_Auxinfo *aux;
|
||||||
|
|
||||||
if (aux_once)
|
if (atomic_load_acq_int(&aux_once))
|
||||||
return;
|
return;
|
||||||
for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) {
|
for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) {
|
||||||
switch (aux->a_type) {
|
switch (aux->a_type) {
|
||||||
|
@ -179,7 +180,7 @@ init_aux(void)
|
||||||
_init_aux_powerpc_fixup();
|
_init_aux_powerpc_fixup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aux_once = true;
|
atomic_store_rel_int(&aux_once, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __powerpc__
|
#ifdef __powerpc__
|
||||||
|
|
Loading…
Reference in a new issue