prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Revisit _extra_compile_args in build_openssl.py
  Now that we're dropping 1.0.2 in #5511, it's time to review that.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/_cffi_src/build_openssl.py`
  Content:
  ```
  1 # This file is dual licensed under the terms of the Apache License, Version
  2 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3 # for complete details.
  4 
  5 from __future__ import absolute_import, division, print_function
  6 
  7 import os
  8 import sys
  9 from distutils import dist
  10 from distutils.ccompiler import get_default_compiler
  11 from distutils.command.config import config
  12 
  13 from _cffi_src.utils import (
  14     build_ffi_for_binding,
  15     compiler_type,
  16     extra_link_args,
  17 )
  18 
  19 
  20 def _get_openssl_libraries(platform):
  21     if os.environ.get("CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS", None):
  22         return []
  23     # OpenSSL goes by a different library name on different operating systems.
  24     if platform == "win32" and compiler_type() == "msvc":
  25         return [
  26             "libssl",
  27             "libcrypto",
  28             "advapi32",
  29             "crypt32",
  30             "gdi32",
  31             "user32",
  32             "ws2_32",
  33         ]
  34     else:
  35         # darwin, linux, mingw all use this path
  36         # In some circumstances, the order in which these libs are
  37         # specified on the linker command-line is significant;
  38         # libssl must come before libcrypto
  39         # (https://marc.info/?l=openssl-users&m=135361825921871)
  40         # -lpthread required due to usage of pthread an potential
  41         # existance of a static part containing e.g. pthread_atfork
  42         # (https://github.com/pyca/cryptography/issues/5084)
  43         if sys.platform == "zos":
  44             return ["ssl", "crypto"]
  45         else:
  46             return ["ssl", "crypto", "pthread"]
  47 
  48 
  49 def _extra_compile_args(platform):
  50     """
  51     We set -Wconversion args here so that we only do Wconversion checks on the
  52     code we're compiling and not on cffi itself (as passing -Wconversion in
  53     CFLAGS would do). We set no error on sign conversion because some
  54     function signatures in OpenSSL have changed from long -> unsigned long
  55     in the past. Since that isn't a precision issue we don't care.
  56     When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can
  57     revisit this.
  58     """
  59     # make sure the compiler used supports the flags to be added
  60     is_gcc = False
  61     if get_default_compiler() == "unix":
  62         d = dist.Distribution()
  63         cmd = config(d)
  64         cmd._check_compiler()
  65         is_gcc = (
  66             "gcc" in cmd.compiler.compiler[0]
  67             or "clang" in cmd.compiler.compiler[0]
  68         )
  69     if is_gcc or not (
  70         platform in ["win32", "hp-ux11", "sunos5"]
  71         or platform.startswith("aix")
  72     ):
  73         return ["-Wconversion", "-Wno-error=sign-conversion"]
  74     else:
  75         return []
  76 
  77 
  78 ffi = build_ffi_for_binding(
  79     module_name="_openssl",
  80     module_prefix="_cffi_src.openssl.",
  81     modules=[
  82         # This goes first so we can define some cryptography-wide symbols.
  83         "cryptography",
  84         "aes",
  85         "asn1",
  86         "bignum",
  87         "bio",
  88         "cmac",
  89         "conf",
  90         "crypto",
  91         "ct",
  92         "dh",
  93         "dsa",
  94         "ec",
  95         "ecdh",
  96         "ecdsa",
  97         "engine",
  98         "err",
  99         "evp",
  100         "fips",
  101         "hmac",
  102         "nid",
  103         "objects",
  104         "ocsp",
  105         "opensslv",
  106         "osrandom_engine",
  107         "pem",
  108         "pkcs12",
  109         "rand",
  110         "rsa",
  111         "ssl",
  112         "x509",
  113         "x509name",
  114         "x509v3",
  115         "x509_vfy",
  116         "pkcs7",
  117         "callbacks",
  118     ],
  119     libraries=_get_openssl_libraries(sys.platform),
  120     # These args are passed here so that we only do Wconversion checks on the
  121     # code we're compiling and not on cffi itself (as passing -Wconversion in
  122     # CFLAGS would do). We set no error on sign convesrion because some
  123     # function signatures in OpenSSL have changed from long -> unsigned long
  124     # in the past. Since that isn't a precision issue we don't care.
  125     # When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can
  126     # revisit this.
  127     extra_compile_args=_extra_compile_args(sys.platform),
  128     extra_link_args=extra_link_args(compiler_type()),
  129 )
  130
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py
  --- a/src/_cffi_src/build_openssl.py
  +++ b/src/_cffi_src/build_openssl.py
  @@ -51,10 +51,9 @@
       We set -Wconversion args here so that we only do Wconversion checks on the
       code we're compiling and not on cffi itself (as passing -Wconversion in
       CFLAGS would do). We set no error on sign conversion because some
  -    function signatures in OpenSSL have changed from long -> unsigned long
  -    in the past. Since that isn't a precision issue we don't care.
  -    When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can
  -    revisit this.
  +    function signatures in LibreSSL differ from OpenSSL have changed on long
  +    vs. unsigned long in the past. Since that isn't a precision issue we don't
  +    care.
       """
       # make sure the compiler used supports the flags to be added
       is_gcc = False
  @@ -117,13 +116,6 @@
           "callbacks",
       ],
       libraries=_get_openssl_libraries(sys.platform),
  -    # These args are passed here so that we only do Wconversion checks on the
  -    # code we're compiling and not on cffi itself (as passing -Wconversion in
  -    # CFLAGS would do). We set no error on sign convesrion because some
  -    # function signatures in OpenSSL have changed from long -> unsigned long
  -    # in the past. Since that isn't a precision issue we don't care.
  -    # When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can
  -    # revisit this.
       extra_compile_args=_extra_compile_args(sys.platform),
       extra_link_args=extra_link_args(compiler_type()),
   )
  
verification_info: {"golden_diff": "diff --git a/src/_cffi_src/build_openssl.py b/src/_cffi_src/build_openssl.py\n--- a/src/_cffi_src/build_openssl.py\n+++ b/src/_cffi_src/build_openssl.py\n@@ -51,10 +51,9 @@\n     We set -Wconversion args here so that we only do Wconversion checks on the\n     code we're compiling and not on cffi itself (as passing -Wconversion in\n     CFLAGS would do). We set no error on sign conversion because some\n-    function signatures in OpenSSL have changed from long -> unsigned long\n-    in the past. Since that isn't a precision issue we don't care.\n-    When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can\n-    revisit this.\n+    function signatures in LibreSSL differ from OpenSSL have changed on long\n+    vs. unsigned long in the past. Since that isn't a precision issue we don't\n+    care.\n     \"\"\"\n     # make sure the compiler used supports the flags to be added\n     is_gcc = False\n@@ -117,13 +116,6 @@\n         \"callbacks\",\n     ],\n     libraries=_get_openssl_libraries(sys.platform),\n-    # These args are passed here so that we only do Wconversion checks on the\n-    # code we're compiling and not on cffi itself (as passing -Wconversion in\n-    # CFLAGS would do). We set no error on sign convesrion because some\n-    # function signatures in OpenSSL have changed from long -> unsigned long\n-    # in the past. Since that isn't a precision issue we don't care.\n-    # When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can\n-    # revisit this.\n     extra_compile_args=_extra_compile_args(sys.platform),\n     extra_link_args=extra_link_args(compiler_type()),\n )\n", "issue": "Revisit _extra_compile_args in build_openssl.py\nNow that we're dropping 1.0.2 in #5511, it's time to review that.\n", "before_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport os\nimport sys\nfrom distutils import dist\nfrom distutils.ccompiler import get_default_compiler\nfrom distutils.command.config import config\n\nfrom _cffi_src.utils import (\n    build_ffi_for_binding,\n    compiler_type,\n    extra_link_args,\n)\n\n\ndef _get_openssl_libraries(platform):\n    if os.environ.get(\"CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS\", None):\n        return []\n    # OpenSSL goes by a different library name on different operating systems.\n    if platform == \"win32\" and compiler_type() == \"msvc\":\n        return [\n            \"libssl\",\n            \"libcrypto\",\n            \"advapi32\",\n            \"crypt32\",\n            \"gdi32\",\n            \"user32\",\n            \"ws2_32\",\n        ]\n    else:\n        # darwin, linux, mingw all use this path\n        # In some circumstances, the order in which these libs are\n        # specified on the linker command-line is significant;\n        # libssl must come before libcrypto\n        # (https://marc.info/?l=openssl-users&m=135361825921871)\n        # -lpthread required due to usage of pthread an potential\n        # existance of a static part containing e.g. pthread_atfork\n        # (https://github.com/pyca/cryptography/issues/5084)\n        if sys.platform == \"zos\":\n            return [\"ssl\", \"crypto\"]\n        else:\n            return [\"ssl\", \"crypto\", \"pthread\"]\n\n\ndef _extra_compile_args(platform):\n    \"\"\"\n    We set -Wconversion args here so that we only do Wconversion checks on the\n    code we're compiling and not on cffi itself (as passing -Wconversion in\n    CFLAGS would do). We set no error on sign conversion because some\n    function signatures in OpenSSL have changed from long -> unsigned long\n    in the past. Since that isn't a precision issue we don't care.\n    When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can\n    revisit this.\n    \"\"\"\n    # make sure the compiler used supports the flags to be added\n    is_gcc = False\n    if get_default_compiler() == \"unix\":\n        d = dist.Distribution()\n        cmd = config(d)\n        cmd._check_compiler()\n        is_gcc = (\n            \"gcc\" in cmd.compiler.compiler[0]\n            or \"clang\" in cmd.compiler.compiler[0]\n        )\n    if is_gcc or not (\n        platform in [\"win32\", \"hp-ux11\", \"sunos5\"]\n        or platform.startswith(\"aix\")\n    ):\n        return [\"-Wconversion\", \"-Wno-error=sign-conversion\"]\n    else:\n        return []\n\n\nffi = build_ffi_for_binding(\n    module_name=\"_openssl\",\n    module_prefix=\"_cffi_src.openssl.\",\n    modules=[\n        # This goes first so we can define some cryptography-wide symbols.\n        \"cryptography\",\n        \"aes\",\n        \"asn1\",\n        \"bignum\",\n        \"bio\",\n        \"cmac\",\n        \"conf\",\n        \"crypto\",\n        \"ct\",\n        \"dh\",\n        \"dsa\",\n        \"ec\",\n        \"ecdh\",\n        \"ecdsa\",\n        \"engine\",\n        \"err\",\n        \"evp\",\n        \"fips\",\n        \"hmac\",\n        \"nid\",\n        \"objects\",\n        \"ocsp\",\n        \"opensslv\",\n        \"osrandom_engine\",\n        \"pem\",\n        \"pkcs12\",\n        \"rand\",\n        \"rsa\",\n        \"ssl\",\n        \"x509\",\n        \"x509name\",\n        \"x509v3\",\n        \"x509_vfy\",\n        \"pkcs7\",\n        \"callbacks\",\n    ],\n    libraries=_get_openssl_libraries(sys.platform),\n    # These args are passed here so that we only do Wconversion checks on the\n    # code we're compiling and not on cffi itself (as passing -Wconversion in\n    # CFLAGS would do). We set no error on sign convesrion because some\n    # function signatures in OpenSSL have changed from long -> unsigned long\n    # in the past. Since that isn't a precision issue we don't care.\n    # When we drop support for CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 we can\n    # revisit this.\n    extra_compile_args=_extra_compile_args(sys.platform),\n    extra_link_args=extra_link_args(compiler_type()),\n)\n", "path": "src/_cffi_src/build_openssl.py"}], "after_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport os\nimport sys\nfrom distutils import dist\nfrom distutils.ccompiler import get_default_compiler\nfrom distutils.command.config import config\n\nfrom _cffi_src.utils import (\n    build_ffi_for_binding,\n    compiler_type,\n    extra_link_args,\n)\n\n\ndef _get_openssl_libraries(platform):\n    if os.environ.get(\"CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS\", None):\n        return []\n    # OpenSSL goes by a different library name on different operating systems.\n    if platform == \"win32\" and compiler_type() == \"msvc\":\n        return [\n            \"libssl\",\n            \"libcrypto\",\n            \"advapi32\",\n            \"crypt32\",\n            \"gdi32\",\n            \"user32\",\n            \"ws2_32\",\n        ]\n    else:\n        # darwin, linux, mingw all use this path\n        # In some circumstances, the order in which these libs are\n        # specified on the linker command-line is significant;\n        # libssl must come before libcrypto\n        # (https://marc.info/?l=openssl-users&m=135361825921871)\n        # -lpthread required due to usage of pthread an potential\n        # existance of a static part containing e.g. pthread_atfork\n        # (https://github.com/pyca/cryptography/issues/5084)\n        if sys.platform == \"zos\":\n            return [\"ssl\", \"crypto\"]\n        else:\n            return [\"ssl\", \"crypto\", \"pthread\"]\n\n\ndef _extra_compile_args(platform):\n    \"\"\"\n    We set -Wconversion args here so that we only do Wconversion checks on the\n    code we're compiling and not on cffi itself (as passing -Wconversion in\n    CFLAGS would do). We set no error on sign conversion because some\n    function signatures in LibreSSL differ from OpenSSL have changed on long\n    vs. unsigned long in the past. Since that isn't a precision issue we don't\n    care.\n    \"\"\"\n    # make sure the compiler used supports the flags to be added\n    is_gcc = False\n    if get_default_compiler() == \"unix\":\n        d = dist.Distribution()\n        cmd = config(d)\n        cmd._check_compiler()\n        is_gcc = (\n            \"gcc\" in cmd.compiler.compiler[0]\n            or \"clang\" in cmd.compiler.compiler[0]\n        )\n    if is_gcc or not (\n        platform in [\"win32\", \"hp-ux11\", \"sunos5\"]\n        or platform.startswith(\"aix\")\n    ):\n        return [\"-Wconversion\", \"-Wno-error=sign-conversion\"]\n    else:\n        return []\n\n\nffi = build_ffi_for_binding(\n    module_name=\"_openssl\",\n    module_prefix=\"_cffi_src.openssl.\",\n    modules=[\n        # This goes first so we can define some cryptography-wide symbols.\n        \"cryptography\",\n        \"aes\",\n        \"asn1\",\n        \"bignum\",\n        \"bio\",\n        \"cmac\",\n        \"conf\",\n        \"crypto\",\n        \"ct\",\n        \"dh\",\n        \"dsa\",\n        \"ec\",\n        \"ecdh\",\n        \"ecdsa\",\n        \"engine\",\n        \"err\",\n        \"evp\",\n        \"fips\",\n        \"hmac\",\n        \"nid\",\n        \"objects\",\n        \"ocsp\",\n        \"opensslv\",\n        \"osrandom_engine\",\n        \"pem\",\n        \"pkcs12\",\n        \"rand\",\n        \"rsa\",\n        \"ssl\",\n        \"x509\",\n        \"x509name\",\n        \"x509v3\",\n        \"x509_vfy\",\n        \"pkcs7\",\n        \"callbacks\",\n    ],\n    libraries=_get_openssl_libraries(sys.platform),\n    extra_compile_args=_extra_compile_args(sys.platform),\n    extra_link_args=extra_link_args(compiler_type()),\n)\n", "path": "src/_cffi_src/build_openssl.py"}]}