[Asterisk-code-review] loader: Add volatile to resource being loaded. (asterisk[13.19])

Richard Mudgett asteriskteam at digium.com
Wed Dec 27 22:59:54 CST 2017


Richard Mudgett has submitted this change and it was merged. ( https://gerrit.asterisk.org/7737 )

Change subject: loader: Add volatile to resource_being_loaded.
......................................................................

loader: Add volatile to resource_being_loaded.

Some compiler optimizers seem to assume that dlopen will not use
__attribute__((constructor)) functions to call back to the program.
This was causing resource_being_loaded to be optimized away completely.

ASTERISK-27531 #close
Tested By: abelbeck

Change-Id: If17a3b889e06811a0e7119f0539d052494d6ece9
(cherry picked from commit 92fb393cab7fbd164e299601e94909ba95a0116b)
---
M main/loader.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Richard Mudgett: Looks good to me, approved; Approved for Submit



diff --git a/main/loader.c b/main/loader.c
index c18fb37..b9baf3e 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -202,7 +202,7 @@
  *
  * This is protected by the module_list lock.
  */
-static struct ast_module *resource_being_loaded;
+static struct ast_module * volatile resource_being_loaded;
 
 /*!
  * \internal

-- 
To view, visit https://gerrit.asterisk.org/7737
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13.19
Gerrit-MessageType: merged
Gerrit-Change-Id: If17a3b889e06811a0e7119f0539d052494d6ece9
Gerrit-Change-Number: 7737
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171227/e040cb1e/attachment-0001.html>


More information about the asterisk-code-review mailing list