News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

HLA on 64-bit Linux?

Started by TmX, July 30, 2011, 06:27:03 PM

Previous topic - Next topic

TmX

I tried to build this hello world using HLA v2.16)

The output was:
Quoteld: i386 architecture of input file `helloWorld.o' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_hwExcept.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_Raise.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_buildexcepts.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_InstallSignals.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_abstract.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_excepts.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(ex_dfltexcept.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(so_puts.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(str_catu32.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(str_cath32.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(str_cat2.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(str_catd.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(str_cats.o)' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `/usr/hla/hlalib/hlalib.a(str_catu64size.o)' is incompatible with i386:x86-64 output
...

So, HLA won't run on 64-bit Linux?

Twister

I am trying it for myself and I am getting this message:

sorry, unimplemented: 64-bit mode not compiled in

I know it is off the topic. I'm not sure how to I can get the GCC cross-compiler to enable it.

I went to makefile.linux and added in -m64 flag for the compiler. If that doesn't work try adding in the -fPIC flag

Smartnow

Have the same Erorrs as TmX, mine Host is 64-bit and HLA is 32 bit  :(

I have this downloaded and extracted

http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/HighLevelAsm/HLAv2.16/linux.hlasrc.tar.gz

tar xfvz linux.hlasrc.tar.gz

HLA, High Level Assembly/Source/usr/hla/hlasrc/trunk

What muss I make there with which command is to compile

gcc -m64 *.c

don't works. The best that is there a 64 bit Version, this is announced, but not released. I like HLA and wish to use it.

Regards.

DarkWolf

HLA produces 32 bit gas assembler on linux.

I can get as to compile to object code but ld WILL NOT LINK.

You need to use -m32 with gcc which tells gcc to compile into 32 bit executable.
But remember it is gas code not gcc; so you will have to wrap it in the c code gcc expects yourself (gcc can compile gas code but not directly you have to wrap it first)

HLA does not use gcc

HLA will call as and ld ; which don't work.

See my crap I have been having with sevag's libraries.

ld also cannot find the libraries correctly. it will append /lib to all directories you tell it to search and append .a or .so to all libraries you name. This behavior is not document and they won't tell you it did this.

You can specifiy the bit width and archtype in as options "-A archtype" and "--32" (look in man page)
ld need some finagling but it doesn't work anyway. (you could try emulation "-m elf_386" but it won't work.)

do not try -m32 with ld, it doesn't work ld has no such option (somewhere on the net I found an idiot that suggested that).
--
Where's there's smoke, There are mirrors.
Give me Free as in Freedom not Speech or Beer.
Thank You and Welcome to the Internet.

euphrosyne

I think I finally got an answer to this problem:

The thing is; on x64 systems ld tries to produce x64 output at its default. Since at its current state hla outputs x86 compatible code and provides x86 libraries, ld simply prints those irritating lines.

The solution resides in a very cleverly figured switch of hla; the "-l". What this switch does is simply to pass its argument to ld. But, if you try to pass it in a "hla -l -melf_i386 -v helloWorld" format hla will prompt an error since it doesn't have a "-m" switch. As it is stated in hla's help; this switch's argument needs to be in the "-lxxxxx" format where "xxxxx" corresponds to the linker parameter. Similarly a command as "hla -lm elf_i386 -v helloWorld" is false, because the "elf_i386" part of it is recognized as an input file by the hla. Again, "hla -l-melf_i386 -v helloWorld" also doesn't function as intended because this time ld will be angry since it doesn't recognize the "option '--melf_i386'". The reason to it is that the argument of this switch is passed to ld with a minus sign prefixed to it.

And about this "-melf_i386". "-m" switch of ld configures the "emulation mode". To be honest I don't know what this means accurately but it does work!

The correct command is;

<user>@<user>-GA-770TA-UD3:/usr/local/samples/hla$ hla -lmelf_i386 -v helloWorld

Cheers.

TmX

Hello euphrosyne,

Yes, "hla -lmelf_i386 -v helloworld" does the job.

Quote------------
HLA Back Engine Object code formatter

HLABE compiling 'helloworld.hla' to 'helloworld.o'
Optimization passes: 3+2
HLA (High Level Assembler) Parser
use '-license' to view license information
Version 2.16 build 4409 (prototype)
-test active
File: helloworld.hla
Output Path: ""
hlainc Path: "/usr/hla/include"
hlaauxinc Path: ""
Compiler generating code for Linux OS
Back-end assembler: HLABE
Language Level: high

Assembling "helloworld.hla" to "helloworld.o"
HLAPARSE assembly complete, 48984 lines,   0.166 seconds,  294907 lines/second
HLA (High Level Assembler)
Use '-license' to see licensing information.
Version 2.16 build 4409 (prototype)
ELF output
OBJ output using HLA Back Engine
-test active

HLA Lib Path:     /usr/hla/hlalib/hlalib.a
HLA include path: /usr/hla/include
HLA temp path:   
Files:
1: helloworld.hla

Compiling 'helloworld.hla' to 'helloworld.o'
using command line:
[hlaparse -LINUX -level=high  -v -test "helloworld.hla"]

----------------------
----------------------
Linking via [ld   -melf_i386   -o "helloworld"   "helloworld.o" "/usr/hla/hlalib/hlalib.a"]

========================================
    HLA Compilation Complete
========================================

:U

stanks

not on a few latest versions fo ubuntu....i get error from ld
-lpthread option not recognized

DarkWolf

stanks:

lpthread.so is used for threaded apps.
If you don't need it turn that option off and see if ld will link.

Tim:
What is your distro and version of OS.
Whenver I try -m elf_i386 for ld it fails and tells me that mode isn't recognized (or some similar error).

If you can what version of as and ld does your distro use ?
uname -a

Linux node1 2.6.24-30-generic #1 SMP Tue Nov 8 13:36:55 UTC 2011 i686 GNU/Linux

That should be Ubuntu 8.04 LTS, I thought uname would say that. Or Xubuntu 8.04 LTS in the case of my 64bit laptop.

as -V

GNU assembler version 2.18.0 (i486-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.18.0.20080103


ld -V

GNU ld (GNU Binutils for Ubuntu) 2.18.0.20080103
  Supported emulations:
   elf_i386
   i386linux
   elf_x86_64


Please ?
(Sorry my examples above are 32 bit my 64 bit machine is not on the net at the moment, but should be similar they are two editions of the same version of (X)Ubuntu)

My ld indicates there is whitespace between emulation flag and platform:
From ld --help:

  --sysroot=<DIRECTORY>       Override the default sysroot location
  -m EMULATION                Set emulation
  -M, --print-map             Print map file on standard output


Is there a difference if you have the whitespace there or not ?
Or would you know if you had to install a library package for that emulation mode (like binutil-multiarch or something) ?
Also does ld give you errors when you try to use an external library. Like when compiling sevag's hidelib or guilib ?
--
Where's there's smoke, There are mirrors.
Give me Free as in Freedom not Speech or Beer.
Thank You and Welcome to the Internet.

stanks

did you try with -melf_i386 (no space between -m and elf_i386)

DarkWolf

Quote from: stanks on January 15, 2012, 05:05:22 PM
did you try with -melf_i386 (no space between -m and elf_i386)

I'll check again but I don't think my system likes that.
I think it fails to detect the mode I set emulation to if there is no space.
But since it doesn't work anyway, because it complains about the mode not being available or something.

Still doesn't fix the problem I have with manual setting the path to libraries, ld still has issues with appending "/lib" to the end of all paths and still can't turn off that behavior. Or it's behavior to append ".so" or ".a" to the name of library files.
--
Where's there's smoke, There are mirrors.
Give me Free as in Freedom not Speech or Beer.
Thank You and Welcome to the Internet.