@@ -1562,6 +1562,48 @@ pub fn link_pnacl_module(sess: &Session,
1562
1562
}
1563
1563
}
1564
1564
1565
+ {
1566
+ let used = sess. cstore . get_used_libraries ( ) . borrow ( ) ;
1567
+ let mut linked = already_linked_libs
1568
+ ( sess, & sess. cstore . get_used_crates ( cstore:: RequireStatic ) ) ;
1569
+ let lib_paths = pnacl_lib_paths ( sess) ;
1570
+
1571
+ // Ignore all messages about invalid debug versions (toolchain libraries
1572
+ // cause an abundance of these):
1573
+ unsafe {
1574
+ llvm:: LLVMRustSetContextIgnoreDebugMetadataVersionDiagnostics ( trans. context ) ;
1575
+ }
1576
+
1577
+ ( * used)
1578
+ . iter ( )
1579
+ . filter_map ( |& ( ref lib, kind) | {
1580
+ link_attrs_filter ( sess, lib, kind, & mut linked, & lib_paths)
1581
+ } )
1582
+ . fold ( ( ) , |( ) , ( l, p) : ( String , Path ) | {
1583
+ use llvm:: archive_ro:: ArchiveRO ;
1584
+ debug ! ( "processing archive `{}`" , p. display( ) ) ;
1585
+ let archive = ArchiveRO :: open ( & p)
1586
+ . expect ( "maybe invalid archive?" ) ;
1587
+ archive. foreach_child ( |name, bc| {
1588
+ debug ! ( "processing object `{}`" , name) ;
1589
+ let name_path = Path :: new ( name) ;
1590
+ let name_ext_str = name_path. extension_str ( ) ;
1591
+ if name_ext_str == Some ( "o" ) || name_ext_str == Some ( "obj" ) {
1592
+ link_buf_into_module ( sess,
1593
+ trans. context ,
1594
+ Some ( llmod) ,
1595
+ l. as_slice ( ) ,
1596
+ bc. as_slice ( ) ) ;
1597
+ }
1598
+ } ) ;
1599
+ } ) ;
1600
+
1601
+ unsafe {
1602
+ llvm:: LLVMRustResetContextIgnoreDebugMetadataVersionDiagnostics ( trans. context ) ;
1603
+ }
1604
+ }
1605
+
1606
+
1565
1607
// Some globals in the bitcode from PNaCl have what is considered invalid
1566
1608
// linkage in our LLVM (their LLVM is old). Fortunately, all linkage types
1567
1609
// get stripped later, so it's safe to just ignore them all.
0 commit comments