From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.92.89.68]) by mx.groups.io with SMTP id smtpd.web11.9793.1653499926408853853 for ; Wed, 25 May 2022 10:32:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=cvyrBKTp; spf=pass (domain: outlook.com, ip: 40.92.89.68, mailfrom: kilian_kegel@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hdUvKDEFf8dSZtgcYG5/wrbjtk3wbXERHq1zlud/7/aNMt58t51cwi6lIc7+PzUhA9A850V1+e3iAXa0MP4obX+bCDJXO62JKBjnCAvtFthK4zcFP1NyVQucfUxduF+qtGFX2rxLJF1UuKSrx/JWpqBQ90UDyQ9w2gcPD+n34GKNq76HTEJcKDisXyxcE8QpMsGXsyHSRTX3pDp3Wc2W6RAn5pv/3VoxoAGciZr4OI7+UjHOZ+1A2qy+edeU8o/Tu/nJxL1JyVqBZwPPlD7zNtp8wqr1U8Lg6WE5icDc9i9bpMR0j1U98tWJtV91VOylNZkGZq7eTtrNcsPHCmvTYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q8t8+eQIy5VIAYP6e5xEXSTxPWUs5NQRHZlerrRS4RM=; b=R3bRVYBHTXXJ8z6TWenNVlM/PzKl3rsaBILKG+clNttZioAy+xchvTXxYGfVkd/cGGmEky0mVxPwmsx0vGpqLYSP8aBB5omarA+yLLd+ZKIDqFUPz575pBkDFrcgQLvRNhjVbxiJ6emTznIzUneGVGzj/pdo3+m8ymo2RvfwtpEE2uw4tV4fC6YY7X6lNq+FJBnheJcV+d2RGkBuBFybOlhw5FZtRPrhtgEaP22IpwZQeGbD4KqeiHOutYjdMLwA/Y1d5kyVzfU7vBnSe2QWDGLOOoO4AoCXD8bEKDxS0ds5yjsA/97jKy06UnxBhpzbJ9C2CkMl0WJdSCIUjEDNmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q8t8+eQIy5VIAYP6e5xEXSTxPWUs5NQRHZlerrRS4RM=; b=cvyrBKTpkKuKtatpdRT+5HPc6Fn9wr/nSb1x1xnJm2NQj6JiuVu7FmQr7i1I+CMuWQrFuqtiTqtpaK5zMjRpMRWDCUVBZhEuaK/Bd/0OtCK68qwexzKAY148J+V9HijcqvRKIik7eZsRW/O438vf7068QubeOkB+rSIa7dYToA2rnzLLZhuDZAO3+fmWgViuBFDexEc1mDgqCnzI2YAkOGKMQdA3MfWa2RgTp4uFyNcDUiWF1ndXQTYIUbrI/Jlm7MqyFRSAzJ2BsWF65GU8l7GjogulFh7tJt22ctIiO3SG+6SBa6VuTLDet3eFyOwQxs5LZmEobKf64MxwHzvhNA== Received: from AS8P189MB2072.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:521::5) by DBBP189MB1163.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:1e4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.15; Wed, 25 May 2022 17:32:04 +0000 Received: from AS8P189MB2072.EURP189.PROD.OUTLOOK.COM ([fe80::a0ad:dd5f:d691:8a94]) by AS8P189MB2072.EURP189.PROD.OUTLOOK.COM ([fe80::a0ad:dd5f:d691:8a94%9]) with mapi id 15.20.5227.021; Wed, 25 May 2022 17:32:04 +0000 From: "Kilian Kegel" To: "devel@edk2.groups.io" , "xzavierpower@gmail.com" Subject: Re: [edk2-devel] including redfish libs results in multiple definitions of symbols Thread-Topic: [edk2-devel] including redfish libs results in multiple definitions of symbols Thread-Index: AQHYcFO9YlT7V0lP9EGEJPOAL3wllK0vx/usgAAQkJ4= Date: Wed, 25 May 2022 17:32:04 +0000 Message-ID: References: <16F268C9DA792DE0.12338@groups.io> In-Reply-To: <16F268C9DA792DE0.12338@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-tmn: [S9meu4SW+uKz9F/JrThAv36F6LyMWy5g8s4xgVp6AZUpCQG1iln/BAlKoa6Lb7EW] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ac03cfd5-3922-43d2-473c-08da3e747be1 x-ms-traffictypediagnostic: DBBP189MB1163:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mj+3fmxWrXmDowYe1DWJPqASaXRkLoB24MvS2pDRDso1/2/ZTWtXQ0e849MWmhCyvKFD+t9Jiq29DzuNDZalRdVZQnGAzVUrnNUDw2XA27e3oWmGYxTyQ80/wA1ctsjBKuK9WKxEtmwRVq5SVAxqR5nUVowaX1bGdso6Ir/7yssZJfgsPejxrNiWkw4eFodPHkUs2Aja1inT+GTqFROcw3yBRjvMbU94N6Srr0BcOI4PkYk1vujtDzCK5iUlBXOLxoqSQbrdGLeXlMZ3uvcU54QNGUFX6QJ42Syl8A9B6nu3Zd1dbHsvb0Zohxsxb3MUxqrFNUqO/GlEcdNzpiwRkBQJWWDU9ii3TlJ9E/D4cUEkna+/TzYV2BelUSuI+JSOAlE5bcwk01nlnxf6OvOBSGrt2hb8Os9A9q9IGDsz+LV4YAP5Lty2VVpKh+ly734Bs8ZYKC4eYGU5pwf01+qFQ6zRtLRQOx/qkn6i0pHQunDeSSCrIuHyn9lISsgK9t5YUyar4msuurXM24Ti5NfeJTT5Q99vKtyBkcrPCx5xmXNz2Wy17G15f6vHG/a0W3UkC9xVhvWu7csKEEJxBum5Vc7TPHEvP9ZfR0NmUjRyO7PaZBDPGO77quh39XRu4wGhiQ36+fc6TjbZrNDNYyp9Y23hQIl0cyEdhXH24Qrfnbw= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?AL6UNhqVJFkl/uKKy4qQPSZQVDEH4a5eXmY/eSH/O6H2VyQFlq4eaoNQ?= =?Windows-1252?Q?ep7r5jGpaQpPLxPkHsb/+5vLKt9KKRz+FDJqrXnF/nX7+Dr1XfwgBHH+?= =?Windows-1252?Q?TW/vNYfbEQi3uzAnMO9B3Nbs/q8mwhHUrLUTdSdcazl0AnQU7Olyly21?= =?Windows-1252?Q?9dOj6E/e8U5AZFuUJwjI1eoGxiF28E1Cnett5JT5cGbqGkZWB+hgVkoI?= =?Windows-1252?Q?OZxw9CjK3bC0F4mkg3Wyqb5oCXIl0k+hED5nFtPupUSUViR0TpBDF5+6?= =?Windows-1252?Q?L0FBOPG4Hm9iCXB56o3gvnxXzVgcVlR/r3Qk6/f0NTANdjQVmZOGj5cd?= =?Windows-1252?Q?elTObKnMLbBUT0nc2W/iuqsWfHWJjskZ/6W7m3LWTz7KmGIMrbKigYMp?= =?Windows-1252?Q?rykvVUYl6SPIvU9wdeL5c+s5kGu4JU2+D5xuBNuMsi06FdbQPnNAj8nA?= =?Windows-1252?Q?2G5eVgET0qu0ZRJLRITk3N5OiRLV4J05+HDYPiR0dEwT/yQVfXUP+tJV?= =?Windows-1252?Q?SuM5WDDbkS417o6t9DOSZ1Yivalulx4IzodDR6gxq/Bw3PZO115MzClY?= =?Windows-1252?Q?lRqJsPoTQwdPFVX8vbs2MWSsOv7AI3MU6ZSblzZKr1x9b5GweO8yqm2u?= =?Windows-1252?Q?0YgaI7SQqSOGbVIUB821VWfTNCChi73urf6ZtKqUUnhODLI53eq2P7Ds?= =?Windows-1252?Q?xuVwAGCtrTxYLhMF5zU0M3LlrM0xJsbNo3tUbBKbA47ScZZWyXs0HGWG?= =?Windows-1252?Q?ooRBaJlGE+F8AOJ0nPcjotxZbHLDTe9IoB2e9vIakrr2mct277ugO5EM?= =?Windows-1252?Q?uyN9YBuDq8Nzd5Ny8MD3pzi2od75EyziqrAtCOBo5H8qWfo9vxUxl4G8?= =?Windows-1252?Q?pUMnVuJ63b05UY67NaLbkrZQY7PVe5pM4FDsnmQ6OGfXngsgVr97LXo6?= =?Windows-1252?Q?awHUzoGWC64WHAVt6J7BEmFZyJPgYnUvEfIeou/JZFZcVUHCA3UxhzG1?= =?Windows-1252?Q?adt2MYZb9mD3seAmCTlxGep5V1+iwHSPkYdJlzZKvlGYSr5aOvFbVpWj?= =?Windows-1252?Q?5XqYtLzSJ9bnfhKlETbRPMjDOEW2QMJXyJB7s5XlR5WouFBZPluPFT3L?= =?Windows-1252?Q?M+XKG7fzosjRmhX3B1LU8iySLhtnTaTPxhA0oQ5mpY3aTa61jSs6N3Cq?= =?Windows-1252?Q?pyTgpV5CoKvL8AfAln14hy3AZ4pOHlVmWLNLfMRGeDkZQVcKoyu4Gix4?= =?Windows-1252?Q?7K3/F0ryV8j8i15rVgVuc+W35hPy/wPW2gFOgUoG4JxIegJsTza1XkkM?= =?Windows-1252?Q?NJBtHfcPPzy/oCXTd1wY2IDcnvGWMR6gkFYSzXyUrA0a4E+iyY5W0KQE?= =?Windows-1252?Q?Cfhl31uAyRUEFOYMtIEP2WdmR52qFoYec3Ii009l8cXPHdOXF1QExx8f?= =?Windows-1252?Q?oZCjOQ/DgB02+1veCWtOMzWbQ6/yybjmFK3bJJ3DmdvtVRYPZa8vKUmX?= =?Windows-1252?Q?SoP7/B7l3f9dcx0Y4FAKNKS42yFzO6Msng81Cyl7+O/2BfFMKCVrwm8U?= =?Windows-1252?Q?4Hdt/x+4BE6SbA5ouvSLViqn4PbZ+AIYVinpkZxvk0DIEAfiqjJ7eqFv?= =?Windows-1252?Q?McaayvCAzCsncz1mMYGrhM7z?= MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8P189MB2072.EURP189.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: ac03cfd5-3922-43d2-473c-08da3e747be1 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 May 2022 17:32:04.1680 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBP189MB1163 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_AS8P189MB20727792C341BBEBE4F82AF4EBD69AS8P189MB2072EURP_" --_000_AS8P189MB20727792C341BBEBE4F82AF4EBD69AS8P189MB2072EURP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Correction: 1. if a .LIB is passed to the linker instead, the linker searches the .L= IB for a particular symbol (e.g. function, data). The specific .OBJ module that holds that part= icular symbol, is linked to the target.EFI. (the linker creates an link-error, like yours, if one or more symbol-name/s= from that particular NON-one-definition-rule.OBJ is already present in the= target.EFI) ________________________________ From: devel@edk2.groups.io on behalf of Kilian Kegel= Sent: Wednesday, May 25, 2022 7:20:26 PM To: devel@edk2.groups.io ; xzavierpower@gmail.com Subject: Re: [edk2-devel] including redfish libs results in multiple defini= tions of symbols Hi xp, your build failure is 1. the result of a =93link-all=94 mechanism or 2. the result of a library construction flaw that is commonly used i= n EDK2. or both Let me explain the theory: 1. an .OBJ file is created by the compiler for each .C source code file an .OBJ is considered as atomic, it can not be split into smaller pieces (e= xcept with newer compiler switches) 1. a =93library=93 .LIB is a collection of one or more of such .OBJ file= s 2. if an .OBJ is passed to linker, it is _always_ linked into the target= .EFI (the linker creates an link-error, like yours, if that particular symbol-na= me is already present in the target.EFI) One definition rule: https://docs.microsoft.com/en-us/cpp/error-messages/to= ol-errors/linker-tools-error-lnk2005?view=3Dmsvc-170 1. if an .LIB is passed to the linker instead, the linker searches the .= LIB for a particular symbol (e.g. function, data). The specific .OBJ module that holds that part= icular symbol, is linked to the target.EFI. (the linker creates an link-error, like yours, if that particular symbol-na= me is already present in the target.EFI) One definition rule: https://docs.microsoft.com/en-us/cpp/error-messages/to= ol-errors/linker-tools-error-lnk2005?view=3Dmsvc-170 1. to prevent such error each .OBJ of a library can hold only one single= symbol, one function or one data. Only in that case the linker is able to pickup each single symbol from the = library and bind it into the target.EFI without any conflict. This is also explained here: https://github.com/tianocore/edk2-staging/tree/CdePkg/blogs/2021-12-19#redf= ishcrtlib-conflicts-with-cdepkg-by-design Best regards, Kilian ________________________________ From: devel@edk2.groups.io on behalf of M.T. Sent: Wednesday, May 25, 2022 6:23:02 PM To: devel@edk2.groups.io Subject: [edk2-devel] including redfish libs results in multiple definition= s of symbols Hello I'm working on a small UEFI shell app. I was hoping to make use of the JsonLib found in the Redfish Package. When I include the Redfish JsonLib and it's dependencies: JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf Ucs2Utf8Lib|RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf RedfishCrtLib|RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf BaseSortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf BaseSortLib has symbol clashes with SortLib resulting in the following: /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort': (.text+0x0): multiple definition of `PerformQuickSort'; BaseSortLib.obj (sy= mbol from plugin):(.text+0x0): first defined here /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort': (.text+0x0): multiple definition of `DevicePathCompare'; BaseSortLib.obj (s= ymbol from plugin):(.text+0x0): first defined here /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort': (.text+0x0): multiple definition of `StringNoCaseCompare'; BaseSortLib.obj = (symbol from plugin):(.text+0x0): first defined here /usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort': (.text+0x0): multiple definition of `StringCompare'; BaseSortLib.obj (symbo= l from plugin):(.text+0x0): first defined here I need SortLib for UEFIShell dependencies, and I need BaseSortLib for JsonL= ib. Is there some way around this? Or is Redfish meant to be standalone? Thank you in advance xp --_000_AS8P189MB20727792C341BBEBE4F82AF4EBD69AS8P189MB2072EURP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Correction:

  1. if a .LIB is passed to the linker instead, the linker searches the .L= IB for a particular

symbol (e.g. function, data). The specific .O= BJ module that holds that particular symbol, is

linked to the target.EFI.

(the linker creates an link-error, like yo= urs, if one or more symbol-name/s from that particular NON-one-definition-rule.OBJ is already present in th= e target.EFI)

 

 


From: devel@edk2.groups.io = <devel@edk2.groups.io> on behalf of Kilian Kegel <KILIAN_KEGEL@OUT= LOOK.COM>
Sent: Wednesday, May 25, 2022 7:20:26 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; xzavierpower@= gmail.com <xzavierpower@gmail.com>
Subject: Re: [edk2-devel] including redfish libs results in multiple= definitions of symbols
 

Hi xp,

 

your build failure is

  1. the result of a = =93link-all=94 mechanism

or

       2. the result= of a library construction flaw that is commonly used in EDK2.

 

or both

 

Let me explain the theory:

 

  1. an .OBJ file is = created by the compiler for each .C source code file

an .OBJ is considered as atomic, it can not= be split into smaller pieces (except with newer compiler switches)

  1. a =93library=93 = .LIB is a collection of one or more of such .OBJ files
  2. if an .OBJ is passed to linker, = it is _always_ linked into the target.EFI

(the linker creates an link-error, like = yours, if that particular symbol-name is already present in the target.EFI)=

One definition rule: https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tool= s-error-lnk2005?view=3Dmsvc-170

  1. if an .LIB is pa= ssed to the linker instead, the linker searches the .LIB for a particular

symbol (e.g. function, data). The specific = .OBJ module that holds that particular symbol, is

linked to the target.EFI.

(the linker creates an link-error, like = yours, if that particular symbol-name is already present in the target.EFI)=

One definition rule: https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tool= s-error-lnk2005?view=3Dmsvc-170

  1. to prevent such = error each .OBJ of a library can hold only one single symbol, one function = or one data.

Only in that case the linker is able to pic= kup each single symbol from the library and bind it into the target.EFI

without any conflict.

 

This is also explained here:

https://github.com/tianocore/edk2-staging/tree/CdePkg/blogs/2021-12-19#= redfishcrtlib-conflicts-with-cdepkg-by-design

 

Best regards,

Kilian

 


From: devel@edk2.groups.i= o <devel@edk2.groups.io> on behalf of M.T. <xzavierpower@gmail.com= >
Sent: Wednesday, May 25, 2022 6:23:02 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Subject: [edk2-devel] including redfish libs results in multiple def= initions of symbols
 
Hello

I'm working on a small UEFI shell app.
I was hoping to make use of the JsonLib found in the Redfish Package.<= /div>

When I include the Redfish JsonLib and it's dependencies:
JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf
Ucs2Utf8Lib|RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
RedfishCrtLib|RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
BaseSortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf

BaseSortLib has symbol clashes with SortLib resulting in the following= :

/usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `Perfor= mQuickSort':
(.text+0x0): multiple definition of `PerformQuickSort'; BaseSortLib.obj (sy= mbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort':
(.text+0x0): multiple definition of `DevicePathCompare'; BaseSortLib.obj (s= ymbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort':
(.text+0x0): multiple definition of `StringNoCaseCompare'; BaseSortLib.obj = (symbol from plugin):(.text+0x0): first defined here
/usr/bin/ld: UefiSortLib.obj (symbol from plugin): in function `PerformQuic= kSort':
(.text+0x0): multiple definition of `StringCompare'; BaseSortLib.obj (symbo= l from plugin):(.text+0x0): first defined here

I need SortLib for UEFIShell dependencies, and I need BaseSortLib for = JsonLib.
Is there some way around this?  Or is Redfish meant to be standal= one?

Thank you in advance
xp
--_000_AS8P189MB20727792C341BBEBE4F82AF4EBD69AS8P189MB2072EURP_--