xlatsection.awk 597 Bytes
Newer Older
PoroCYon's avatar
initial  
PoroCYon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
# De-windowsify section and exported symbol names
#

{
	if ($0 ~ "^section[\t ]+(\.[^\t ]*)[\t ]+([^\t ]*)[\t ]+align=(.*)$") {
		basesect = $3
		if (basesect == "code") {
			basesect = "text"
		}

		extra = ""

		if (basesect == "text") {
			extra = " progbits alloc exec nowrite "
		} else if (basesect == "data") {
			extra = " progbits alloc noexec write "
		} else if (basesect == "bss") {
			extra = " nobits alloc noexec write "
		}

		print $1 " ." basesect $2 extra $4
	} else if ($2 ~ "_4klang_render@4" && $1 == "export_func") {
		print $1 " 4klang_render"
	} else {
		print $0
	}
}