Skip to content
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

preliminary Linux ARM support #6249

Closed
wants to merge 1 commit into from
Closed

Conversation

crabtw
Copy link
Contributor

@crabtw crabtw commented May 5, 2013

It uses the private field of TCB head to store stack limit. I tested on my Raspberry PI. A simple hello world program ran without any problem. However, for a more complex program, it segfaulted as #6231.

@crabtw
Copy link
Contributor Author

crabtw commented May 6, 2013

Here is a LLVM patch for segmented stacks
http://people.cs.nctu.edu.tw/~jyyou/rust/arm-segstk.patch

CFG_LDPATH_arm-unknown-linux-gnueabihf :=
CFG_RUN_arm-unknown-linux-gnueabihf=
CFG_RUN_TARG_arm-unknown-linux-gnueabihf=

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps also add RUSTC_FLAGS_arm-unknown-linux-gnueabihf :=--linker $(CC_arm-unknown-linux-gnueabihf)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@ILyoan
Copy link
Contributor

ILyoan commented May 7, 2013

Great!! but I'm not sure if it's safe to use 1'st TLS slot to store stack limit.
@crabtw Is it OK to use that slot?

CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-no-whole-archive -Wl,-znoexecstack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think noexecstack is needed now that the assembly objects are marked as having non-executable stacks.

@luqmana
Copy link
Member

luqmana commented May 7, 2013

@ILyoan @crabtw Currently and in this patch, the TLS base address is loaded via the system control coprocessor with mrc but on some ARM chips (like the one I was testing my patch on) that doesn't work so I loaded it instead from the magic address the linux kernel maps into processes, 0xFFFF0FF0. Would that perhaps be a more general approach?

@crabtw
Copy link
Contributor Author

crabtw commented May 7, 2013

@ILyoan It's actually not a TLS slot. It's a private field of TCB. I am not sure if it is safe to use it.

typedef struct
{
  dtv_t *dtv;
  void *private;
} tcbhead_t;

From: http://www.eglibc.org/cgi-bin/viewvc.cgi/trunk/libc/ports/sysdeps/arm/nptl/tls.h?revision=22177&view=markup

@crabtw
Copy link
Contributor Author

crabtw commented May 7, 2013

I removed -Wl,-znoexecstack

@crabtw
Copy link
Contributor Author

crabtw commented May 7, 2013

@luqmana Loading from magic address is fine for me.

@brson brson mentioned this pull request May 9, 2013
@brson
Copy link
Contributor

brson commented May 9, 2013

I opened #6367 to batch up and merge our pending LLVM patches.

bors added a commit that referenced this pull request May 18, 2013
It uses the private field of TCB head to store stack limit. I tested on my Raspberry PI. A simple hello world program ran without any problem. However, for a more complex program, it segfaulted as #6231.
@bors bors closed this May 18, 2013
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.

6 participants