Skip to content

Commit cdd21ec

Browse files
committed
consider null section, and unknown sections
1 parent cd8446b commit cdd21ec

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/caotral/assembler/writer.rb

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,31 @@ def _flag(section_type)
9696
case section_type
9797
when :progbits
9898
6
99-
when :symtab, :strtab
99+
when :symtab, :strtab, :null
100100
0
101101
else
102102
0
103103
end
104104
end
105105

106106
def _addralign(type, section_name)
107-
return 1 if type == :progbits && section_name == ".text"
108-
return 8 if type == :symtab
109-
1
107+
case type
108+
when (type == :progbits && section_name == ".text") || type == :strtab
109+
1
110+
when :symtab
111+
8
112+
when :null
113+
0
114+
else
115+
0
116+
end
110117
end
111118

112119
def _info(section_type)
113120
case section_type
114121
when :symtab
115122
1
116-
when :progbits, :strtab
123+
when :progbits, :strtab, :null
117124
0
118125
else
119126
0
@@ -123,7 +130,7 @@ def _entsize(section_type)
123130
case section_type
124131
when :symtab
125132
24
126-
when :progbits, :strtab
133+
when :progbits, :strtab, :null
127134
0
128135
else
129136
0

0 commit comments

Comments
 (0)