flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Linux > Generating object file to link it with gcc | 
  
| Author | 
  | 
              
| 
                  
                   revolution 25 Feb 2018, 08:30 
                  To create a linkable object files the format needs to be non-executable (i.e. just ordinary ELF). And you have to declare external symbols  (extrn) for your asm code to call, and declare exported symbols (public) for your C code to call. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   vanquish 25 Feb 2018, 08:59 
                  @revolution Thank You very much. I did delete executable 3 and segment readable executable And add public keyword instead of entry I was able to assemble and run the program.
 
                  
                May I know why we should delete segment readable as well. I understood that `executable`needs to be removed since its going to be an object file, not an executable file.  | 
              |||
                  
  | 
              
| 
                  
                   revolution 25 Feb 2018, 09:34 
                  I'm not sure about the segment, but I suspect that segments are for executable files only. For linkable object you would use section. 
                  Last edited by revolution on 25 Feb 2018, 23:06; edited 1 time in total  | 
              |||
                  
  | 
              
| 
                  
                   redsock 25 Feb 2018, 20:26 
                  I did a fairly extensive writeup on C/C++ linking with my library that may be of help: https://2ton.com.au/rants_and_musings/gcc_integration.html 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   vanquish 26 Feb 2018, 02:20 
                  @redsock. Thank you for the link will check it out. 
                  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.