diff mbox

[edk2,2/2] MdeModulePkg/BootMaintenanceManagerUiLib: hide library-internal symbol

Message ID 1463133042-3402-3-git-send-email-lersek@redhat.com
State Accepted
Commit 7b13510f2a0a2a118cdafdaa67720ca8e3fe37de
Headers show

Commit Message

Laszlo Ersek May 13, 2016, 9:50 a.m. UTC
Static storage duration objects that are internal to a library instance
should:
- either have internal linkage (i.e., be declared STATIC),
- or, if they are referenced in multiple files of the library instance,
  prefixed with a word that is specific to the library instance, and
  minimizes namespace collisions.

In this case, the "gHiiDriverList" variable (with static storage duration
and external linkage) is defined in both BootMaintenanceManagerUiLib and
UiApp. When these are linked together, GCC catches the multiple external
definitions and aborts the build. (GCC notices this due to commit
214a3b79417f.) Fix the error by applying the first rule above.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Fixes: a85be3ae48a8aaa40b755cd0ff7270c67cfed585
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.8.3.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ard Biesheuvel May 13, 2016, 10:04 a.m. UTC | #1
On 13 May 2016 at 11:50, Laszlo Ersek <lersek@redhat.com> wrote:
> Static storage duration objects that are internal to a library instance

> should:

> - either have internal linkage (i.e., be declared STATIC),

> - or, if they are referenced in multiple files of the library instance,

>   prefixed with a word that is specific to the library instance, and

>   minimizes namespace collisions.

>

> In this case, the "gHiiDriverList" variable (with static storage duration

> and external linkage) is defined in both BootMaintenanceManagerUiLib and

> UiApp. When these are linked together, GCC catches the multiple external

> definitions and aborts the build. (GCC notices this due to commit

> 214a3b79417f.) Fix the error by applying the first rule above.

>


Nice catch indeed.

Thanks,
Ard.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
index 177b2498d3ec..fefb714b9166 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
@@ -26,7 +26,7 @@  typedef struct {
   BOOLEAN         EmptyLineAfter;
 } UI_HII_DRIVER_INSTANCE;
 
-UI_HII_DRIVER_INSTANCE       *gHiiDriverList;
+STATIC UI_HII_DRIVER_INSTANCE       *gHiiDriverList;
 
 
 /**