Skip to content

Commit 4220357

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

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/caotral/assembler/writer.rb

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,33 @@ 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"
109+
1
110+
when type == :symtab
111+
8
112+
when type == :null
113+
0
114+
when type == :strtab
115+
1
116+
else
117+
0
118+
end
110119
end
111120

112121
def _info(section_type)
113122
case section_type
114123
when :symtab
115124
1
116-
when :progbits, :strtab
125+
when :progbits, :strtab, :null
117126
0
118127
else
119128
0
@@ -123,7 +132,7 @@ def _entsize(section_type)
123132
case section_type
124133
when :symtab
125134
24
126-
when :progbits, :strtab
135+
when :progbits, :strtab, :null
127136
0
128137
else
129138
0

0 commit comments

Comments
 (0)