diff --git a/Changelog.md b/Changelog.md
index 002276b6d..8ea4e635b 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -19,6 +19,7 @@ Compiler Features:
 
 
 Bugfixes:
+ * Command Line Interface: Reject duplicate libraries in ``--libraries`` option instead of arbitrarily choosing one.
  * SMTChecker: Fix lack of reporting potential violations when using only the CHC engine.
  * SMTChecker: Fix internal error on conversion from string literal to byte.
  * SMTChecker: Fix internal error when using tuples of rational literals inside the conditional operator.
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index e1c98dcef..1c1061535 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -664,9 +664,16 @@ bool CommandLineInterface::parseLibraryOption(string const& _input)
 				serr() << "Colon separator missing in library address specifier \"" << lib << "\"" << endl;
 				return false;
 			}
+
 			string libName(lib.begin(), lib.begin() + static_cast<ptrdiff_t>(colon));
-			string addrString(lib.begin() + static_cast<ptrdiff_t>(colon) + 1, lib.end());
 			boost::trim(libName);
+			if (m_libraries.count(libName))
+			{
+				serr() << "Address specified more than once for library \"" << libName << "\"." << endl;
+				return false;
+			}
+
+			string addrString(lib.begin() + static_cast<ptrdiff_t>(colon) + 1, lib.end());
 			boost::trim(addrString);
 			if (addrString.substr(0, 2) == "0x")
 				addrString = addrString.substr(2);
diff --git a/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/args b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/args
new file mode 100644
index 000000000..54be2478a
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/args
@@ -0,0 +1 @@
+--strict-assembly --libraries library.sol:L:0x1234567890123456789012345678901234567890,library.sol:L:0x0987654321098765432109876543210987654321
diff --git a/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/err b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/err
new file mode 100644
index 000000000..973e9e06e
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/err
@@ -0,0 +1 @@
+Address specified more than once for library "library.sol:L".
diff --git a/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/exit b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/exit
new file mode 100644
index 000000000..d00491fd7
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/exit
@@ -0,0 +1 @@
+1
diff --git a/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/input.yul b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/input.yul
new file mode 100644
index 000000000..c4dda1ceb
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_duplicate_library_name/input.yul
@@ -0,0 +1,5 @@
+object "a" {
+    code {
+        let addr := linkersymbol("library.sol:L")
+    }
+}
diff --git a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/args b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/args
new file mode 100644
index 000000000..a424a337a
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/args
@@ -0,0 +1 @@
+--strict-assembly --libraries library1.sol:L:0x1111111111111111111111111111111111111111,library2.sol:L:0x2222222222222222222222222222222222222222
diff --git a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/err b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/err
new file mode 100644
index 000000000..014a1178f
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/err
@@ -0,0 +1 @@
+Warning: Yul is still experimental. Please use the output with care.
diff --git a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/input.yul b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/input.yul
new file mode 100644
index 000000000..acb612857
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/input.yul
@@ -0,0 +1,6 @@
+object "a" {
+    code {
+        let addr1 := linkersymbol("library1.sol:L")
+        let addr2 := linkersymbol("library2.sol:L")
+    }
+}
diff --git a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output
new file mode 100644
index 000000000..80696c594
--- /dev/null
+++ b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output
@@ -0,0 +1,22 @@
+
+======= linking_strict_assembly_same_library_name_different_files/input.yul (EVM) =======
+
+Pretty printed source:
+object "a" {
+    code {
+        let addr1 := linkersymbol("library1.sol:L")
+        let addr2 := linkersymbol("library2.sol:L")
+    }
+}
+
+
+Binary representation:
+7311111111111111111111111111111111111111117322222222222222222222222222222222222222225050
+
+Text representation:
+  linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec")
+    /* "linking_strict_assembly_same_library_name_different_files/input.yul":32:75   */
+  linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f")
+    /* "linking_strict_assembly_same_library_name_different_files/input.yul":22:133   */
+  pop
+  pop