diff --git a/src/OSspecific/POSIX/printStack.C b/src/OSspecific/POSIX/printStack.C
index eb98c5338fad242be0985bfb1182358efa54d555..4d6fdab47a41ffb0a36e8c851212fbd3945a785d 100644
--- a/src/OSspecific/POSIX/printStack.C
+++ b/src/OSspecific/POSIX/printStack.C
@@ -115,13 +115,13 @@ void printSourceFileAndLine
     uintptr_t address = uintptr_t(addr);
     word myAddress = addressToWord(address);
 
-    if
-    (
-        filename.hasExt("so")
-        #ifdef darwin
-     || filename.hasExt("dylib")
-        #endif
-    )
+    // Can use relative addresses for executables and libraries with the
+    // Darwin addr2line implementation.
+    // On other systems (Linux), only use relative addresses for libraries.
+
+    #ifndef darwin
+    if (filename.hasExt("so"))
+    #endif
     {
         // Convert address into offset into dynamic library
         uintptr_t offset = uintptr_t(info->dli_fbase);