pacman128 / pcasm

PC Assembly language book
160 stars 34 forks source link

Adding `-m32` option to gcc under Linux #10

Open Saldef opened 1 year ago

Saldef commented 1 year ago

1- It will not successfully compile under 64-bit architecture if the -m32 is not added. I guess (not sure though) the reason is a change in GCC where they are no longer allowing 32-bit absolute addressing on Linux x86_64. Also, One needs to install gcc-multilib and g++-multilib packages before-head, because the 32-bit version of libgcc isn't available on the 64-bit gcc. This might also need to be added in the LaTex version of book, sections 1.4.4 and 1.4.5

2- One more thing, assembling the asm_io.asm was not mentioned in section 1.4.3, although it is necessary, and it has a caveat where one needs to add the inline macro -d ELF_TYPE, this would only be noticed when reading the comments of the asm_io.asm file. For a beginner, and for his/her first code. this will hinder a bit, and distract the learner on a quest on the web trying to find a solutions.

pacman128 commented 1 year ago

Thanks for your pull request, but this is not the correct fix (or at least an incomplete one). There's a Linux Makefile that builds everything (with the -m32 flag). That is probably what needs to be documented. You're right that it would be a good idea to specify how to set up the 32-bit environment on a 64-bit system.

The Makefile will also build the asm_io object file.