title: When is .ARM.exidx is used
body: <p>I am working on Contiki 2.7 with the mbxxx target. While building my code the linker complained about an <strong>overlap of .ARM.exidx and .data sections</strong>. After some tinkering around with the linker script contiki-2.7/cpu/stm32w108/gnu-stm32w108.ld I fixed the problem by replacing:</p>
  
  <pre><code>__exidx_start = .;
  __exidx_end = .;
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>.ARM.exidx : {
      __exidx_start = .;
      *(.ARM.exidx* .gnu.linkonce.armexidx.*)
      __exidx_end = .;
  } &gt;ROM_region
  </code></pre>
  
  <p>Later when I tried to see the header listing of some other example applications by using objdump -h I did not find this particular .ARM.exidx section, while it is present in my application. Googling about .ARM.exidx led me to the fact that it is used for some c++ exception handling. Since my code is a pure C code, why is this section present on my code? When is generally .ARM.exidx present in a code and what is its utility?</p>
  
  <p>==================================================================================</p>
  
  <p>Well no, I don't have any such compiler options. I am actually using the AxTLS api and ripped out the certificate handling code and ported it to contiki. On some further digging I found a fishy behaviour in the bigint implementation. To be brief... here is the body of a function from the bigint.c file: </p>
  
  <pre><code>static bigint *bi_int_multiply(BI_CTX *ctx, bigint *bia, comp b)
  {
     int j = 0, n = bia-&gt;size;
     bigint *biR = alloc(ctx, n + 1);
     comp carry = 5;
     comp *r = biR-&gt;comps;
     comp *a = bia-&gt;comps;
  
     check(bia);
  
     /* clear things to start with */
     memset(r, 0, ((n+1)*COMP_BYTE_SIZE));
  
  
     do
     {
         long_comp tmp = *r + (long_comp)a[j]*b + carry;
     //    *r++ = (comp)tmp;              /* downsize */
         carry = (comp)(tmp &gt;&gt; COMP_BIT_SIZE);
     } while (++j &lt; n);
  
    // *r = carry;
    bi_free(ctx, bia);
  
    return trim(biR);
  }
  </code></pre>
  
  <p>if the commented out portions, (the r variable assignment) is uncommented, the .ARM.exidx thingy appears, otherwise it doesn't! Now can this be explained???</p>
  
  <p>==================================================================================</p>
  
  <p>I didn't find any thing out of the ordinary used in the implementation of <code>alloc()</code>. There were 2 references of <code>alloca()</code> used in some separate region of the code, which I replaced with <code>malloc()</code> and <code>free()</code>, but that didn't fix the problem either. <code>alloc()</code> implementation has only calls to <code>malloc()</code>,<code>realloc()</code> and <code>free()</code></p>