Skip to content

Fix init array order #2074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2016
Merged

Fix init array order #2074

merged 1 commit into from
Jun 1, 2016

Conversation

unaiur
Copy link
Contributor

@unaiur unaiur commented May 31, 2016

GCC for Xtensa LX106 generates constructor sections names in inverse order.

The link script in tools/sdk/ld/eagle.app.v6.common.ld is also designed to create an __init_array in inverse order.

So we must traverse that array starting from the end.

@codecov-io
Copy link

codecov-io commented May 31, 2016

Current coverage is 26.31%

Merging #2074 into master will not change coverage

@@             master      #2074   diff @@
==========================================
  Files            19         19          
  Lines          3634       3634          
  Methods         328        328          
  Messages          0          0          
  Branches        585        585          
==========================================
  Hits            956        956          
  Misses         2513       2513          
  Partials        165        165          

Powered by Codecov. Last updated by 5313c56...2322660

@igrr
Copy link
Member

igrr commented Jun 1, 2016

What exactly do you mean by "inverse order"? Afaik the standard doesn't define the order of initialization for global objects. What do you use as reference for "correct order"?

@unaiur
Copy link
Contributor Author

unaiur commented Jun 1, 2016

The correct order is the order described in the init_priority attribute of
gcc:

https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html

Best regards
El 1 jun. 2016 4:52 AM, "Ivan Grokhotkov" notifications@github.com
escribió:

What exactly do you mean by "inverse order"? Afaik the standard doesn't
define the order of initialization for global objects. What do you use as
reference for "correct order"?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2074 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AFnLBxK4occ_GK-ffaLcMZupK7khuSvYks5qHPP-gaJpZM4IqOhG
.

@unaiur
Copy link
Contributor Author

unaiur commented Jun 1, 2016

I've written an small testcase here http://pastebin.com/HpcXqXsm that shows the issue.

@igrr
Copy link
Member

igrr commented Jun 1, 2016

Ah, right, priorities are not handled correctly this way. Thanks for the fix.

@igrr igrr merged commit 1dd50fb into esp8266:master Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants