32-Bit Assembling/Linking Using NASM & CC on FreeBSD 14.0-MATE 1.8.1-GhostBSD 64-bit

Post your general questions or comments about GhostBSD here!
Post Reply
alCoPaUL
Posts: 3
Joined: Thu Jun 06, 2024 1:17 pm
Contact:

32-Bit Assembling/Linking Using NASM & CC on FreeBSD 14.0-MATE 1.8.1-GhostBSD 64-bit

Post by alCoPaUL »

hey.. this is my first post..

i just wanna know if i can install 32-bit C libs from FreeBSD/GhostBSD that go with CC-Clang compiler to make the code below..

Code: Select all

;
; pwn5_i386four.asm
;
; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]
; 6/25/2023 NYC
;
; nasm <dash>f elf32 pwn5_i386four.asm
; cc <dash>m32 <dash>o pwn5_i386four pwn5_i386four.o
;
;
global main
extern printf
section .text
main:
enter 0,0
mov al,10
mov bl,45
z:lea edx,[a]
mov cx,536
r:cmp byte [edx],bl
je s
jmp u
s:mov byte [edx],al
u:inc edx
dec cx
cmp cx,0
jnz r
push a
push i
call printf
mov al,10
cmp bl,45
xchg al,bl
je z
push x
push i
call printf
leave
ret
section .data
x:db 2Ch,32h,37h,68h,2Ch,30h,0
i:db 25h,73h,0
a:db ';-; pwn5_i386four.asm-;-; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]-; 6/25/2023 NYC-;-; nasm <dash>f elf32 pwn5_i386four.asm-; cc <dash>m32 <dash>o pwn5_i386four pwn5_i386four.o-;-;-global main-extern printf-section .text-main:-enter 0,0-mov al,10-mov bl,45-z:lea edx,[a]-mov cx,536-r:cmp byte [edx],bl-je s-jmp u-s:mov byte [edx],al-u:inc edx-dec cx-cmp cx,0-jnz r-push a-push i-call printf-mov al,10-cmp bl,45-xchg al,bl-je z-push x-push i-call printf-leave-ret-section .data-x:db 2Ch,32h,37h,68h,2Ch,30h,0-i:db 25h,73h,0-a:db ',27h,0
because currently, making this will make cc throw out error msgs "ld: lgcc is missing"

i was trying to make this because i've read that GhostBSD64 can run 32-bit files natively..

and the code below, i can make and run with no problems whatsoever..

Code: Select all

;
; quineB_S_D.asm
;
; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]
; June 21, 2023 NYC
;
; nasm <dash>f elf64 quineB_S_D.asm
; cc <dash>o quineB_S_D quineB_S_D.o
;
global main
extern printf
section .text
main:push rbx
mov cl,10
mov bl,45
z:lea r9,[a]
mov dx,610
r:cmp byte[r9],bl
je s
jmp u
s:mov byte[r9],cl
u:inc r9
dec dx
cmp dx,0
jnz r
lea rdi,[i]
lea rax,[a]
mov rsi,rax
xor rax,rax
call printf wrt ..plt
mov cl,10
cmp bl,45
xchg cl,bl
je z
lea rdi,[i]
lea rax,[x]
mov rsi,rax
xor rax,rax
call printf wrt ..plt
pop rbx
ret
section .data
default rel
x:db 2Ch,32h,37h,68h,2Ch,30h,0
i:db 25h,73h,0
a:db ';-; quineB_S_D.asm-;-; by alCoPaUL [GIMO][As][aBrA][NPA][b8][BCVG][rRlf]-; June 21, 2023 NYC-;-; nasm <dash>f elf64 quineB_S_D.asm-; cc <dash>o quineB_S_D quineB_S_D.o-;-global main-extern printf-section .text-main:push rbx-mov cl,10-mov bl,45-z:lea r9,[a]-mov dx,610-r:cmp byte[r9],bl-je s-jmp u-s:mov byte[r9],cl-u:inc r9-dec dx-cmp dx,0-jnz r-lea rdi,[i]-lea rax,[a]-mov rsi,rax-xor rax,rax-call printf wrt ..plt-mov cl,10-cmp bl,45-xchg cl,bl-je z-lea rdi,[i]-lea rax,[x]-mov rsi,rax-xor rax,rax-call printf wrt ..plt-pop rbx-ret-section .data-default rel-x:db 2Ch,32h,37h,68h,2Ch,30h,0-i:db 25h,73h,0-a:db ',27h,0
i just need the cc/clang/llvm 32bitdevellib packages, if there are any, for me to develop the 32 bit code under GhostBSD64 without complaining that a necessary lib file is missing..

(and please no files with GNU attached on it..)

thank you...

~ alCoPaUL[GIMO][GOTH][b8]
chadbsd
Posts: 31
Joined: Thu Oct 05, 2023 8:53 pm

Re: 32-Bit Assembling/Linking Using NASM & CC on FreeBSD 14.0-MATE 1.8.1-GhostBSD 64-bit

Post by chadbsd »

sudo pkg install os-generic-userland-devtools
alCoPaUL
Posts: 3
Joined: Thu Jun 06, 2024 1:17 pm
Contact:

Re: 32-Bit Assembling/Linking Using NASM & CC on FreeBSD 14.0-MATE 1.8.1-GhostBSD 64-bit

Post by alCoPaUL »

i ran that command on the terminal and it says the OS has the latest version of that package..

and yet the error message still persists..

the 32 bit code assembles, links and runs on native 32-bit version of GhostBSD and looks like i just need the proper 32 bit build libs on the 64 bit version..

i tried other way to build that, using nasm and ld, assembles and links fine but has risque -switches and it just goes segfault, on 64-bit..
alCoPaUL
Posts: 3
Joined: Thu Jun 06, 2024 1:17 pm
Contact:

Re: 32-Bit Assembling/Linking Using NASM & CC on FreeBSD 14.0-MATE 1.8.1-GhostBSD 64-bit

Post by alCoPaUL »

My GhostBSD 64bit Installation is 24.04.1 by the way..
Post Reply