mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Adjust r308689 to make rtld compilable with either in-tree or
(hopefully) stock gcc 4.2.1 on i386 and other arches. In particular: - Do not use %ebx in the asm constraints on i386, since rtld is compiled with -fPIC and gcc cannot handle GOT-base register reload (clang and newer gcc can). - Avoid direct use of [static N] construct in the function declaration/definion. In-tree gcc was patched to support this, but stock 4.2.1 cannot handle the feature. Requested by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
250b1bf3c5
commit
d27078f990
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308925
@ -300,7 +300,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj,
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockState *lockstate)
|
||||
uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2;
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
u_int p[4], cpu_high;
|
||||
|
||||
|
@ -480,7 +480,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj,
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/sysarch.h>
|
||||
|
||||
@ -407,8 +406,21 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockState *lockstate)
|
||||
|
||||
uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2;
|
||||
|
||||
static void
|
||||
rtld_cpuid_count(int idx, int cnt, u_int *p)
|
||||
{
|
||||
|
||||
__asm __volatile(
|
||||
" pushl %%ebx\n"
|
||||
" cpuid\n"
|
||||
" movl %%ebx,%1\n"
|
||||
" popl %%ebx\n"
|
||||
: "=a" (p[0]), "=r" (p[1]), "=c" (p[2]), "=d" (p[3])
|
||||
: "0" (idx), "2" (cnt));
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
u_int p[4], cpu_high;
|
||||
int cpuid_supported;
|
||||
@ -432,13 +444,13 @@ ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
if (!cpuid_supported)
|
||||
return;
|
||||
|
||||
do_cpuid(1, p);
|
||||
rtld_cpuid_count(1, 0, p);
|
||||
cpu_feature = p[3];
|
||||
cpu_feature2 = p[2];
|
||||
do_cpuid(0, p);
|
||||
rtld_cpuid_count(0, 0, p);
|
||||
cpu_high = p[0];
|
||||
if (cpu_high >= 7) {
|
||||
cpuid_count(7, 0, p);
|
||||
rtld_cpuid_count(7, 0, p);
|
||||
cpu_stdext_feature = p[1];
|
||||
cpu_stdext_feature2 = p[2];
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj,
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ init_pltgot(Obj_Entry *obj)
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ init_pltgot(Obj_Entry *obj)
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ void dump_Elf_Rela(Obj_Entry *, const Elf_Rela *, u_long);
|
||||
unsigned long elf_hash(const char *);
|
||||
const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *,
|
||||
const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *);
|
||||
void ifunc_init(Elf_Auxinfo[static AT_COUNT]);
|
||||
void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]);
|
||||
void init_pltgot(Obj_Entry *);
|
||||
void lockdflt_init(void);
|
||||
void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr);
|
||||
|
@ -787,7 +787,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj,
|
||||
}
|
||||
|
||||
void
|
||||
ifunc_init(Elf_Auxinfo aux_info[static AT_COUNT] __unused)
|
||||
ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user