1
0
Fork 0
forked from len0rd/rockbox

rbcodec dsp: Remove INIT_ATTR from the DSP library

All of these are technically unsafe cross-section references but
most aren't reported by the linker, probably due to inlining. In
practice there was no problem because the affected code was only
run at init time anyway.

For now, remove INIT_ATTR until the init code can be refactored
to avoid the problematic references. This should also save code
size by moving more code to the init section.

dsp_init() gets to keep its attribute because it's already OK.

Change-Id: Idc9ac0e02cb07f31d186686e0382275c02a85dbb
This commit is contained in:
Aidan MacDonald 2022-12-03 15:04:06 +00:00
parent b650e774a1
commit 8165a6c245
8 changed files with 15 additions and 20 deletions

View file

@ -505,7 +505,7 @@ enum dsp_ids dsp_get_id(const struct dsp_config *dsp)
/* Do what needs initializing before enable/disable calls can be made. /* Do what needs initializing before enable/disable calls can be made.
* Must be done before changing settings for the first time. */ * Must be done before changing settings for the first time. */
void INIT_ATTR dsp_init(void) void dsp_init(void)
{ {
static const uint8_t slot_count[DSP_COUNT] INITDATA_ATTR = static const uint8_t slot_count[DSP_COUNT] INITDATA_ATTR =
{ {

View file

@ -144,6 +144,6 @@ intptr_t dsp_configure(struct dsp_config *dsp, unsigned int setting,
intptr_t value); intptr_t value);
/* One-time startup init that must come before settings reset/apply */ /* One-time startup init that must come before settings reset/apply */
void dsp_init(void); void dsp_init(void) INIT_ATTR;
#endif /* _DSP_H */ #endif /* _DSP_H */

View file

@ -149,8 +149,7 @@ unsigned int dsp_get_output_frequency(struct dsp_config *dsp)
return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0); return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0);
} }
static void INIT_ATTR misc_dsp_init(struct dsp_config *dsp, static void misc_dsp_init(struct dsp_config *dsp, enum dsp_ids dsp_id)
enum dsp_ids dsp_id)
{ {
/* Enable us for the audio DSP at startup */ /* Enable us for the audio DSP at startup */
if (dsp_id == CODEC_IDX_AUDIO) if (dsp_id == CODEC_IDX_AUDIO)

View file

@ -257,8 +257,8 @@ static void dsp_sample_input_flush(struct sample_io_data *this)
this->sample_buf.remcount = 0; this->sample_buf.remcount = 0;
} }
static void INIT_ATTR dsp_sample_input_init(struct sample_io_data *this, static void dsp_sample_input_init(struct sample_io_data *this,
enum dsp_ids dsp_id) enum dsp_ids dsp_id)
{ {
int32_t *lbuf, *rbuf; int32_t *lbuf, *rbuf;
@ -283,8 +283,8 @@ static void INIT_ATTR dsp_sample_input_init(struct sample_io_data *this,
this->sample_buf_p[1] = rbuf; this->sample_buf_p[1] = rbuf;
} }
static void INIT_ATTR dsp_sample_io_init(struct sample_io_data *this, static void dsp_sample_io_init(struct sample_io_data *this,
enum dsp_ids dsp_id) enum dsp_ids dsp_id)
{ {
this->output_sampr = DSP_OUT_DEFAULT_HZ; this->output_sampr = DSP_OUT_DEFAULT_HZ;
dsp_sample_input_init(this, dsp_id); dsp_sample_input_init(this, dsp_id);

View file

@ -181,7 +181,7 @@ void dsp_sample_output_format_change(struct sample_io_data *this,
this->output_version = format->version; this->output_version = format->version;
} }
void INIT_ATTR dsp_sample_output_init(struct sample_io_data *this) void dsp_sample_output_init(struct sample_io_data *this)
{ {
this->output_version = 0; this->output_version = 0;
this->output_samples = sample_output_stereo; this->output_samples = sample_output_stereo;

View file

@ -262,8 +262,8 @@ static intptr_t resample_new_format(struct dsp_proc_entry *this,
return PROC_NEW_FORMAT_DEACTIVATED; return PROC_NEW_FORMAT_DEACTIVATED;
} }
static void INIT_ATTR resample_dsp_init(struct dsp_config *dsp, static void resample_dsp_init(struct dsp_config *dsp,
enum dsp_ids dsp_id) enum dsp_ids dsp_id)
{ {
int32_t *lbuf, *rbuf; int32_t *lbuf, *rbuf;
@ -291,8 +291,8 @@ static void INIT_ATTR resample_dsp_init(struct dsp_config *dsp,
resample_data[dsp_id].resample_out_p[1] = rbuf; resample_data[dsp_id].resample_out_p[1] = rbuf;
} }
static void INIT_ATTR resample_proc_init(struct dsp_proc_entry *this, static void resample_proc_init(struct dsp_proc_entry *this,
struct dsp_config *dsp) struct dsp_config *dsp)
{ {
struct resample_data *data = &resample_data[dsp_get_id(dsp)]; struct resample_data *data = &resample_data[dsp_get_id(dsp)];
this->data = (intptr_t)data; this->data = (intptr_t)data;

View file

@ -521,8 +521,8 @@ static intptr_t tdspeed_new_format(struct dsp_proc_entry *this,
(void)this; (void)this;
} }
static void INIT_ATTR tdspeed_dsp_init(struct tdspeed_state_s *st, static void tdspeed_dsp_init(struct tdspeed_state_s *st,
enum dsp_ids dsp_id) enum dsp_ids dsp_id)
{ {
/* everything is at 100% until dsp_set_timestretch is called with /* everything is at 100% until dsp_set_timestretch is called with
some other value and timestretch is enabled at the time */ some other value and timestretch is enabled at the time */

View file

@ -107,11 +107,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
#ifndef IDATA_ATTR #ifndef IDATA_ATTR
# define IDATA_ATTR # define IDATA_ATTR
#endif #endif
/*
#ifndef INIT_ATTR
# define INIT_ATTR
#endif
*/
#ifndef MEM_ALIGN_ATTR #ifndef MEM_ALIGN_ATTR
# define MEM_ALIGN_ATTR # define MEM_ALIGN_ATTR
#endif #endif