6 class ToolchainTests(unittest
.TestCase
):
8 def test_padding_unusual_code_sections(self
):
9 # Test that ends of code sections are padded with NOPs not
10 # zeroes when concatenated by the linker.
11 subprocess
.check_call(["nacl-gcc", "-c", "tests/section-padding.S",
12 "-o", "tests/section-padding-1.o"])
13 subprocess
.check_call(["nacl-gcc", "-c", "tests/section-padding.S",
15 "-o", "tests/section-padding-2.o"])
16 # Use of --relocatable mimics how glibc links libc.so in two
17 # steps, producing libc_pic.os as an intermediate object.
18 subprocess
.check_call(["nacl-ld", "--relocatable",
20 "tests/section-padding-1.o",
21 "tests/section-padding-2.o",
22 "-o", "tests/section-padding-both.o"])
23 # Link into an .so so that we can run ncval on it.
24 # TODO: Make ncval work on .o files.
25 subprocess
.check_call(["nacl-gcc", "-shared",
27 "tests/section-padding-both.o",
28 "-o", "tests/section-padding-both.so"])
29 subprocess
.check_call(["ncval", "tests/section-padding-both.so"])
32 if __name__
== "__main__":