3 ms·
Sure. But is there an a.out userspace? How do you make a.out binaries on linux today?
by Arnt 8y ago
Sure. But is there an a.out userspace? How do you make a.out binaries on linux today?
- ktjfi 8y agoIsn't a.out the default output format of gcc? I think if you type "gcc myfile.c" you get an a.out executable.
- FineTralfazz 8y agoIt's named a.out, but that's just a legacy convention. It's still an ELF file.
- classichasclass 8y agoNo, you get a file named a.out by default, but it's not in that format.
- tannhaeuser 8y agoNo it's just the file name. If you run `file` on it, it'll tell you it's an ELF image.
- torlakur 8y agoThe name has stuck for some reason, but actually the output format is ELF.
- moray 8y agoHere it refers to the binary executable file format not the default file name gcc uses after compilation. a.out is a very old format superseded by ELF. https://en.wikipedia.org/wiki/A.out https://en.wikipedia.org/wiki/A.out
- benj111 8y agoAs others have pointed out it's an elf file called a.out. I would like to ask who's idea it was to name GCCs default output after a completely different file format ?!
- naniwaduni 8y agoThe format was named for the file, not the file for the format. By the time this became incongruous, it was too late to fix.
- Arnt 8y agogcc copied most of its command-line arguments from older compilers, including -o, and the default value if -o isn't set was also copied. So the command-line arguments and defaults are older than the ELF format. When ELF support was added, the question was: Should the default value for -o depend on other arguments? There didn't seem to be good reason to have a complicated default, and keeping the simple default provided compatibility with old scripts and makefiles. cd tests ; for a in *.c ; do gcc $a && ./a.out ; done
- Someone 8y ago“Don’t break userspace” also means that I should be able to run a binary that I recover from a tape backup made in 1992.
- Arnt 8y agoI assume that binary used shared libraries? I still have the file system from a linux host I installed in 1999 or 2000. Debian; I made a VM copy when I retired the iron. It doesn't have a.out shared libraries, so even if the kernel's support worked in 2000, I could't run that binary for lack of shared libraries. If the kernel's support hasn't really been tested for 19-20 years and the shared libraries haven't even been built, then I think running that binary has very poor chances of working.
- ktm5j 8y agoI'm not trying to weigh in on the debate here, but it's perfectly reasonable to imagine having a statically linked binary that you wanted to run..
- Arnt 8y agoAbsolutely. Now, if you agree that shared libraries haven't been available for a long time and that coredumps haven't worked for a long time, that doesn't mean that nothing works. That doesn't mean that every case has been broken. But I think it means that the support has been very lightly tested for a long time now, or not tested at all. And assuming that something works when it hasn't been tested for a long time is ugh. I think the reason I care about this is dogmatic. I believe, dogmatically, that untested code is broken. If you accept that dogma and do not test a.out support now, then the coming change does not break a.out. If you do test, fine. If you disagree that untested code is broken, fine. If you say it "might imaginably work" or somesuch, fine.