MT#55283 further defuse ifunc on non-x86 targets

Some gcc targets report ifunc as a supported attribute, while at the
same time actually trying to build the object fails with "ifunc not
supported on this target". Be more prejudicial with ifunc usage.

Change-Id: I5820338476938bf581d6d9e38fe0e6fd48f0b874
(cherry picked from commit 80014423c3)
rfuchs/dataport-mr11.5
Richard Fuchs 2 years ago
parent 3838fa2ee0
commit 6db43f9142

@ -37,16 +37,6 @@ static packetizer_f packetizer_samplestream; // flat stream of samples
static packetizer_f packetizer_amr;
#if !defined(ASAN_BUILD) && HAS_ATTR(ifunc)
static void (*resolve_float2int16_array(void))(float *, const uint16_t, int16_t *);
static void float2int16_array(float *in, const uint16_t len, int16_t *out)
__attribute__ ((ifunc ("resolve_float2int16_array")));
#else
#define float2int16_array evs_syn_output
#endif
static void codeclib_key_value_parse(const str *instr, bool need_value,
void (*cb)(str *key, str *value, void *data), void *data);
@ -3378,24 +3368,6 @@ void frame_fill_dtmf_samples(enum AVSampleFormat fmt, void *samples, unsigned in
static void mvr2s_dynlib_wrapper(float *in, const uint16_t len, int16_t *out) {
evs_syn_output(in, len, out);
}
static void (*resolve_float2int16_array(void))(float *, const uint16_t, int16_t *) {
#if defined(__x86_64__)
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX512BW) && rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX512F))
return mvr2s_avx512;
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX2))
return mvr2s_avx2;
#endif
return mvr2s_dynlib_wrapper;
}
// lamely parse out decimal numbers without using floating point
static unsigned int str_to_i_k(str *s) {
str intg;
@ -4304,6 +4276,27 @@ static const char evs_amr_io_compact_cmr[8] = {
};
#if defined(__x86_64__) && !defined(ASAN_BUILD) && HAS_ATTR(ifunc)
static void mvr2s_dynlib_wrapper(float *in, const uint16_t len, int16_t *out) {
evs_syn_output(in, len, out);
}
static void (*resolve_float2int16_array(void))(float *, const uint16_t, int16_t *) {
#if defined(__x86_64__)
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX512BW) && rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX512F))
return mvr2s_avx512;
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX2))
return mvr2s_avx2;
#endif
return mvr2s_dynlib_wrapper;
}
static void float2int16_array(float *in, const uint16_t len, int16_t *out)
__attribute__ ((ifunc ("resolve_float2int16_array")));
#else
#define float2int16_array evs_syn_output
#endif
static int evs_decoder_input(decoder_t *dec, const str *data, GQueue *out) {
str input = *data;
uint64_t pts = dec->pts;

@ -53,16 +53,14 @@ static void s16_mix_in_c(void *restrict dst, const void *restrict src, unsigned
}
#if !defined(ASAN_BUILD) && HAS_ATTR(ifunc)
#if defined(__x86_64__) && !defined(ASAN_BUILD) && HAS_ATTR(ifunc)
static mix_in_fn_t *resolve_s16_mix_in(void) {
#if defined(__x86_64__)
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX512BW))
return s16_mix_in_avx512;
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_AVX2))
return s16_mix_in_avx2;
if (rtpe_has_cpu_flag(RTPE_CPU_FLAG_SSE2))
return s16_mix_in_sse2;
#endif
return s16_mix_in_c;
}
static mix_in_fn_t s16_mix_in __attribute__ ((ifunc ("resolve_s16_mix_in")));

Loading…
Cancel
Save