Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-10-13 Thread Jiri Slaby
On 10/14/2016, 08:25 AM, Vegard Nossum wrote: > On 10/14/2016 07:52 AM, Jiri Slaby wrote: >> On 06/26/2016, 07:17 PM, Linus Torvalds wrote: >>> On Sun, Jun 26, 2016 at 2:24 AM, Vegard Nossum >>> wrote: This is the best I could come up with: assuming gcc is not allowed to reason abou

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-10-13 Thread Vegard Nossum
On 10/14/2016 07:52 AM, Jiri Slaby wrote: On 06/26/2016, 07:17 PM, Linus Torvalds wrote: On Sun, Jun 26, 2016 at 2:24 AM, Vegard Nossum wrote: This is the best I could come up with: assuming gcc is not allowed to reason about what's inside the asm(), this is the only way I could think of to l

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-10-13 Thread Jiri Slaby
On 06/26/2016, 07:17 PM, Linus Torvalds wrote: > On Sun, Jun 26, 2016 at 2:24 AM, Vegard Nossum > wrote: >> >> This is the best I could come up with: assuming gcc is not allowed to >> reason about what's inside the asm(), this is the only way I could >> think of to lose the array information with

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-06-28 Thread Linus Torvalds
On Tue, Jun 28, 2016 at 5:23 AM, George Spelvin wrote: > You could define a wrapper if you like, something like We already have RELOC_HIDE() and OPTIMIZER_HIDE_VAR() that basically do this. They both use 'r'. I guess they could use X. Linus

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-06-28 Thread George Spelvin
+#define external_array(type, name) \ + ({ \ + extern type name[]; \ + type *name_ptr = name; \ + asm ("" : "+r" (name_ptr)); \ + name_ptr; \ + }) I've had to pull similar tricks to persuade GCC to generate the code I wanted (in m

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-06-26 Thread Linus Torvalds
On Sun, Jun 26, 2016 at 2:24 AM, Vegard Nossum wrote: > > This is the best I could come up with: assuming gcc is not allowed to > reason about what's inside the asm(), this is the only way I could > think of to lose the array information without incurring unnecessary > overheads. It should also be

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-06-26 Thread Vegard Nossum
On 25 June 2016 at 23:06, Vegard Nossum wrote: > On 25 June 2016 at 17:04, Vegard Nossum wrote: >> The test in this loop: >> >> for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) { >> >> was getting completely compiled out by my gcc, 7.0.0 20160520. The result >> was that the loo

Re: [PATCH] firmware: declare __{start,end}_builtin_fw as pointers

2016-06-25 Thread Vegard Nossum
On 25 June 2016 at 17:04, Vegard Nossum wrote: > The test in this loop: > > for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) { > > was getting completely compiled out by my gcc, 7.0.0 20160520. The result > was that the loop was going beyond the end of the builtin_fw array and >