Re: NASM source files extensions



Jim Carlock wrote:
Since Betov is asking about Linux...

Actually, I think he was only talking about a file extension - a more common one on Linux... But we don't need an excuse to talk about Linux. :)

(1) How do you create a DLL in Unix/Linux?

ld -shared -o libmyfile.so myfile.o

There's a bit more to it than that. Deserves a thread of its own. Perhaps I'll start one.

(Do you just mark
a file with an Executable bit?)

Well... ld will set the executable bit. If "a file" has the appropriate header - say produced by Nasm's "-f bin" mode - then setting the executable bit (chmod +x libmylib.so) would be necessary. If "a file" doesn't have the appropriate header, setting the executable bit will only change the error message from "permission denied" to "can't execute binary file".

Googling and reading turned up some
things about .so and some other extensions but I tend to get the
feeling that extensions do not get employed much on a Unix/Linux
system (based upon all the README and LICENSE files). Betov
asked about the extensions in a newer thread, so it appears that
.s is a 'source code' extension, and .so is a 'source output or object'
file. Any comments?

"shared object", I think. As a general rule, Linux doesn't care much about file names or extensions too much, depending more on "magic" signatures ( 7Fh, 'E', 'L', 'F' for example). The dynamic linking system seems to be an exception to this. I *think* our dll/so needs to be named "lib???.so" - we ask for it with "-lc", for example, not "-llibc.so". No doubt this is configurable - everything seems to be - but it does "matter".

They way I currently understand Unix/Linux,
is that any file turns into an executable file (library or other) the
moment you tell the file system that it's an executable (by changing
a particular bit employed by the file system).

Well... *without* executable permission, Linux won't even try it. But "any file turns into an executable file" would be a good trick! It may be that ELF isn't the only executable format Linux will accept - it's the only one I'm aware of. An executable can have any name/extension - I guess that's what you mean. A shared library has some restrictions, as noted.

Compared to NT, any file can be an executable, but to run it from
the command-line, usually the environmental variable PATHEXT
gets set, an entry about what which program interprets the file gets
set in the registry (assoc and ftype command-line tools help).

(2) OSF/1 -> seems to no longer exist. Anyone know the common
name for the Linux file system (if such exists)?

Never heard of OSF/1. "Minix" is an old file system - used by the two-floppy "BlueFlops" distro. I'm using "ext2". "ext3" is more "modern", I guess. Linux will handle a bunch of filesystems - transparently.

(3) Mach -> seems to have turned into Macho. Mach appearantly
was an OSF/1 thing. Comments?

Linux doesn't list a "mach*" filesystem. The "mach/macho/mach-o" I'm familiar with is an executable format - used by Mac, among others. (it apparently has a "fat executable" feature, in which binaries for different architectures can be combined in one file, if I undestand it - no relation to "FAT12/16/32"...)

(4) No one talks any longer about Bourne shell, Korn shell nor
C shell. What's up with that? Is there a new standard shell, where all
those others no longer mean anything? <shrug> Almost took this
question out, but perhaps someone here can shed some light on the
topic. Perhaps someone can just mention which shell they currently
work with. Might be interesting, and it's a really easy question to
answer, right?

Sure it is! :) (famous last words) Looking through /bin, I see "a to z", pretty much: ash, bash, csh is a link to tcsh, ksh, sh is a link to bash, tcsh, and zsh. AFAIK, bash is the "usual" shell in Linux. The "Bourne again shell"... I'll bet "again" means it's got a different license, mostly. :)

I've looked through an older book that deals with Bourne, Korn
and C shells. <g> It mentions OSF/1 as the file system for Unix.
It deals with Unix as opposed to Linux.

The BSD folk are fond of saying, "Linux is like Unix, BSD *is* Unix." Might be something to it.

Best,
Frank
.



Relevant Pages

  • Re: Will Linux become as vulnerable as MS ??
    ... > beeing vulnerable to viruses. ... > that they know are executable, and execute intentionally. ... >> Linux, each distro is a little different, and even within the distro, ... > Since clicking on a script is easier than typing it's name, ...
    (comp.os.linux.security)
  • Re: So leaky that a $4 billion industry was built to protect it
    ... The owner can read and write and execute the file. ... this is similar to the "limited user rights" concept. ... Windoze on the other hand doesn't have this kind of security. ... Can't happen on a Linux system. ...
    (microsoft.public.windowsxp.general)
  • Re: [malware-list] [RFC 0/5] [TALPA] Intro to alinuxinterfaceforon access scanning
    ... If you simply allow everything to 'execute', ... fundamental approach to malware. ... from native file system to inodes currently the permissions on the ... So TALPA might save Linux ...
    (Linux-Kernel)
  • Re: virusscanner
    ... The simple fact is that a virus written for Linux could not run under ... Unlike with Windows, you could not just click on a virus and allow it to ... execute because you cannot automatically save something with execute ...
    (alt.os.linux.suse)
  • Re: Suse 9.X and the SOBER worm
    ... "Sober" is a Microsoft Visual BASIC executable attachment that arrives ... execute binary program attachments received from nobody in particular. ... local Win32 registry (if this is an MS-Windows machine), ... sake of discussion that a Linux system emulates MS-Windows's structures ...
    (alt.os.linux.suse)