Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libhugeltbfs' linker uses system's linker instead of AT's #2283

Open
mscastanho opened this issue Aug 4, 2021 · 0 comments
Open

libhugeltbfs' linker uses system's linker instead of AT's #2283

mscastanho opened this issue Aug 4, 2021 · 0 comments

Comments

@mscastanho
Copy link
Contributor

libhugetlbfs provides an ld wrapper to provide the hugepage-backed text/data/bss sections feature. This wrapper looks for the underlying ld to use by calling which -a ld if the LD environment variable is not set. When using the libhugetlbfs provided by AT, this ends up using the system's ld (see the line setting LD below) instead of AT's:

$ bash -x /opt/at15.0-0-beta2/share/libhugetlbfs/ld --help 
+ '[' -n '' ']'                                                                 
+ export LD_HUGETLBFS_RECURSION=1                                        
+ LD_HUGETLBFS_RECURSION=1                                                     
+ HUGETLB_LDSCRIPT_PATH=/opt/at15.0-0-beta2/share/libhugetlbfs/ldscripts
+ '[' -z /opt/at15.0-0-beta2/share/libhugetlbfs/ldscripts ']'                 
+ CUSTOM_LDSCRIPTS=no                                                        
+ '[' -z no ']'                                                      
+ '[' -z '' ']'                                                          
++ which -a ld                                                                          
+ for x in $(which -a ld)                                                   
+ '[' /usr/bin/ld '!=' /opt/at15.0-0-beta2/share/libhugetlbfs/ld ']'              
+ LD=/usr/bin/ld                                                                   
+ break                                                                              
+ i=0                                                                                 
+ '[' -n --help ']'                                                     
+ arg=--help                                                             
+ case "$arg" in                                                                                                                                                                                                                      
+ args[$i]=--help                                                             
+ i=1                                                                                                                         
+ shift                                                            
+ '[' -n '' ']'                                                                    
+ '[' -n '' ']'                                                             
+ '[' -z '' ']'                                                                
+ '[' -n '' ']'                                                                     
++ tr -d ' '                                                                               
++ sed -n '/Supported emulations/{n;p}'                                       
++ ld -V                                                                
+ EMU=elf64lppc                                                           
+ '[' -z elf64lppc ']'                                                               
+ MB=1048576                                                            
+ case "$EMU" in                                                       
++ cat /proc/meminfo                                                      
++ grep Hugepagesize:                                                        
++ awk '{print $2}'                                                            
+ hpage_kb=                                                            
++ cat /proc/cpuinfo                                                        
++ grep MMU                                                          
++ awk '{ print $3}'                                                  
+ MMU_TYPE=Hash                                                                
+ HPAGE_SIZE=0                                                                   
+ '[' Hash == Hash ']'                                                         
+ SLICE_SIZE=268435456                                                  
+ '[' '' == slice ']'                                                   
+ /usr/bin/ld --help                                                      
Usage: /usr/bin/ld [options] file...

I hit this error while using AT's gcc with -B ${AT_DIR}/share/libhugetlbfs -Wl,--hugetlbfs-align. It ended up trying to load linker plugins from AT (containing glibc 2.33 symbols) using the system's linker, causing a crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant