[oss] [Lab 02][Task 5] mark .data as executable

Lucian Mogosanu lucian.mogosanu at cs.pub.ro
Sun Oct 26 11:08:22 EET 2014


On Sat, Oct 25, 2014 at 05:06:17PM +0300, Alex Teaca wrote:
> Also, I tried to compile with -S flag, and update the task5.s with
> ".section .data,"awx", at progbits"
> but, when I compile, I get
> 
> gcc -C task5.s
> test5.s: Assembler messages:
> test5.s:5: Warning: ignoring changed section attributes for .data
> 
> and the .data section remains WA.

I managed to make .data executable with NASM, with a little help from the
documentation [1]: I added the `exec` directive to .data on hello.asm, and now
readelf -S gives me the following output:

---
There are 15 section headers, starting at offset 0x2d4:

Section Headers:
[...]
  [ 9] .text             PROGBITS        08048190 000190 00000a 00  AX  0   0 16
  [10] .eh_frame         PROGBITS        0804819c 00019c 000000 00   A  0   0  4
  [11] .dynamic          DYNAMIC         0804919c 00019c 0000a0 08  WA  4   0  4
  [12] .got.plt          PROGBITS        0804923c 00023c 000010 04  WA  0   0  4
  [13] .data             PROGBITS        0804924c 00024c 00000e 00 WAX  0   0  4
[...]
---

Does that work for you?

[1]: http://www.nasm.us/doc/nasmdoc7.html#section-7.9.2

Lucian


More information about the oss mailing list