summaryrefslogtreecommitdiff
path: root/lib/rbcodec
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-12-03 15:04:06 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-12-18 22:23:52 +0000
commit8165a6c24551478d4aa6b6123e0a7603961e9204 (patch)
tree9fdc80f9b124d5621c01117c92c9db0ee881462c /lib/rbcodec
parentb650e774a17f7de78ff3927b0a48f2e373ece787 (diff)
downloadrockbox-8165a6c24551478d4aa6b6123e0a7603961e9204.tar.gz
rockbox-8165a6c24551478d4aa6b6123e0a7603961e9204.zip
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
Diffstat (limited to 'lib/rbcodec')
-rw-r--r--lib/rbcodec/dsp/dsp_core.c2
-rw-r--r--lib/rbcodec/dsp/dsp_core.h2
-rw-r--r--lib/rbcodec/dsp/dsp_misc.c3
-rw-r--r--lib/rbcodec/dsp/dsp_sample_input.c8
-rw-r--r--lib/rbcodec/dsp/dsp_sample_output.c2
-rw-r--r--lib/rbcodec/dsp/resample.c8
-rw-r--r--lib/rbcodec/dsp/tdspeed.c4
-rw-r--r--lib/rbcodec/platform.h6
8 files changed, 15 insertions, 20 deletions
diff --git a/lib/rbcodec/dsp/dsp_core.c b/lib/rbcodec/dsp/dsp_core.c
index 5a08ce8e37..3e72322ea6 100644
--- a/lib/rbcodec/dsp/dsp_core.c
+++ b/lib/rbcodec/dsp/dsp_core.c
@@ -505,7 +505,7 @@ enum dsp_ids dsp_get_id(const struct dsp_config *dsp)
505 505
506/* Do what needs initializing before enable/disable calls can be made. 506/* Do what needs initializing before enable/disable calls can be made.
507 * Must be done before changing settings for the first time. */ 507 * Must be done before changing settings for the first time. */
508void INIT_ATTR dsp_init(void) 508void dsp_init(void)
509{ 509{
510 static const uint8_t slot_count[DSP_COUNT] INITDATA_ATTR = 510 static const uint8_t slot_count[DSP_COUNT] INITDATA_ATTR =
511 { 511 {
diff --git a/lib/rbcodec/dsp/dsp_core.h b/lib/rbcodec/dsp/dsp_core.h
index 0f63b62e00..e18d045056 100644
--- a/lib/rbcodec/dsp/dsp_core.h
+++ b/lib/rbcodec/dsp/dsp_core.h
@@ -144,6 +144,6 @@ intptr_t dsp_configure(struct dsp_config *dsp, unsigned int setting,
144 intptr_t value); 144 intptr_t value);
145 145
146/* One-time startup init that must come before settings reset/apply */ 146/* One-time startup init that must come before settings reset/apply */
147void dsp_init(void); 147void dsp_init(void) INIT_ATTR;
148 148
149#endif /* _DSP_H */ 149#endif /* _DSP_H */
diff --git a/lib/rbcodec/dsp/dsp_misc.c b/lib/rbcodec/dsp/dsp_misc.c
index ad6f5b5b31..83e577935b 100644
--- a/lib/rbcodec/dsp/dsp_misc.c
+++ b/lib/rbcodec/dsp/dsp_misc.c
@@ -149,8 +149,7 @@ unsigned int dsp_get_output_frequency(struct dsp_config *dsp)
149 return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0); 149 return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0);
150} 150}
151 151
152static void INIT_ATTR misc_dsp_init(struct dsp_config *dsp, 152static void misc_dsp_init(struct dsp_config *dsp, enum dsp_ids dsp_id)
153 enum dsp_ids dsp_id)
154{ 153{
155 /* Enable us for the audio DSP at startup */ 154 /* Enable us for the audio DSP at startup */
156 if (dsp_id == CODEC_IDX_AUDIO) 155 if (dsp_id == CODEC_IDX_AUDIO)
diff --git a/lib/rbcodec/dsp/dsp_sample_input.c b/lib/rbcodec/dsp/dsp_sample_input.c
index 537a659b73..c57f81bb4f 100644
--- a/lib/rbcodec/dsp/dsp_sample_input.c
+++ b/lib/rbcodec/dsp/dsp_sample_input.c
@@ -257,8 +257,8 @@ static void dsp_sample_input_flush(struct sample_io_data *this)
257 this->sample_buf.remcount = 0; 257 this->sample_buf.remcount = 0;
258} 258}
259 259
260static void INIT_ATTR dsp_sample_input_init(struct sample_io_data *this, 260static void dsp_sample_input_init(struct sample_io_data *this,
261 enum dsp_ids dsp_id) 261 enum dsp_ids dsp_id)
262{ 262{
263 int32_t *lbuf, *rbuf; 263 int32_t *lbuf, *rbuf;
264 264
@@ -283,8 +283,8 @@ static void INIT_ATTR dsp_sample_input_init(struct sample_io_data *this,
283 this->sample_buf_p[1] = rbuf; 283 this->sample_buf_p[1] = rbuf;
284} 284}
285 285
286static void INIT_ATTR dsp_sample_io_init(struct sample_io_data *this, 286static void dsp_sample_io_init(struct sample_io_data *this,
287 enum dsp_ids dsp_id) 287 enum dsp_ids dsp_id)
288{ 288{
289 this->output_sampr = DSP_OUT_DEFAULT_HZ; 289 this->output_sampr = DSP_OUT_DEFAULT_HZ;
290 dsp_sample_input_init(this, dsp_id); 290 dsp_sample_input_init(this, dsp_id);
diff --git a/lib/rbcodec/dsp/dsp_sample_output.c b/lib/rbcodec/dsp/dsp_sample_output.c
index 65cd7ccf15..705a498a58 100644
--- a/lib/rbcodec/dsp/dsp_sample_output.c
+++ b/lib/rbcodec/dsp/dsp_sample_output.c
@@ -181,7 +181,7 @@ void dsp_sample_output_format_change(struct sample_io_data *this,
181 this->output_version = format->version; 181 this->output_version = format->version;
182} 182}
183 183
184void INIT_ATTR dsp_sample_output_init(struct sample_io_data *this) 184void dsp_sample_output_init(struct sample_io_data *this)
185{ 185{
186 this->output_version = 0; 186 this->output_version = 0;
187 this->output_samples = sample_output_stereo; 187 this->output_samples = sample_output_stereo;
diff --git a/lib/rbcodec/dsp/resample.c b/lib/rbcodec/dsp/resample.c
index 0a97bdf70c..a583f60a55 100644
--- a/lib/rbcodec/dsp/resample.c
+++ b/lib/rbcodec/dsp/resample.c
@@ -262,8 +262,8 @@ static intptr_t resample_new_format(struct dsp_proc_entry *this,
262 return PROC_NEW_FORMAT_DEACTIVATED; 262 return PROC_NEW_FORMAT_DEACTIVATED;
263} 263}
264 264
265static void INIT_ATTR resample_dsp_init(struct dsp_config *dsp, 265static void resample_dsp_init(struct dsp_config *dsp,
266 enum dsp_ids dsp_id) 266 enum dsp_ids dsp_id)
267{ 267{
268 int32_t *lbuf, *rbuf; 268 int32_t *lbuf, *rbuf;
269 269
@@ -291,8 +291,8 @@ static void INIT_ATTR resample_dsp_init(struct dsp_config *dsp,
291 resample_data[dsp_id].resample_out_p[1] = rbuf; 291 resample_data[dsp_id].resample_out_p[1] = rbuf;
292} 292}
293 293
294static void INIT_ATTR resample_proc_init(struct dsp_proc_entry *this, 294static void resample_proc_init(struct dsp_proc_entry *this,
295 struct dsp_config *dsp) 295 struct dsp_config *dsp)
296{ 296{
297 struct resample_data *data = &resample_data[dsp_get_id(dsp)]; 297 struct resample_data *data = &resample_data[dsp_get_id(dsp)];
298 this->data = (intptr_t)data; 298 this->data = (intptr_t)data;
diff --git a/lib/rbcodec/dsp/tdspeed.c b/lib/rbcodec/dsp/tdspeed.c
index 64cbaf5e12..7a9d818f19 100644
--- a/lib/rbcodec/dsp/tdspeed.c
+++ b/lib/rbcodec/dsp/tdspeed.c
@@ -521,8 +521,8 @@ static intptr_t tdspeed_new_format(struct dsp_proc_entry *this,
521 (void)this; 521 (void)this;
522} 522}
523 523
524static void INIT_ATTR tdspeed_dsp_init(struct tdspeed_state_s *st, 524static void tdspeed_dsp_init(struct tdspeed_state_s *st,
525 enum dsp_ids dsp_id) 525 enum dsp_ids dsp_id)
526{ 526{
527 /* everything is at 100% until dsp_set_timestretch is called with 527 /* everything is at 100% until dsp_set_timestretch is called with
528 some other value and timestretch is enabled at the time */ 528 some other value and timestretch is enabled at the time */
diff --git a/lib/rbcodec/platform.h b/lib/rbcodec/platform.h
index febda44ca0..d13380b795 100644
--- a/lib/rbcodec/platform.h
+++ b/lib/rbcodec/platform.h
@@ -107,11 +107,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
107#ifndef IDATA_ATTR 107#ifndef IDATA_ATTR
108# define IDATA_ATTR 108# define IDATA_ATTR
109#endif 109#endif
110/* 110
111#ifndef INIT_ATTR
112# define INIT_ATTR
113#endif
114*/
115#ifndef MEM_ALIGN_ATTR 111#ifndef MEM_ALIGN_ATTR
116# define MEM_ALIGN_ATTR 112# define MEM_ALIGN_ATTR
117#endif 113#endif