Assembly directives, '.section data' and '.section text' require that dot be used with both .data and .text. The .section directive may be omitted. With the dot missing, the ELF header ends up being corrupted. Please edit your source file as instructed above, and re-assemble, re-link and re-run your program. You should no longer be seeing the error message in question.
On Sat, Jan 26, 2019 at 5:27 PM Alexander Kapshuk <[email protected]> wrote: > > Somehow your func binary ended up having its ELF header corrupted. > Can you please run > (1). readelf -h func > (2). mv func func.broken; as func.s -o func.o; ld func.o -o func > (3). readelf -h func > > And send back the output generated by the commands above. > > > On Sat, Jan 26, 2019 at 4:38 PM Arnkæll <[email protected]> wrote: > > > > ELF 32-bit LSB executable, Intel 80386, version 1(sysv), corrupted program > > header size, not stripped > > > > uh oh lol > > > > On Sat, 26 Jan 2019 at 10:37, Alexander Kapshuk > > <[email protected]> wrote: > >> > >> On Sat, Jan 26, 2019 at 4:35 PM Arnkæll <[email protected]> wrote: > >> > > >> > oh there was more to that command,sorry im not sure what power-binary is > >> > lol im really new to this sort of thing > >> > > >> > On Sat, 26 Jan 2019 at 10:34, Arnkæll <[email protected]> wrote: > >> >> > >> >> sure the output of uname -a is Linux johnathan-VirtualBox > >> >> 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:44:00 UTC 2018 i686 > >> >> athlon i686 GNU/Linux > >> >> > >> >> as for the commands i use > >> >> as func.s -o func.o > >> >> ld func.o -o func > >> >> ./func > >> >> > >> >> On Sat, 26 Jan 2019 at 10:30, Alexander Kapshuk > >> >> <[email protected]> wrote: > >> >>> > >> >>> On Sat, Jan 26, 2019 at 4:19 PM Arnkæll <[email protected]> > >> >>> wrote: > >> >>> > > >> >>> > hi i just have a quick question, ill attach my source incase i've > >> >>> > mistyped > >> >>> > anyway i'm doing the book's exercises in a vm of ubuntu mate, i was > >> >>> > having no issues until trying to run the first program in chapter 4, > >> >>> > it compiles and links just fine but when i try to run it i get this > >> >>> > error: 'Cannot execute binary file: Exec format error' > >> >>> > attached is my source, i believe that the problem may be that i am > >> >>> > running in a VM but if so im not sure what to do, any help would be > >> >>> > appreciated. > >> >>> > regards, > >> >>> > Johnathan > >> >>> > > >> >>> > > >> >>> > > >> >>> > _______________________________________________ > >> >>> > Pgubook-readers mailing list > >> >>> > [email protected] > >> >>> > https://lists.nongnu.org/mailman/listinfo/pgubook-readers > >> >>> > >> >>> Can you please post the commands you use to assemble and link your > >> >>> code? > >> >>> What's the output of: > >> >>> uname -a > >> >>> file /path/to/power-binary > >> > >> file func _______________________________________________ Pgubook-readers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/pgubook-readers
