# SOLVED: .c32 files in syslinux are ELF instead of COM32

## jwezel

I wanted to include a LUA interpreter into a SystemRescueCd, so I copied /usr/share/syslinux/lua.c32 and /usr/share/syslinux/liblua.c32 into the source root (./isolinux) and built the USB-stick again. Upon boot SYSLINUX complained that lua.c32 was not a COM32 format. When I checked /usr/share/syslinux/lua.c32 with the file program, it said it's an ELF file. But what's the point of that? .c32 files are supposed to be in COM32 format.

How do I make this work?

----------

## eccerr0r

What version of syslinux are you using?

Anyway it is strange, a freshly unpacked syslinux:

```
subaru:/tmp/syslinux-5.10/com32/lua/src$ file lua.c32 

lua.c32: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
```

So it came with ELF files!

But it appears to be invalid for full linux systems:

```
subaru:/tmp/syslinux-5.10/com32/lua/src$ ./lua.c32 

Segmentation fault

```

Hmm...

However syslinux-4.0.7 contains proper com32 files:

```
subaru:/tmp/syslinux-4.07/com32/lua/src$ file lua.c32 

lua.c32: COM executable (32-bit COMBOOT, relocatable)
```

Weird, upstream issue I think?  Alas I'm not a syslinux user at least on this box (yet)...

----------

## jwezel

 *eccerr0r wrote:*   

> What version of syslinux are you using?

 

I tried with 6.04.

 *Quote:*   

> However syslinux-4.0.7 contains proper com32 files:
> 
> ```
> subaru:/tmp/syslinux-4.07/com32/lua/src$ file lua.c32 
> 
> ...

 

Wow, how did you get to the idea to try 4.07? Did you have it lie around?

Anyway, I can confirm, it works. I'm going to analyze what the differences in the Makefiles are between those two versions. Maybe that way I can make changes to 6.04 to build the right .c32 programs.[/quote]

----------

## eccerr0r

I just so happened to have a copy of 4.07 around but I didn't investigate until after I found that 5.10 had the files prebuilt and continued to build ELF, so naturally I suspected it should have worked at some point and best to just look at an older version.

I had initially thought that this was an issue with ld.gold as this linker only deals with ELF, but upon building 5.10 it was bad, so something's wrong with the makefile.

Not sure why it did not trip the packagers of syslinux.  Seems like a serious bug here.

----------

## Hu

As a possibly related point, there is a comment in the ebuild:

```
# This ebuild is a departure from the old way of rebuilding everything in syslinux

# This departure is necessary since hpa doesn't support the rebuilding of anything other

# than the installers.
```

I read this to mean that the files you are examining were built once by upstream and shipped as-is, not rebuilt with the user's choice of compiler/linker.  Perhaps the Gentoo maintainer for syslinux checked only that the basic functionality still worked, but did not experiment with the advanced c32 files.

----------

## eccerr0r

Actually I think the syslinux guys dropped the ball here, I'm not sure what anyone could do with those c32 that are shipped with the tarball, regardless of architecture...

----------

## jwezel

So there is no way of building the .c32 files on Linux, a pre-built version was shipped along with the source and they discontinued that practice after version 4, it seems.   :Sad: 

----------

