correctly mark code segments as code in SELF
[coreboot.git] / util / cbfstool / cbfs-mkpayload.c
index ff6479dc660e82f2455eabd3523573e3bd6b4b86..e4ef5c835110f6a3823263e0cf971459fde41586 100644 (file)
@@ -161,7 +161,10 @@ int parse_elf_to_payload(unsigned char *input, unsigned char **output,
                        continue;
                }
 
-               segs[segments].type = PAYLOAD_SEGMENT_DATA;
+               if (phdr[i].p_flags & PF_X)
+                       segs[segments].type = PAYLOAD_SEGMENT_CODE;
+               else
+                       segs[segments].type = PAYLOAD_SEGMENT_DATA;
                segs[segments].load_addr = (uint64_t)htonll(phdr[i].p_paddr);
                segs[segments].mem_len = (uint32_t)htonl(phdr[i].p_memsz);
                segs[segments].compression = htonl(algo);