[llvm-commits] [llvm] r67142 - in /llvm/trunk: lib/Target/X86/X86Instr64bit.td test/CodeGen/X86/call-imm.ll

Török Edwin edwintorok at gmail.com
Wed Mar 18 06:45:23 PDT 2009


On 2009-03-18 15:21, Mike Stump wrote:
> On Mar 17, 2009, at 7:17 PM, Chris Lattner wrote:
>   
>> Why does "call <some random address>" imply that the address is in the
>> text segment?
>>     
>
> I don't believe it does.  However, all executable code is known to be  
> in the first 2GB, and I think the point was that call would use a  
> label associated with executable code.

libraries are loaded above 2GB here (Debian Linux 2.6.28.7), here is a
sample /proc/self/maps:

00400000-0040d000 r-xp 00000000 09:03 130344                            
/bin/cat
0060d000-0060e000 rw-p 0000d000 09:03 130344                            
/bin/cat
01d8f000-01db0000 rw-p 01d8f000 00:00 0                                 
[heap]
7fa877213000-7fa87735c000 r-xp 00000000 09:03 262077                    
/lib/libc-2.9.so
7fa87735c000-7fa87755c000 ---p 00149000 09:03 262077                    
/lib/libc-2.9.so
7fa87755c000-7fa877560000 r--p 00149000 09:03 262077                    
/lib/libc-2.9.so
7fa877560000-7fa877561000 rw-p 0014d000 09:03 262077                    
/lib/libc-2.9.so
7fa877561000-7fa877566000 rw-p 7fa877561000 00:00 0
7fa877566000-7fa877583000 r-xp 00000000 09:03 262076                    
/lib/ld-2.9.so
7fa877618000-7fa87775b000 r--p 00000000 fd:00 3841                      
/usr/lib/locale/locale-archive
7fa87775b000-7fa87775d000 rw-p 7fa87775b000 00:00 0
7fa87777f000-7fa877782000 rw-p 7fa87777f000 00:00 0
7fa877782000-7fa877783000 r--p 0001c000 09:03 262076                    
/lib/ld-2.9.so
7fa877783000-7fa877784000 rw-p 0001d000 09:03 262076                    
/lib/ld-2.9.so
7fff7f76f000-7fff7f784000 rw-p 7ffffffea000 00:00 0                     
[stack]
7fff7f7ff000-7fff7f800000 r-xp 7fff7f7ff000 00:00 0                     
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                 
[vsyscall]

According to the gcc docs the small code model is the default.
Maybe I am missing something, but how can this work, even for gcc?
Or does the linker do the neccessary adjustments to the code here?

Also code for -mcmodel=kernel will surely not be in first 2Gb.

Best regards,
--Edwin



More information about the llvm-commits mailing list