GNU Assembler

GNU Assembler
Developer(s)GNU Project
Stable release
GNU Binutils 2.43.1[1] Edit this on Wikidata / 17 August 2024; 4 months ago (17 August 2024)
Written inC
PlatformCross-platform
TypeAssembler
LicenseGNU General Public License v3
Websitewww.gnu.org/software/binutils/

The GNU Assembler, commonly known as gas or as, is the assembler developed by the GNU Project. It is the default back-end of GCC. It is used to assemble the GNU operating system and the Linux kernel, and various other software. It is a part of the GNU Binutils package.

The GAS executable is named as, the standard name for a Unix assembler. GAS is cross-platform, and both runs on and assembles for a number of different computer architectures. GAS is free software released under the GNU General Public License v3.

History

The first version of GAS was released in 1986–1987.[2] It was written by Dean Elsner and supported the VAX architecture.[2]

General syntax

GAS supports a general syntax that works for all of the supported architectures. The general syntax includes assembler directives and a method for commenting. The default syntax is AT&T syntax.

Directives

GAS uses assembler directives (also known as pseudo ops), which are keywords beginning with a period that behave similarly to preprocessor directives in the C programming language. While most of the available assembler directives are valid regardless of the target architecture, some directives are machine dependent.[3]

Since version 2.10, Intel syntax can be used through use of the .intel_syntax directive.[4][5][6]

Comments

GAS supports two comment styles.[7]

Multi-line

As in C, multi-line comments start and end with mirroring slash-asterisk pairs:

/* 
comment
*/

Single-line

Single line comments have a few different formats varying on which architecture is being assembled for.

Usage

Being the back-end for a popular compiler suite, namely GCC, the GNU Assembler is very widely used in compiling modern free and open source software. GAS is often used as the assembler on Linux operating systems in conjunction with other GNU software. A modified version of GAS can also be found in the macOS development tools package.

Example program

A standard "Hello, world!" program for Linux on IA-32:

.global	_start

.text
_start:
	movl  $4, %eax   # 4 (code for "write" syscall) -> EAX register
	movl  $1, %ebx   # 1 (file descriptor for stdout) -> EBX (1st argument to syscall)
	movl  $msg, %ecx # 32-bit address of msg string -> ECX (2nd argument)
	movl  $len, %edx # length of msg string -> EDX (3rd arg)
	int   $0x80      # interrupt with location 0x80 (128), which invokes the kernel's system call procedure

	movl  $1, %eax   # 1 ("exit") -> EAX
	movl  $0, %ebx   # 0 (with success) -> EBX
	int   $0x80      # see previous
.data
msg:
	.ascii  "Hello, world!\n" # inline ascii string
	len =   . - msg           # assign (current address - address of msg start) to symbol "len"

See also

References

  1. ^ Nick Clifton (17 August 2024). "GNU Binutils 2.43.1 released". Retrieved 18 August 2024.
  2. ^ a b "The GNU Assembler". CiteSeerX 10.1.1.32.4503.
  3. ^ "The GNU Assembler - Assembler Directives". Archived from the original on 2012-02-22. Retrieved 2008-04-13.
  4. ^ "GNU Assembler News". A new pseudo-op .intel_syntax has been implemented to allow gas to parse i386 assembly programs with intel syntax.
  5. ^ "AT&T Syntax versus Intel Syntax". Archived from the original on 20 June 2011. Retrieved 28 July 2014.
  6. ^ Ram Narayan (2007-10-17). "Linux assemblers: A comparison of GAS and NASM". IBM DeveloperWorks. Archived from the original on 3 March 2009. Retrieved 28 July 2014.
  7. ^ Red Hat Inc. "Using as". Archived from the original on June 20, 2011. Retrieved Jan 10, 2013.

Read other articles:

1911 Canadian federal election ← 1908 September 21, 1911 1917 → ← outgoing memberselected members →221 seats in the House of Commons111 seats needed for a majorityTurnout70.2%[1] (0.1pp)   First party Second party   Leader Robert Borden Wilfrid Laurier Party Conservative Liberal Leader since 1901 1887 Leader's seat Halifax SoulangesQuebec East[a] Last election 85 133 Seats won 132 85 Seat change 47...

 

PT Kereta Api LogistikNama dagangKAI LogistikJenisPerseroan terbatasIndustriLogistikDidirikan8 September 2009; 14 tahun lalu (2009-09-08)KantorpusatStasiun Gondangdia Lt. 1, Jl. KH. Wahid Hasyim No. 11 A, Jakarta Pusat 10340Wilayah operasiIndonesiaTokohkunciTLN Ahmad Malik Syah[1](Direktur Utama)Awan Hermawan Purwadinata[1](Komisaris Utama)JasaPengangkutan barangKurirTerminal bahan bakar minyakTerminal peti kemasBongkar muat batu baraPendapatanRp 998,708 milyar (2021)[...

 

هذه المقالة تحتاج للمزيد من الوصلات للمقالات الأخرى للمساعدة في ترابط مقالات الموسوعة. فضلًا ساعد في تحسين هذه المقالة بإضافة وصلات إلى المقالات المتعلقة بها الموجودة في النص الحالي. (نوفمبر 2019) دوري السوبر الألباني 1931 تفاصيل الموسم دوري السوبر الألباني  النسخة 2  الب...

كولن غروفز (بغير المعروفة: Colin Groves)‏    معلومات شخصية الميلاد 24 يونيو 1942   لندن  الوفاة 30 نوفمبر 2017 (75 سنة) [1]  كانبرا  الإقامة كانبرا  مواطنة أستراليا  الحياة العملية المدرسة الأم كلية لندن الجامعية (الشهادة:دكتور في الفلسفة)[2]الجامعة الوطنية الأس...

 

Asia centraleYurta sul lago Songköl in Kirghizistan Stati Kazakistan Kirghizistan Tagikistan Turkmenistan Uzbekistan Superficie4 002 000 km² Abitanti73 813 330 Densità18 ab./km²      Asia centrale (Macroregione ONU) L'Asia centrale è una regione interna dell'Asia, che convenzionalmente va dalla sponda asiatica del Mar Caspio alla Cina nord-occidentale. Conosciuta dai romani con il nome di Transoxiana e chiama...

 

وصلة شوتكي   النوع ثنائي مساري شبه موصل  [لغات أخرى]‏  الرمز الإلكتروني   تعديل مصدري - تعديل   مختلف أنواع ديود شوتكي لتطبيقات مختلفة. وصلة شوتكي أو ديود شوتكي (بالإنجليزية: Schottky diode)‏ هي أحد المكونات الإلكترونية وهي نوع خاص من وصلة بي إن (ديود) حيث يقوم معدن ...

Americans of Fula (Fulbe) (or Fulani) descent Fula AmericansOmar ibn SaidTotal population2.1MillionLanguagesEnglish, French, Fula, ArabicReligionIslam, Christianity, Traditional African religion Fula Americans, Fulani Americans or Fulbe Americans are Americans of Fula (Fulani) (Fulbe) descent. The first Fulani people who were forcibly expatriated to United States from the slave trade came from several parts of West and Central Africa. Many Fulbe came of places as Guinea, Senegal, Guinea-Bissa...

 

Universitas Dankook단국대학교 (檀國大學校)Moto자립·자주·구국Moto dalam bahasa InggrisSelf-relianceIndependenceNational salvationJenisUniversitas swastaDidirikan3 November 1947PresidenHo-sung ChangSarjanaKampus Jukjeon: 10,466Kampus Cheonan: 11,686MagisterKampus Jukjeon: 3,648Kampus Cheonan: 3,987LokasiKampus Jukjeon: Yongin, Gyeonggi, Korea SelatanKampus Cheonan: Cheonan,Chungnam, Korea SelatanKampusUrbanWarnaBiru  MaskotBeruang[1]Situs webdankook.ac.krBerk...

 

追晉陸軍二級上將趙家驤將軍个人资料出生1910年 大清河南省衛輝府汲縣逝世1958年8月23日(1958歲—08—23)(47—48歲) † 中華民國福建省金門縣国籍 中華民國政党 中國國民黨获奖 青天白日勳章(追贈)军事背景效忠 中華民國服役 國民革命軍 中華民國陸軍服役时间1924年-1958年军衔 二級上將 (追晉)部队四十七師指挥東北剿匪總司令部參謀長陸軍�...

  「俄亥俄」重定向至此。关于其他用法,请见「俄亥俄 (消歧义)」。 俄亥俄州 美國联邦州State of Ohio 州旗州徽綽號:七葉果之州地图中高亮部分为俄亥俄州坐标:38°27'N-41°58'N, 80°32'W-84°49'W国家 美國加入聯邦1803年3月1日,在1953年8月7日追溯頒定(第17个加入联邦)首府哥倫布(及最大城市)政府 • 州长(英语:List of Governors of {{{Name}}}]]) •&...

 

نظام الكانابينويد الداخلي (ECS) هو نظام أحيائي مكون من الكانابينويدات الداخلية وهي نواقل عصبية رجوعية ترتبط بمستقبلات الكانابينويد، وبروتينات مستقبل الكانابينويد التي يعُبَّر عنها في الجهاز العصبي المركزي للفقاريات (بما في ذلك الدماغ) والجهاز العصبي المحيطي. مازال نظام ا...

 

The Right HonourableThérèse CoffeyMPPotret resmi, 2017 Menteri Lingkungan Hidup, Pangan, dan Pedesaan Britania RayaMasa jabatan25 Oktober 2022 – 13 November 2023Perdana MenteriRishi SunakPendahuluRanil JayawardenaPenggantiSteve BarclayWakil Perdana Menteri Britania RayaMasa jabatan6 September 2022 – 25 Oktober 2022Perdana MenteriLiz TrussPendahuluDominic RaabPenggantiDominic RaabMenteri Kesehatan dan Layanan Sosial Britania RayaMasa jabatan6 September 2022 – ...

Athenian comic playwright (c. 342/41 – c. 290 BC) For other uses, see Menander (disambiguation). MenanderBust of Menander. Marble, Roman copy of the Imperial era after a Greek original (c. 343–291 BC).Born342/41 BCKephisia, AthensDiedc. 290 BC (aged 50 – 52)EducationStudent of Theophrastus at the LyceumGenreNew ComedyNotable works Dyskolos Samia Menander (/məˈnændər/; Greek: Μένανδρος Menandros; c. 342/41 – c. 290 BC) was a Greek dramatist and the best-known ...

 

Zone within FIBA (International Basketball Federation) FIBA AmericasFormation11 October 1975TypeSports federationHeadquartersMiami, FloridaMembership 42 national associationsOfficial language English and SpanishPresidentCarol CallanWebsitefiba.basketball/americas FIBA Americas (Spanish: Confederación Panamericana de Baloncesto, French: FIBA Amériques) is a zone within FIBA (International Basketball Federation). It is one of FIBA's five continental confederations. FIBA Americas is responsibl...

 

American mathematician at UCLA (born 1943) Robert Everist GreeneGreene teaching undergraduate complex analysis in 2023Born1943Alma materMichigan State University, University of California, BerkeleyKnown forComplex analysisScientific careerInstitutionsUCLA Robert Everist Greene (born 1943) is an American mathematician at UCLA. Greene was an undergraduate at Michigan State University and a Putnam Fellow in 1963.[1] He completed his Ph.D. at the University of California, Berkel...

  关于与「的黎波里」標題相近或相同的条目页,請見「的黎波里 (消歧義)」。 的黎波里طرابلس الغربTarabulus al-Gharb最上:That El Emad Towers(英语:That El Emad Towers);中间:烈士广场;左下:馬爾庫斯·奧列里烏斯拱门;右下:Souq al-Mushir – Tripoli Medina 旗幟的黎波里在利比亚的位置坐标:32°52′31″N 13°11′15″E / 32.87519°N 13.18746°E / 32.87519; 13.18746...

 

This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: Hanoi Medical University – news · newspapers · books · scholar · JSTOR (March 2008) (Learn how and when to remove this message) Hanoi Medical UniversityTrường Đại học Y Hà NộiCurrent campus of HMU in Đống Đa DistrictFormer namesIndochina Medical CollegeEstablished1902PresidentProf Thanh Van ...

 

Chemical compound DimemebfeClinical dataOther names5-MeO-BFELegal statusLegal status DE: NpSG (Industrial and scientific use only) UK: Class A US: Unscheduled and not FDA approved Identifiers IUPAC name 2-(5-Methoxy-1-benzofuran-3-yl)-N,N-dimethylethanamine CAS Number140853-58-3 YPubChem CID126589ChemSpider112474 NUNII9JXZ3RM7Y9CompTox Dashboard (EPA)DTXSID80161481 Chemical and physical dataFormulaC13H17NO2Molar mass219.284 g·mol−13D model (JSmol)Interact...

Berry OakleyBerry Oakley in concerto nel 1972 Nazionalità Stati Uniti GenereRockSouthern rockHard rock Periodo di attività musicale1964 – 1972 Strumentobasso, chitarra, voce EtichettaAtco RecordsCapricorn Records GruppiThe Second ComingThe Allman Brothers Band Album pubblicati4 Studio2 The Allman Brothers Band (1969) Idlewild South (1970) Live2 At Fillmore East (1971) Eat a Peach (1972) Modifica dati su Wikidata · Manuale Raymond Berry Oakley III, noto sempli...

 

Sasha GreySasha Grey nel 2010Dati biograficiNome di nascitaMarina Ann Hantzis[1] Nazionalità Stati Uniti Dati fisiciAltezza168 cm Peso50 kg Etniacaucasica Occhinocciola Capellicastani Seno naturalesì Misure81-66-79[2] Dati professionaliAltri pseudonimiAnna Karina, Sascha Grey, Sasha Gray[2] Film girati 445 come attrice 2 come regista[2] Sito ufficiale Modifica dati su Wikidata · Manuale Sasha Grey, pseudonimo di Marina Ann Hantzis (North Hi...