[PATCH] Allow undefined symbols in shared library by default

Ed Maste emaste at freebsd.org
Wed Apr 8 11:44:01 PDT 2015


Hi shankar.easwaran, davide, rafael,

Change from D8886 with updated testcase.

(LLVM phabricator is not set to allow reopening a review, it seems.)

http://reviews.llvm.org/D8901

Files:
  lib/Core/LinkingContext.cpp
  test/elf/dynamic-undef.test

Index: lib/Core/LinkingContext.cpp
===================================================================
--- lib/Core/LinkingContext.cpp
+++ lib/Core/LinkingContext.cpp
@@ -24,7 +24,7 @@
       _warnIfCoalesableAtomsHaveDifferentCanBeNull(false),
       _warnIfCoalesableAtomsHaveDifferentLoadName(false),
       _printRemainingUndefines(true), _allowRemainingUndefines(false),
-      _logInputFiles(false), _allowShlibUndefines(false),
+      _logInputFiles(false), _allowShlibUndefines(true),
       _outputFileType(OutputFileType::Default), _nextOrdinal(0) {}
 
 LinkingContext::~LinkingContext() {}
Index: test/elf/dynamic-undef.test
===================================================================
--- test/elf/dynamic-undef.test
+++ test/elf/dynamic-undef.test
@@ -3,14 +3,18 @@
 # to create an executable and a shared library
 #
 # This test will fail because there are unresolved symbols from the shared
-# library and we are not passing --allow-shlib-undefined
+# library and we are passing --no-allow-shlib-undefined
 RUN: not lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
-RUN:   %p/Inputs/shared.so-x86-64 -o %t -e main 2> %t1
+RUN:   %p/Inputs/shared.so-x86-64 -o %t -e main --no-allow-shlib-undefined 2> %t1
 RUN: FileCheck -check-prefix=EXEC %s < %t1
 # This test will pass because of --allow-shlib-undefined
 RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
 RUN:   %p/Inputs/shared.so-x86-64 -o %t -e main --allow-shlib-undefined \
 RUN:   --defsym=__tls_get_addr=0
+# This test will pass becase --allow-shlib-undefined is the default.
+RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \
+RUN:   %p/Inputs/shared.so-x86-64 -o %t -e main \
+RUN:   --defsym=__tls_get_addr=0
 # Building shared libraries should not fail when there is a undefined symbol.
 # Test creation of shared library, this should pass because we are using
 # shared option and by default, dynamic library wouldn't create undefined atoms

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8901.23432.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150408/240d73b9/attachment.bin>


More information about the llvm-commits mailing list